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
39namespace armarx
40{
41 // State for ObjectFactory only
42 struct IceGeneratedState : StateTemplate<IceGeneratedState>
43 {
44 };
45
46 class StateObjectFactory : public Ice::ValueFactory
47 {
48 public:
49 Ice::ObjectPtr
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:
60 Ice::ObjectPtr
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:
71 Ice::ObjectPtr
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:
82 Ice::ObjectPtr
83 create(const std::string& type) override
84 {
85 assert(type == armarx::StateParameterIceBase::ice_staticId());
87 }
88 };
89} // namespace armarx
90
92{
93 /**
94 * @class StatechartObjectFactories
95 * @brief
96 */
98 {
99 public:
101 getFactories() override
102 {
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
static FactoryCollectionBaseCleanUp addToPreregistration(FactoryCollectionBasePtr factoryCollection)
Ice::ObjectPtr create(const std::string &type) override
Ice::ObjectPtr create(const std::string &type) override
This Statetype is used to create a state instance that represents a state that is located in another ...
Definition RemoteState.h:67
Ice::ObjectPtr create(const std::string &type) override
Ice::ObjectPtr create(const std::string &type) override
static StateParameterPtr create()
static IceInternal::Handle< IceGeneratedState > createInstance(std::string stateName="")
const FactoryCollectionBaseCleanUp StatechartObjectFactoriesVar
This file offers overloads of toIce() and fromIce() functions for STL container types.
std::map< std::string, Ice::ValueFactoryPtr > ObjectFactoryMap
ParameterMappingPtr createMapping()
Returns a new and empty instance of ParameterMapping.