Home | History | Annotate | Download | only in courgette
      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     return MakeShingleAdjustmentMethod();
     21   }
     22 
     23   // Returns and adjustement method that makes no adjustments.
     24   static AdjustmentMethod* MakeNullAdjustmentMethod();
     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:
     33 
     34   // Adjusts |program| to increase similarity to |model|.  |program| can be
     35   // changed in any way provided that it still produces the same output when
     36   // assembled.
     37   virtual bool Adjust(const AssemblyProgram& model,
     38                       AssemblyProgram* program) = 0;
     39 
     40   // Deletes 'this' adjustment method.
     41   virtual void Destroy();
     42 
     43  protected:
     44   AdjustmentMethod() {}
     45   virtual ~AdjustmentMethod() {}
     46 
     47   DISALLOW_COPY_AND_ASSIGN(AdjustmentMethod);
     48 };
     49 
     50 }  // namespace courgette
     51 #endif  // COURGETTE_ADJUSTMENT_METHOD_H_
     52