Apache Mesos
process_reference.hpp
Go to the documentation of this file.
1 // Licensed under the Apache License, Version 2.0 (the "License");
2 // you may not use this file except in compliance with the License.
3 // You may obtain a copy of the License at
4 //
5 // http://www.apache.org/licenses/LICENSE-2.0
6 //
7 // Unless required by applicable law or agreed to in writing, software
8 // distributed under the License is distributed on an "AS IS" BASIS,
9 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
10 // See the License for the specific language governing permissions and
11 // limitations under the License
12 
13 #ifndef __PROCESS_REFERENCE_HPP__
14 #define __PROCESS_REFERENCE_HPP__
15 
16 #include <process/process.hpp>
17 
18 namespace process {
19 
21 {
22 public:
23  ProcessReference() = default;
24 
25  ProcessReference(std::shared_ptr<ProcessBase*>&& reference)
26  : reference(std::move(reference)) {}
27 
28  ProcessReference(const std::shared_ptr<ProcessBase*>& reference)
29  : reference(reference) {}
30 
32  {
33  CHECK(reference);
34  return *reference;
35  }
36 
37  operator ProcessBase*() const
38  {
39  CHECK(reference);
40  return *reference;
41  }
42 
43  operator bool() const
44  {
45  return (bool) reference;
46  }
47 
48  std::shared_ptr<ProcessBase*> reference;
49 };
50 
51 } // namespace process {
52 
53 #endif // __PROCESS_REFERENCE_HPP__
ProcessBase * operator->() const
Definition: process_reference.hpp:31
ProcessReference(std::shared_ptr< ProcessBase * > &&reference)
Definition: process_reference.hpp:25
Definition: type_utils.hpp:619
Definition: process.hpp:72
Definition: process_reference.hpp:20
std::shared_ptr< ProcessBase * > reference
Definition: process_reference.hpp:48
Definition: executor.hpp:48
ProcessReference(const std::shared_ptr< ProcessBase * > &reference)
Definition: process_reference.hpp:28