StatechartObjectFactories.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::Core
19 * @author Kai Welke (welke _at_ kit _dot_ edu)
20 * @date 2012 Kai Welke
21 * @copyright http://www.gnu.org/licenses/gpl-2.0.txt
22 * GNU General Public License
23 */
24 
25 #pragma once
26 
27 #include <Ice/ValueFactory.h>
28 
33 //#include <ArmarXCore/statechart/RemoteStateOfferer.h>
34 #include <typeinfo>
35 
38 
39 namespace armarx
40 {
41  // State for ObjectFactory only
42  struct IceGeneratedState : StateTemplate<IceGeneratedState>
43  {
44  };
45 
46  class StateObjectFactory : public Ice::ValueFactory
47  {
48  public:
50  create(const std::string& type) override
51  {
52  assert(type == armarx::StateIceBase::ice_staticId());
54  }
55  };
56 
57  class RemoteStateObjectFactory : public Ice::ValueFactory
58  {
59  public:
61  create(const std::string& type) override
62  {
63  assert(type == armarx::RemoteStateIceBase::ice_staticId());
64  return new RemoteState();
65  }
66  };
67 
68  class ParameterMappingObjectFactory : public Ice::ValueFactory
69  {
70  public:
72  create(const std::string& type) override
73  {
74  assert(type == armarx::ParameterMappingIceBase::ice_staticId());
75  return createMapping();
76  }
77  };
78 
79  class StateParameterObjectFactory : public Ice::ValueFactory
80  {
81  public:
83  create(const std::string& type) override
84  {
85  assert(type == armarx::StateParameterIceBase::ice_staticId());
86  return StateParameter::create();
87  }
88  };
89 } // namespace armarx
90 
92 {
93  /**
94  * @class StatechartObjectFactories
95  * @brief
96  */
98  {
99  public:
101  getFactories() override
102  {
103  ObjectFactoryMap map;
104 
105  map.insert(std::make_pair(armarx::RemoteStateIceBase::ice_staticId(),
107  map.insert(
108  std::make_pair(armarx::StateIceBase::ice_staticId(), new StateObjectFactory));
109  map.insert(std::make_pair(armarx::ParameterMappingIceBase::ice_staticId(),
111  map.insert(std::make_pair(armarx::StateParameterIceBase::ice_staticId(),
113 
114  return map;
115  }
116  };
117 
120 } // namespace armarx::ObjectFactories
armarx::ObjectFactories::StatechartObjectFactories
Definition: StatechartObjectFactories.h:97
armarx::RemoteStateObjectFactory::create
Ice::ObjectPtr create(const std::string &type) override
Definition: StatechartObjectFactories.h:61
armarx::IceGeneratedState
Definition: StatechartObjectFactories.h:42
armarx::StateTemplate
Definition: State.h:38
armarx::StateParameterObjectFactory::create
Ice::ObjectPtr create(const std::string &type) override
Definition: StatechartObjectFactories.h:83
armarx::ParameterMappingObjectFactory
Definition: StatechartObjectFactories.h:68
FactoryCollectionBase.h
armarx::ObjectFactoryMap
std::map< std::string, Ice::ValueFactoryPtr > ObjectFactoryMap
Definition: FactoryCollectionBase.h:62
armarx::createMapping
ParameterMappingPtr createMapping()
Returns a new and empty instance of ParameterMapping.
Definition: ParameterMapping.cpp:251
ParameterMapping.h
StateParameter.h
armarx::StateObjectFactory
Definition: StatechartObjectFactories.h:46
armarx::StateObjectFactory::create
Ice::ObjectPtr create(const std::string &type) override
Definition: StatechartObjectFactories.h:50
armarx::FactoryCollectionBase::addToPreregistration
static FactoryCollectionBaseCleanUp addToPreregistration(FactoryCollectionBasePtr factoryCollection)
Definition: FactoryCollectionBase.cpp:43
armarx::FactoryCollectionBase
Definition: FactoryCollectionBase.h:64
armarx::StateParameterObjectFactory
Definition: StatechartObjectFactories.h:79
RemoteState.h
armarx::RemoteState
This Statetype is used to create a state instance that represents a state that is located in another ...
Definition: RemoteState.h:62
armarx::ParameterMappingObjectFactory::create
Ice::ObjectPtr create(const std::string &type) override
Definition: StatechartObjectFactories.h:72
armarx::ObjectFactories::StatechartObjectFactoriesVar
const FactoryCollectionBaseCleanUp StatechartObjectFactoriesVar
Definition: StatechartObjectFactories.h:118
StateTemplate.h
armarx::RemoteStateObjectFactory
Definition: StatechartObjectFactories.h:57
armarx::ObjectFactories::StatechartObjectFactories::getFactories
ObjectFactoryMap getFactories() override
Definition: StatechartObjectFactories.h:101
StateBase.h
armarx::StateParameter::create
static StateParameterPtr create()
Definition: StateParameter.cpp:59
armarx::ObjectFactories
Definition: CoreObjectFactories.h:54
armarx::aron::type::ObjectPtr
std::shared_ptr< Object > ObjectPtr
Definition: Object.h:36
armarx::StateTemplate< IceGeneratedState >::createInstance
static IceInternal::Handle< StateType > createInstance(std::string stateName="")
Creates a new state instance of the type of the template parameter.
Definition: StateTemplate.h:98
armarx::FactoryCollectionBaseCleanUp
Definition: FactoryCollectionBase.h:39
armarx
This file offers overloads of toIce() and fromIce() functions for STL container types.
Definition: ArmarXTimeserver.cpp:27