NASA Astrobee Robot Software  0.19.1
Flight software for the Astrobee robots operating inside the International Space Station.
op_state_repo.h
Go to the documentation of this file.
1 /* Copyright (c) 2017, United States Government, as represented by the
2  * Administrator of the National Aeronautics and Space Administration.
3  *
4  * All rights reserved.
5  *
6  * The Astrobee platform is licensed under the Apache License, Version 2.0
7  * (the "License"); you may not use this file except in compliance with the
8  * License. You may obtain a copy of the License at
9  *
10  * http://www.apache.org/licenses/LICENSE-2.0
11  *
12  * Unless required by applicable law or agreed to in writing, software
13  * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
14  * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
15  * License for the specific language governing permissions and limitations
16  * under the License.
17  */
18 
19 #ifndef EXECUTIVE_OP_STATE_REPO_H_
20 #define EXECUTIVE_OP_STATE_REPO_H_
21 
22 #include <ros/ros.h>
23 
24 #include "executive/op_state.h"
30 
31 #include "ff_msgs/OpState.h"
32 
33 namespace executive {
42 typedef std::unique_ptr<OpStateRepo> OpStateRepoPtr;
43 class OpStateRepo {
44  public:
45  static OpStateRepo* Instance() {return instance_.get();}
46 
47  void SetExec(Executive *const exec);
48 
49  // get state ptrs
50  OpState* ready() {return ready_.get();}
51  OpState* plan_exec() {return plan_exec_.get();}
52  OpState* teleop() {return teleop_.get();}
53  OpState* auto_return() {return auto_return_.get();}
54  OpState* fault() {return fault_.get();}
55 
56  private:
57  OpStateRepo();
58  static OpStateRepoPtr instance_;
59  // all avail states
60  OpStatePtr ready_, plan_exec_, teleop_, auto_return_, fault_;
61 
62  OpStateRepo (const OpStateRepo&) = delete;
63  OpStateRepo& operator= (const OpStateRepo&) = delete;
64 };
65 } // namespace executive
66 #endif // EXECUTIVE_OP_STATE_REPO_H_
executive::OpStatePtr
std::unique_ptr< OpState > OpStatePtr
Definition: op_state.h:98
op_state_ready.h
op_state_auto_return.h
executive::OpStateRepo
Definition: op_state_repo.h:43
op_state_fault.h
executive::OpStateRepo::Instance
static OpStateRepo * Instance()
Definition: op_state_repo.h:45
executive::OpStateRepo::plan_exec
OpState * plan_exec()
Definition: op_state_repo.h:51
executive::OpStateRepoPtr
std::unique_ptr< OpStateRepo > OpStateRepoPtr
Definition: op_state_repo.h:42
executive::OpStateRepo::auto_return
OpState * auto_return()
Definition: op_state_repo.h:53
executive::OpStateRepo::SetExec
void SetExec(Executive *const exec)
Definition: op_state_repo.cc:25
op_state_teleop.h
executive::OpStateRepo::teleop
OpState * teleop()
Definition: op_state_repo.h:52
op_state_plan_exec.h
op_state.h
executive::Executive
Definition: executive.h:100
executive::OpStateRepo::ready
OpState * ready()
Definition: op_state_repo.h:50
executive
Definition: executive.h:87
executive::OpStateRepo::fault
OpState * fault()
Definition: op_state_repo.h:54
executive::OpState
Definition: op_state.h:45