adjustment_method.h 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  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. #ifndef COURGETTE_ADJUSTMENT_METHOD_H_
  5. #define COURGETTE_ADJUSTMENT_METHOD_H_
  6. namespace courgette {
  7. class AssemblyProgram;
  8. class AdjustmentMethod {
  9. public:
  10. // Factory methods for making adjusters.
  11. // Returns the adjustment method used in production.
  12. static AdjustmentMethod* MakeProductionAdjustmentMethod() {
  13. return MakeShingleAdjustmentMethod();
  14. }
  15. // Returns and adjustement method that makes no adjustments.
  16. static AdjustmentMethod* MakeNullAdjustmentMethod();
  17. // Returns the original adjustment method.
  18. static AdjustmentMethod* MakeTrieAdjustmentMethod();
  19. // Returns the new shingle tiling adjustment method.
  20. static AdjustmentMethod* MakeShingleAdjustmentMethod();
  21. AdjustmentMethod(const AdjustmentMethod&) = delete;
  22. AdjustmentMethod& operator=(const AdjustmentMethod&) = delete;
  23. // AdjustmentMethod interface:
  24. // Adjusts |program| to increase similarity to |model|. |program| can be
  25. // changed in any way provided that it still produces the same output when
  26. // assembled.
  27. virtual bool Adjust(const AssemblyProgram& model,
  28. AssemblyProgram* program) = 0;
  29. // Deletes 'this' adjustment method.
  30. virtual void Destroy();
  31. protected:
  32. AdjustmentMethod() {}
  33. virtual ~AdjustmentMethod() {}
  34. };
  35. } // namespace courgette
  36. #endif // COURGETTE_ADJUSTMENT_METHOD_H_