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 <mutex>
29
30#include "RemoteState.h"
31#include "State.h"
32
33namespace armarx
34{
35
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 */
50 struct RemoteStateWrapper : virtual State
51 {
52 RemoteStateIceBasePrx callerStatePrx;
54 std::mutex mutex;
55
56 RemoteStateWrapper(StatePtr const& realState, RemoteStateIceBasePrx const& callerStatePrx);
57
59 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} // namespace armarx
friend class RemoteStateWrapper
Definition State.h:522
This file offers overloads of toIce() and fromIce() functions for STL container types.
IceInternal::Handle< RemoteStateWrapper > RemoteStateWrapperPtr
IceInternal::Handle< State > StatePtr
Definition State.h:44
IceInternal::Handle< Event > EventPtr
Typedef of EventPtr as IceInternal::Handle<Event> for convenience.
Definition Event.h:40
IceInternal::Handle< StateBase > StateBasePtr
Definition StateBase.h:49
This class functions as a pseudo parent state.
RemoteStateWrapper(StatePtr const &realState, RemoteStateIceBasePrx const &callerStatePrx)
void __enqueueEvent(const EventPtr event) override
StateBasePtr clone() const override
Pure virtual function to clone of the derived class type.
unsigned int __getUnbreakableBufferSize() const override
bool __getUnbreakableBufferStati() const override
Before:Function to get the unbreakable-buffer status of all parent state - recursively.
StateBasePtr createEmptyCopy() const override
RemoteStateIceBasePrx callerStatePrx
void __processEvent(const EventPtr event, bool buffered=false) override
Main function to control the statemachine/state.
void __processBufferedEvents() override
Processes buffered events, that could not be processed immediately due to unbreakable substates.
void __finalize(const EventPtr event) override
Function that gets called, when a state enters a FinalSubstate. Virtual function, so that RemoteState...