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>
32 //#include <ArmarXCore/statechart/RemoteStateOfferer.h>
35 
36 #include <typeinfo>
37 
38 namespace armarx
39 {
40  // State for ObjectFactory only
41  struct IceGeneratedState: StateTemplate<IceGeneratedState> {};
42 
43  class StateObjectFactory : public Ice::ValueFactory
44  {
45  public:
46  Ice::ObjectPtr create(const std::string& type) override
47  {
48  assert(type == armarx::StateIceBase::ice_staticId());
50  }
51  };
52 
53  class RemoteStateObjectFactory : public Ice::ValueFactory
54  {
55  public:
56  Ice::ObjectPtr create(const std::string& type) override
57  {
58  assert(type == armarx::RemoteStateIceBase::ice_staticId());
59  return new RemoteState();
60  }
61  };
62 
63  class ParameterMappingObjectFactory : public Ice::ValueFactory
64  {
65  public:
66  Ice::ObjectPtr create(const std::string& type) override
67  {
68  assert(type == armarx::ParameterMappingIceBase::ice_staticId());
69  return createMapping();
70  }
71  };
72 
73  class StateParameterObjectFactory : public Ice::ValueFactory
74  {
75  public:
76  Ice::ObjectPtr create(const std::string& type) override
77  {
78  assert(type == armarx::StateParameterIceBase::ice_staticId());
79  return StateParameter::create();
80  }
81  };
82 }
83 
85 {
86  /**
87  * @class StatechartObjectFactories
88  * @brief
89  */
91  {
92  public:
94  {
95  ObjectFactoryMap map;
96 
97  map.insert(std::make_pair(armarx::RemoteStateIceBase::ice_staticId(), new RemoteStateObjectFactory));
98  map.insert(std::make_pair(armarx::StateIceBase::ice_staticId(), new StateObjectFactory));
99  map.insert(std::make_pair(armarx::ParameterMappingIceBase::ice_staticId(), new ParameterMappingObjectFactory));
100  map.insert(std::make_pair(armarx::StateParameterIceBase::ice_staticId(), new StateParameterObjectFactory));
101 
102  return map;
103  }
104  };
106 }
armarx::ObjectFactories::StatechartObjectFactories
Definition: StatechartObjectFactories.h:90
armarx::RemoteStateObjectFactory::create
Ice::ObjectPtr create(const std::string &type) override
Definition: StatechartObjectFactories.h:56
armarx::IceGeneratedState
Definition: StatechartObjectFactories.h:41
armarx::StateTemplate
Definition: State.h:39
armarx::StateParameterObjectFactory::create
Ice::ObjectPtr create(const std::string &type) override
Definition: StatechartObjectFactories.h:76
armarx::ParameterMappingObjectFactory
Definition: StatechartObjectFactories.h:63
FactoryCollectionBase.h
armarx::ObjectFactoryMap
std::map< std::string, Ice::ValueFactoryPtr > ObjectFactoryMap
Definition: FactoryCollectionBase.h:61
armarx::createMapping
ParameterMappingPtr createMapping()
Returns a new and empty instance of ParameterMapping.
Definition: ParameterMapping.cpp:235
ParameterMapping.h
StateParameter.h
armarx::StateObjectFactory
Definition: StatechartObjectFactories.h:43
armarx::StateObjectFactory::create
Ice::ObjectPtr create(const std::string &type) override
Definition: StatechartObjectFactories.h:46
armarx::FactoryCollectionBase::addToPreregistration
static FactoryCollectionBaseCleanUp addToPreregistration(FactoryCollectionBasePtr factoryCollection)
Definition: FactoryCollectionBase.cpp:41
armarx::FactoryCollectionBase
Definition: FactoryCollectionBase.h:63
armarx::StateParameterObjectFactory
Definition: StatechartObjectFactories.h:73
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:66
armarx::ObjectFactories::StatechartObjectFactoriesVar
const FactoryCollectionBaseCleanUp StatechartObjectFactoriesVar
Definition: StatechartObjectFactories.h:105
StateTemplate.h
armarx::RemoteStateObjectFactory
Definition: StatechartObjectFactories.h:53
armarx::ObjectFactories::StatechartObjectFactories::getFactories
ObjectFactoryMap getFactories() override
Definition: StatechartObjectFactories.h:93
StateBase.h
armarx::StateParameter::create
static StateParameterPtr create()
Definition: StateParameter.cpp:58
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:95
armarx::FactoryCollectionBaseCleanUp
Definition: FactoryCollectionBase.h:38
armarx
This file offers overloads of toIce() and fromIce() functions for STL container types.
Definition: ArmarXTimeserver.cpp:28