[email protected] | 04ca1bc | 2009-05-08 23:00:29 | [diff] [blame^] | 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 |
| 3 | // found in the LICENSE file. |
| 4 | |
| 5 | #ifndef COURGETTE_ADJUSTMENT_METHOD_H_ |
| 6 | #define COURGETTE_ADJUSTMENT_METHOD_H_ |
| 7 | |
| 8 | #include "base/basictypes.h" |
| 9 | |
| 10 | namespace courgette { |
| 11 | |
| 12 | class AssemblyProgram; |
| 13 | |
| 14 | class AdjustmentMethod { |
| 15 | public: |
| 16 | // Factory methods for making adjusters. |
| 17 | |
| 18 | // Returns the adjustment method used in production. |
| 19 | static AdjustmentMethod* MakeProductionAdjustmentMethod(); |
| 20 | |
| 21 | // Returns and adjustement method that makes no adjustments. |
| 22 | static AdjustmentMethod* MakeNullAdjustmentMethod(); |
| 23 | |
| 24 | |
| 25 | // Adjusts |program| to increase similarity to |model|. |program| can be |
| 26 | // changed in any way provided that it still produces the same output when |
| 27 | // assembled. |
| 28 | virtual bool Adjust(const AssemblyProgram& model, |
| 29 | AssemblyProgram* program) = 0; |
| 30 | |
| 31 | // Deletes 'this' adjustment method. |
| 32 | virtual void Destroy(); |
| 33 | |
| 34 | protected: |
| 35 | AdjustmentMethod() {} |
| 36 | virtual ~AdjustmentMethod() {} |
| 37 | |
| 38 | DISALLOW_COPY_AND_ASSIGN(AdjustmentMethod); |
| 39 | }; |
| 40 | |
| 41 | } // namespace courgette |
| 42 | #endif // COURGETTE_ADJUSTMENT_METHOD_H_ |