OLD | NEW |
1 // Copyright (c) 2009 The Chromium OS Authors. All rights reserved. | 1 // Copyright (c) 2009 The Chromium OS 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 CHROMEOS_PLATFORM_UPDATE_ENGINE_PIPE_H__ | 5 #ifndef CHROMEOS_PLATFORM_UPDATE_ENGINE_PIPE_H__ |
6 #define CHROMEOS_PLATFORM_UPDATE_ENGINE_PIPE_H__ | 6 #define CHROMEOS_PLATFORM_UPDATE_ENGINE_PIPE_H__ |
7 | 7 |
8 #include <stdio.h> | 8 #include <stdio.h> |
9 #include <iostream> | 9 #include <iostream> |
10 #include <map> | 10 #include <map> |
(...skipping 23 matching lines...) Expand all Loading... |
34 // Used by Actions an InputObjectType or OutputObjectType to specify that | 34 // Used by Actions an InputObjectType or OutputObjectType to specify that |
35 // for that type, no object is taken/given. | 35 // for that type, no object is taken/given. |
36 class NoneType {}; | 36 class NoneType {}; |
37 | 37 |
38 template<typename T> | 38 template<typename T> |
39 class Action; | 39 class Action; |
40 | 40 |
41 template<typename ObjectType> | 41 template<typename ObjectType> |
42 class ActionPipe { | 42 class ActionPipe { |
43 public: | 43 public: |
44 virtual ~ActionPipe() { | 44 virtual ~ActionPipe() {} |
45 LOG(INFO) << "ActionPipe died"; | |
46 } | |
47 | 45 |
48 // This should be called by an Action on its input pipe. | 46 // This should be called by an Action on its input pipe. |
49 // Returns a reference to the stored object. | 47 // Returns a reference to the stored object. |
50 const ObjectType& contents() const { return contents_; } | 48 const ObjectType& contents() const { return contents_; } |
51 | 49 |
52 // This should be called by an Action on its output pipe. | 50 // This should be called by an Action on its output pipe. |
53 // Stores a copy of the passed object in this pipe. | 51 // Stores a copy of the passed object in this pipe. |
54 void set_contents(const ObjectType& contents) { contents_ = contents; } | 52 void set_contents(const ObjectType& contents) { contents_ = contents; } |
55 | 53 |
56 // Bonds two Actions together with a new ActionPipe. The ActionPipe is | 54 // Bonds two Actions together with a new ActionPipe. The ActionPipe is |
(...skipping 25 matching lines...) Expand all Loading... |
82 // TODO(adlr): find something like this that the compiler accepts: | 80 // TODO(adlr): find something like this that the compiler accepts: |
83 // COMPILE_ASSERT(typeof(typename FromAction::OutputObjectType) == | 81 // COMPILE_ASSERT(typeof(typename FromAction::OutputObjectType) == |
84 // typeof(typename ToAction::InputObjectType), | 82 // typeof(typename ToAction::InputObjectType), |
85 // FromAction_OutputObjectType_doesnt_match_ToAction_InputObjectType); | 83 // FromAction_OutputObjectType_doesnt_match_ToAction_InputObjectType); |
86 ActionPipe<typename FromAction::OutputObjectType>::Bond(from, to); | 84 ActionPipe<typename FromAction::OutputObjectType>::Bond(from, to); |
87 } | 85 } |
88 | 86 |
89 } // namespace chromeos_update_engine | 87 } // namespace chromeos_update_engine |
90 | 88 |
91 #endif // CHROMEOS_PLATFORM_UPDATE_ENGINE_PIPE_H__ | 89 #endif // CHROMEOS_PLATFORM_UPDATE_ENGINE_PIPE_H__ |
OLD | NEW |