RemoteStateWrapper.h
Go to the documentation of this file.
1 /*
2 * This file is part of ArmarX.
3 *
4 * Copyright (C) 2011-2016, High Performance Humanoid Technologies (H2T), Karlsruhe Institute of Technology (KIT), all rights reserved.
5 *
6 * ArmarX is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License version 2 as
8 * published by the Free Software Foundation.
9 *
10 * ArmarX is distributed in the hope that it will be useful, but
11 * WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with this program. If not, see <http://www.gnu.org/licenses/>.
17 *
18 * @package ArmarX::
19 * @author Mirko Waechter ( mirko.waechter at kit dot edu)
20 * @date 2012
21 * @copyright http://www.gnu.org/licenses/gpl-2.0.txt
22 * GNU General Public License
23 */
24 
25 #pragma once
26 
27 
28 #include "State.h"
29 #include "RemoteState.h"
30 
31 #include <mutex>
32 
33 namespace armarx
34 {
35 
36  class RemoteStateWrapper;
38 
39  /**
40  \class RemoteStateWrapper
41  \ingroup StatechartGrp
42  This class functions as a pseudo parent state. Every instance of a
43  remoteaccessable state has an instance of this class as parent.
44  It overrides all the functions that a normal state can call on his
45  parent state and forwards the call over Ice to the "real" parent
46  state.
47 
48  @see RemoteState, DynamicRemoteState, RemoteStateOfferer
49  */
51  : virtual State
52  {
53  RemoteStateIceBasePrx callerStatePrx;
55  std::mutex mutex;
56 
57  RemoteStateWrapper(StatePtr const& realState, RemoteStateIceBasePrx const& callerStatePrx);
58 
59  RemoteStateWrapper(StatePtr const& realState, RemoteStateIceBasePrx const& callerStatePrx,
60  StateIceBasePtr const& remoteParentStateLayout);
61 
63  ~RemoteStateWrapper() override;
64  // inherited from StateBase
65  void __processBufferedEvents() override;
66  void __processEvent(const EventPtr event, bool buffered = false) override;
67  void __enqueueEvent(const EventPtr event) override;
68  unsigned int __getUnbreakableBufferSize() const override;
69  bool __getUnbreakableBufferStati() const override;
70  void __finalize(const EventPtr event) override;
71  StateBasePtr clone() const override;
72  StateBasePtr createEmptyCopy() const override;
73  };
74 }
75 
armarx::RemoteStateWrapper::clone
StateBasePtr clone() const override
Pure virtual function to clone of the derived class type.
Definition: RemoteStateWrapper.cpp:183
armarx::RemoteStateWrapper
Definition: RemoteStateWrapper.h:50
armarx::RemoteStateWrapper::__getUnbreakableBufferSize
unsigned int __getUnbreakableBufferSize() const override
Definition: RemoteStateWrapper.cpp:146
armarx::RemoteStateWrapper::__processBufferedEvents
void __processBufferedEvents() override
Processes buffered events, that could not be processed immediately due to unbreakable substates.
Definition: RemoteStateWrapper.cpp:109
IceInternal::Handle< RemoteStateWrapper >
armarx::RemoteStateWrapper::callerStatePrx
RemoteStateIceBasePrx callerStatePrx
Definition: RemoteStateWrapper.h:53
armarx::RemoteStateWrapper::mutex
std::mutex mutex
Definition: RemoteStateWrapper.h:55
State.h
armarx::RemoteStateWrapper::~RemoteStateWrapper
~RemoteStateWrapper() override
Definition: RemoteStateWrapper.cpp:103
RemoteState.h
armarx::RemoteStateWrapper::__getUnbreakableBufferStati
bool __getUnbreakableBufferStati() const override
Before:Function to get the unbreakable-buffer status of all parent state - recursively.
Definition: RemoteStateWrapper.cpp:159
boost::source
Vertex source(const detail::edge_base< Directed, Vertex > &e, const PCG &)
Definition: point_cloud_graph.h:681
armarx::State
Definition: State.h:54
armarx::RemoteStateWrapper::__processEvent
void __processEvent(const EventPtr event, bool buffered=false) override
Main function to control the statemachine/state.
Definition: RemoteStateWrapper.cpp:122
armarx::RemoteStateWrapper::realState
StatePtr realState
Definition: RemoteStateWrapper.h:54
armarx::RemoteStateWrapper::__finalize
void __finalize(const EventPtr event) override
Function that gets called, when a state enters a FinalSubstate. Virtual function, so that RemoteState...
Definition: RemoteStateWrapper.cpp:172
armarx::RemoteStateWrapper::createEmptyCopy
StateBasePtr createEmptyCopy() const override
Definition: RemoteStateWrapper.cpp:189
armarx
This file offers overloads of toIce() and fromIce() functions for STL container types.
Definition: ArmarXTimeserver.cpp:28
armarx::RemoteStateWrapper::__enqueueEvent
void __enqueueEvent(const EventPtr event) override
Definition: RemoteStateWrapper.cpp:136
armarx::RemoteStateWrapper::RemoteStateWrapper
RemoteStateWrapper(StatePtr const &realState, RemoteStateIceBasePrx const &callerStatePrx)
Definition: RemoteStateWrapper.cpp:33