| OLD | NEW |
| 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef COURGETTE_ADJUSTMENT_METHOD_H_ | 5 #ifndef COURGETTE_ADJUSTMENT_METHOD_H_ |
| 6 #define COURGETTE_ADJUSTMENT_METHOD_H_ | 6 #define COURGETTE_ADJUSTMENT_METHOD_H_ |
| 7 | 7 |
| 8 #include "base/basictypes.h" | 8 #include "base/basictypes.h" |
| 9 | 9 |
| 10 namespace courgette { | 10 namespace courgette { |
| 11 | 11 |
| 12 class AssemblyProgram; | 12 class AssemblyProgram; |
| 13 | 13 |
| 14 class AdjustmentMethod { | 14 class AdjustmentMethod { |
| 15 public: | 15 public: |
| 16 // Factory methods for making adjusters. | 16 // Factory methods for making adjusters. |
| 17 | 17 |
| 18 // Returns the adjustment method used in production. | 18 // Returns the adjustment method used in production. |
| 19 static AdjustmentMethod* MakeProductionAdjustmentMethod(); | 19 static AdjustmentMethod* MakeProductionAdjustmentMethod() { |
| 20 return MakeShingleAdjustmentMethod(); |
| 21 } |
| 20 | 22 |
| 21 // Returns and adjustement method that makes no adjustments. | 23 // Returns and adjustement method that makes no adjustments. |
| 22 static AdjustmentMethod* MakeNullAdjustmentMethod(); | 24 static AdjustmentMethod* MakeNullAdjustmentMethod(); |
| 23 | 25 |
| 26 // Returns the original adjustment method. |
| 27 static AdjustmentMethod* MakeTrieAdjustmentMethod(); |
| 28 |
| 29 // Returns the new shingle tiling adjustment method. |
| 30 static AdjustmentMethod* MakeShingleAdjustmentMethod(); |
| 31 |
| 32 // AdjustmentMethod interface: |
| 24 | 33 |
| 25 // Adjusts |program| to increase similarity to |model|. |program| can be | 34 // Adjusts |program| to increase similarity to |model|. |program| can be |
| 26 // changed in any way provided that it still produces the same output when | 35 // changed in any way provided that it still produces the same output when |
| 27 // assembled. | 36 // assembled. |
| 28 virtual bool Adjust(const AssemblyProgram& model, | 37 virtual bool Adjust(const AssemblyProgram& model, |
| 29 AssemblyProgram* program) = 0; | 38 AssemblyProgram* program) = 0; |
| 30 | 39 |
| 31 // Deletes 'this' adjustment method. | 40 // Deletes 'this' adjustment method. |
| 32 virtual void Destroy(); | 41 virtual void Destroy(); |
| 33 | 42 |
| 34 protected: | 43 protected: |
| 35 AdjustmentMethod() {} | 44 AdjustmentMethod() {} |
| 36 virtual ~AdjustmentMethod() {} | 45 virtual ~AdjustmentMethod() {} |
| 37 | 46 |
| 38 DISALLOW_COPY_AND_ASSIGN(AdjustmentMethod); | 47 DISALLOW_COPY_AND_ASSIGN(AdjustmentMethod); |
| 39 }; | 48 }; |
| 40 | 49 |
| 41 } // namespace courgette | 50 } // namespace courgette |
| 42 #endif // COURGETTE_ADJUSTMENT_METHOD_H_ | 51 #endif // COURGETTE_ADJUSTMENT_METHOD_H_ |
| OLD | NEW |