ClientState.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 ArmarXCore::StatechartExamples::RemoteAccessableStateExample::
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
#include <
ArmarXCore/core/Component.h
>
28
#include <
ArmarXCore/core/system/ImportExportComponent.h
>
29
//#include <interface/TestCenter/TestCenter.h>
30
31
#include <
ArmarXCore/statechart/Statechart.h
>
32
33
namespace
armarx
34
{
35
class
ARMARXCOMPONENT_IMPORT_EXPORT
ClientState
:
36
virtual
public
StatechartContext
37
{
38
public
:
39
40
// inherited from Component
41
std::string
getDefaultName
()
const override
42
{
43
return
"ClientState"
;
44
};
45
void
onInitStatechart()
override
;
46
void
onConnectStatechart()
override
;
47
48
49
50
};
51
52
//Event Definitions
53
DEFINEEVENT
(OuterTimer)
54
55
struct
StatechartClient
:
StateTemplate
<
StatechartClient
>
56
{
57
void
defineState
()
override
58
{
59
// setStateName("Client");
60
}
61
void
defineParameters
()
override
62
{
63
64
addToInput(
"x"
,
VariantType::Float
,
true
);
65
addToInput(
"y"
,
VariantType::Float
,
true
);
66
67
addToOutput(
"result"
,
VariantType::Float
,
false
);
68
}
69
70
void
defineSubstates
()
override
71
{
72
//add substates
73
StateBasePtr
remoteState = addRemoteState(
"add_x_to_y"
,
"RemoteAccessableStateOfferer"
);
74
setInitState(remoteState,
createMapping
()->mapFromParent(
"*"
,
"*"
));
75
StatePtr
finalSuccess = addState<SuccessState>(
"Success"
);
76
StatePtr
finalFailure = addState<FailureState>(
"Failure"
);
77
78
// add transitions
79
addTransition<OuterTimer>(getInitState(),
80
finalFailure);
81
addTransition<Success>(remoteState,
82
finalSuccess);
83
}
84
};
85
86
87
88
89
}
90
armarx::VariantType::Float
const VariantTypeId Float
Definition:
Variant.h:918
armarx::ClientState
Definition:
ClientState.h:35
armarx::StateTemplate
Definition:
State.h:39
armarx::createMapping
ParameterMappingPtr createMapping()
Returns a new and empty instance of ParameterMapping.
Definition:
ParameterMapping.cpp:235
Statechart.h
IceInternal::Handle< StateBase >
ARMARXCOMPONENT_IMPORT_EXPORT
#define ARMARXCOMPONENT_IMPORT_EXPORT
Definition:
ImportExportComponent.h:38
armarx::StatechartClient::defineParameters
void defineParameters() override
Definition:
ClientState.h:61
armarx::StatechartContext
This class contains a statechart and provides the interfaces to distributed components.
Definition:
StatechartContext.h:89
armarx::StatechartClient
Definition:
ClientState.h:55
Component.h
armarx::StatechartClient::defineState
void defineState() override
Definition:
ClientState.h:57
armarx::DEFINEEVENT
DEFINEEVENT(EvInit) struct StateRun
armarx::StatechartClient::defineSubstates
void defineSubstates() override
Definition:
ClientState.h:70
armarx
This file offers overloads of toIce() and fromIce() functions for STL container types.
Definition:
ArmarXTimeserver.cpp:28
armarx::ClientState::getDefaultName
std::string getDefaultName() const override
Retrieve default name of component.
Definition:
ClientState.h:41
ImportExportComponent.h
ArmarXCore
applications
StateChartExamples
RemoteAccessableStateExample
ClientState
ClientState.h
Generated on Sat Oct 12 2024 09:14:01 for armarx_documentation by
1.8.17