RemoteAccessableState.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 20122012
21 * @copyright http://www.gnu.org/licenses/gpl-2.0.txt
22 * GNU General Public License
23 */
24 
25 #pragma once
26 
27 
30 
31 namespace armarx
32 {
34  virtual public RemoteStateOfferer<StatechartContext>
35  {
36  public:
37  // inherited from Component
38  std::string getStateOffererName() const override
39  {
40  return "RemoteAccessable";
41  }
42  // inherited from RemoteStateOfferer
43  void onInitRemoteStateOfferer() override;
44  };
45 
46  struct Stateadd_x_to_y : StateTemplate<Stateadd_x_to_y>
47  {
48  void defineParameters() override
49  {
50  addToInput("x", VariantType::Float, false);
51  addToInput("y", VariantType::Float, false);
52 
53  addToOutput("result", VariantType::Float, false);
54  }
55 
56  void defineSubstates() override
57  {
58  setInitState(addState<State>("DummySubstate1"));
59  addState<State>("DummySubstate2");
60 
61  }
62 
63  void onEnter() override
64  {
65  float result = getInput<float>("x") +
66  getInput<float>("y");
67  setOutput("result", result);
68  ARMARX_INFO << "result: " << result << std::endl;
69  sendEvent<Success>();
70  }
71 
72 
73  };
74 
75 
76 }
77 
armarx::Stateadd_x_to_y::onEnter
void onEnter() override
Definition: RemoteAccessableState.h:63
armarx::VariantType::Float
const VariantTypeId Float
Definition: Variant.h:918
armarx::StateTemplate
Definition: State.h:39
Statechart.h
armarx::RemoteStateOfferer
Class that holds states, which offer functionality for other states over Ice.
Definition: RemoteStateOfferer.h:182
ARMARXCOMPONENT_IMPORT_EXPORT
#define ARMARXCOMPONENT_IMPORT_EXPORT
Definition: ImportExportComponent.h:38
armarx::RemoteAccessableState::getStateOffererName
std::string getStateOffererName() const override
Implement this function to specify the RemoteStateOfferer prefix.
Definition: RemoteAccessableState.h:38
armarx::Stateadd_x_to_y
Definition: RemoteAccessableState.h:46
armarx::Stateadd_x_to_y::defineParameters
void defineParameters() override
Definition: RemoteAccessableState.h:48
armarx::Stateadd_x_to_y::defineSubstates
void defineSubstates() override
Definition: RemoteAccessableState.h:56
armarx::RemoteAccessableState
Definition: RemoteAccessableState.h:33
ARMARX_INFO
#define ARMARX_INFO
Definition: Logging.h:174
armarx
This file offers overloads of toIce() and fromIce() functions for STL container types.
Definition: ArmarXTimeserver.cpp:28
ImportExportComponent.h