| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 // The main idea in Courgette is to do patching *under a tranformation*. The | 5 // The main idea in Courgette is to do patching *under a tranformation*. The |
| 6 // input is transformed into a new representation, patching occurs in the new | 6 // input is transformed into a new representation, patching occurs in the new |
| 7 // repesentation, and then the tranform is reversed to get the patched data. | 7 // repesentation, and then the tranform is reversed to get the patched data. |
| 8 // | 8 // |
| 9 // The idea is applied to pieces (or 'Elements') of the whole (or 'Ensemble'). | 9 // The idea is applied to pieces (or 'Elements') of the whole (or 'Ensemble'). |
| 10 // Each of the elements has to go through the same set of steps in lock-step, | 10 // Each of the elements has to go through the same set of steps in lock-step, |
| 11 // but there may be many different kinds of elements, which have different | 11 // but there may be many different kinds of elements, which have different |
| 12 // transformation. | 12 // transformation. |
| 13 // | 13 // |
| 14 // This file declares all the main types involved in creating and applying a | 14 // This file declares all the main types involved in creating and applying a |
| 15 // patch with this structure. | 15 // patch with this structure. |
| 16 | 16 |
| 17 #ifndef COURGETTE_ENSEMBLE_H_ | 17 #ifndef COURGETTE_ENSEMBLE_H_ |
| 18 #define COURGETTE_ENSEMBLE_H_ | 18 #define COURGETTE_ENSEMBLE_H_ |
| 19 | 19 |
| 20 #include <stddef.h> |
| 21 #include <stdint.h> |
| 22 |
| 23 #include <string> |
| 20 #include <vector> | 24 #include <vector> |
| 21 #include <string> | |
| 22 | 25 |
| 23 #include "base/basictypes.h" | 26 #include "base/macros.h" |
| 24 | |
| 25 #include "courgette/courgette.h" | 27 #include "courgette/courgette.h" |
| 26 #include "courgette/region.h" | 28 #include "courgette/region.h" |
| 27 #include "courgette/streams.h" | 29 #include "courgette/streams.h" |
| 28 | 30 |
| 29 namespace courgette { | 31 namespace courgette { |
| 30 | 32 |
| 31 // Forward declarations: | 33 // Forward declarations: |
| 32 class Ensemble; | 34 class Ensemble; |
| 33 | 35 |
| 34 // An Element is a region of an Ensemble with an identifyable kind. | 36 // An Element is a region of an Ensemble with an identifyable kind. |
| (...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 123 // transformed-element-1 | 125 // transformed-element-1 |
| 124 // transformed-element-2 | 126 // transformed-element-2 |
| 125 // ... | 127 // ... |
| 126 // stream 3: | 128 // stream 3: |
| 127 // correction: | 129 // correction: |
| 128 // base-file | 130 // base-file |
| 129 // element-1 | 131 // element-1 |
| 130 // element-2 | 132 // element-2 |
| 131 // ... | 133 // ... |
| 132 | 134 |
| 133 static const uint32 kMagic = 'C' | ('o' << 8) | ('u' << 16); | 135 static const uint32_t kMagic = 'C' | ('o' << 8) | ('u' << 16); |
| 134 | 136 |
| 135 static const uint32 kVersion = 20110216; | 137 static const uint32_t kVersion = 20110216; |
| 136 }; | 138 }; |
| 137 | 139 |
| 138 // For any transform you would implement both a TransformationPatcher and a | 140 // For any transform you would implement both a TransformationPatcher and a |
| 139 // TransformationPatchGenerator. | 141 // TransformationPatchGenerator. |
| 140 // | 142 // |
| 141 // TransformationPatcher is the interface which abstracts out the actual | 143 // TransformationPatcher is the interface which abstracts out the actual |
| 142 // transformation used on an Element. The patching itself happens outside the | 144 // transformation used on an Element. The patching itself happens outside the |
| 143 // actions of a TransformationPatcher. There are four steps. | 145 // actions of a TransformationPatcher. There are four steps. |
| 144 // | 146 // |
| 145 // The first step is an Init step. The parameters to the Init step identify the | 147 // The first step is an Init step. The parameters to the Init step identify the |
| (...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 239 SinkStream* reformed_element); | 241 SinkStream* reformed_element); |
| 240 | 242 |
| 241 protected: | 243 protected: |
| 242 Element* old_element_; | 244 Element* old_element_; |
| 243 Element* new_element_; | 245 Element* new_element_; |
| 244 TransformationPatcher* patcher_; | 246 TransformationPatcher* patcher_; |
| 245 }; | 247 }; |
| 246 | 248 |
| 247 } // namespace | 249 } // namespace |
| 248 #endif // COURGETTE_ENSEMBLE_H_ | 250 #endif // COURGETTE_ENSEMBLE_H_ |
| OLD | NEW |