state_machine_visited_states_queue.cpp
Go to the documentation of this file.
1 /*
2  * Software License Agreement (Apache License)
3  *
4  * Copyright (c) 2018 Plus One Robotics
5  *
6  * Licensed under the Apache License, Version 2.0 (the "License");
7  * you may not use this file except in compliance with the License.
8  * 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,
14  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15  * See the License for the specific language governing permissions and
16  * limitations under the License.
17  */
19 #include <functional>
20 
21 StateMachineVisitedStatesQueue::StateMachineVisitedStatesQueue(std::shared_ptr<packml_sm::AbstractStateMachine> sm)
22  : observer_(sm)
23 {
25  std::bind(&StateMachineVisitedStatesQueue::stateChanged, this, std::placeholders::_1));
26 }
27 
29 {
30  return visited_states_.size() == 0;
31 }
32 
34 {
35  visited_states_.empty();
36 }
37 
39 {
40  auto result = -1;
41  if (visited_states_.size() > 0)
42  {
43  result = visited_states_.front();
44  visited_states_.pop();
45  }
46 
47  return result;
48 }
49 
51 {
52  visited_states_.push(new_state);
53 }
StateMachineVisitedStatesQueue(std::shared_ptr< packml_sm::AbstractStateMachine > sm)
void setStateChangedCallback(std::function< void(int)> callback)


packml_sm
Author(s): Shaun Edwards
autogenerated on Fri Jul 12 2019 03:30:55