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_ACTION_H__ | 5 #ifndef CHROMEOS_PLATFORM_UPDATE_ENGINE_ACTION_H__ |
6 #define CHROMEOS_PLATFORM_UPDATE_ENGINE_ACTION_H__ | 6 #define CHROMEOS_PLATFORM_UPDATE_ENGINE_ACTION_H__ |
7 | 7 |
8 #include <stdio.h> | 8 #include <stdio.h> |
9 #include <tr1/memory> | 9 #include <tr1/memory> |
10 #include <iostream> | 10 #include <iostream> |
(...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
180 CHECK(HasOutputPipe()); | 180 CHECK(HasOutputPipe()); |
181 out_pipe_->set_contents(out_obj); | 181 out_pipe_->set_contents(out_obj); |
182 } | 182 } |
183 | 183 |
184 // Returns a reference to the object sitting in the output pipe. | 184 // Returns a reference to the object sitting in the output pipe. |
185 const typename ActionTraits<SubClass>::OutputObjectType& GetOutputObject() { | 185 const typename ActionTraits<SubClass>::OutputObjectType& GetOutputObject() { |
186 CHECK(HasOutputPipe()); | 186 CHECK(HasOutputPipe()); |
187 return out_pipe_->contents(); | 187 return out_pipe_->contents(); |
188 } | 188 } |
189 | 189 |
190 protected: | 190 protected: |
191 // We use a shared_ptr to the pipe. shared_ptr objects destroy what they | 191 // We use a shared_ptr to the pipe. shared_ptr objects destroy what they |
192 // point to when the last such shared_ptr object dies. We consider the | 192 // point to when the last such shared_ptr object dies. We consider the |
193 // Actions on either end of a pipe to "own" the pipe. When the last Action | 193 // Actions on either end of a pipe to "own" the pipe. When the last Action |
194 // of the two dies, the ActionPipe will die, too. | 194 // of the two dies, the ActionPipe will die, too. |
195 std::tr1::shared_ptr< | 195 std::tr1::shared_ptr< |
196 ActionPipe<typename ActionTraits<SubClass>::InputObjectType> > | 196 ActionPipe<typename ActionTraits<SubClass>::InputObjectType> > |
197 in_pipe_; | 197 in_pipe_; |
198 std::tr1::shared_ptr< | 198 std::tr1::shared_ptr< |
199 ActionPipe<typename ActionTraits<SubClass>::OutputObjectType> > | 199 ActionPipe<typename ActionTraits<SubClass>::OutputObjectType> > |
200 out_pipe_; | 200 out_pipe_; |
201 }; | 201 }; |
202 | 202 |
203 }; // namespace chromeos_update_engine | 203 }; // namespace chromeos_update_engine |
204 | 204 |
205 #endif // CHROMEOS_PLATFORM_UPDATE_ENGINE_ACTION_H__ | 205 #endif // CHROMEOS_PLATFORM_UPDATE_ENGINE_ACTION_H__ |
OLD | NEW |