Oac.cpp
Go to the documentation of this file.
1/*
2* This file is part of ArmarX.
3*
4* ArmarX is free software; you can redistribute it and/or modify
5* it under the terms of the GNU General Public License version 2 as
6* published by the Free Software Foundation.
7*
8* ArmarX is distributed in the hope that it will be useful, but
9* WITHOUT ANY WARRANTY; without even the implied warranty of
10* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11* GNU General Public License for more details.
12*
13* You should have received a copy of the GNU General Public License
14* along with this program. If not, see <http://www.gnu.org/licenses/>.
15*
16* @package MemoryX::Core
17* @author Nils Adermann <naderman@naderman.de>
18* @date 2012
19* @copyright http://www.gnu.org/licenses/gpl-2.0.txt
20* GNU General Public License
21*/
22
23#include "Oac.h"
24
25#include "OacParameterList.h"
28
29namespace memoryx
30{
31 Oac::Oac(const std::string& name,
32 const std::string& id,
33 const std::string& statechartProxyName,
34 const std::string& stateUUID,
35 bool isPlannable) :
36 Entity()
37 {
38 setName(name);
39 setId(id);
41
42 setParameters(std::vector<std::string>());
43 setStatechartProxyName(statechartProxyName);
44 setStateUUID(stateUUID);
45 setPredictionFunction(OacPredictionFunctionBasePtr(new OacPredictionFunction));
46 setStatisticalMeasure(OacStatisticalMeasureBasePtr(new OacStatisticalMeasure));
47 }
48
49 std::vector<std::string>
50 Oac::getParameters(const ::Ice::Current&) const
51 {
52 return OacParameterListPtr::dynamicCast(
53 getAttributeValue("parameters")->getClass<OacParameterListBase>())
54 ->getNames();
55 }
56
57 void
58 Oac::setParameters(const std::vector<std::string>& parameters, const ::Ice::Current&)
59 {
61 paramObj->setNames(parameters);
62 putAttribute("parameters", paramObj);
63 }
64
65 std::string
66 Oac::getStatechartProxyName(const Ice::Current&) const
67 {
68 return getAttributeValue("statechartProxyName")->getString();
69 }
70
71 void
72 Oac::setStatechartProxyName(const std::string& statechartProxyName, const Ice::Current&)
73 {
74 putAttribute("statechartProxyName", statechartProxyName);
75 }
76
77 std::string
78 Oac::getStateUUID(const Ice::Current&) const
79 {
80 return getAttributeValue("stateUUID")->getString();
81 }
82
83 void
84 Oac::setStateUUID(const std::string& stateUUID, const Ice::Current&)
85 {
86 putAttribute("stateUUID", stateUUID);
87 }
88
89 bool
90 Oac::isPlannable(const ::Ice::Current&) const
91 {
92 return getAttributeValue("plannable")->getBool();
93 }
94
95 void
96 Oac::setPlannable(bool isPlannable, const ::Ice::Current&)
97 {
98 putAttribute("plannable", isPlannable);
99 }
100
101 OacPredictionFunctionBasePtr
102 Oac::getPredictionFunction(const ::Ice::Current&) const
103 {
104 return OacPredictionFunctionBasePtr::dynamicCast(
105 getAttributeValue("prediction")->getClass<OacPredictionFunctionBase>());
106 }
107
108 void
109 Oac::setPredictionFunction(const ::memoryx::OacPredictionFunctionBasePtr& prediction,
110 const ::Ice::Current&)
111 {
112 putAttribute("prediction", prediction);
113 }
114
115 OacStatisticalMeasureBasePtr
116 Oac::getStatisticalMeasure(const ::Ice::Current&) const
117 {
118 return OacStatisticalMeasureBasePtr::dynamicCast(
119 getAttributeValue("measure")->getClass<OacStatisticalMeasureBase>());
120 }
121
122 void
123 Oac::setStatisticalMeasure(const ::memoryx::OacStatisticalMeasureBasePtr& measure,
124 const ::Ice::Current&)
125 {
126 putAttribute("measure", measure);
127 }
128
129 Ice::ObjectPtr
131 {
132 return this->clone();
133 }
134
135 OacPtr
136 Oac::clone(const Ice::Current& c) const
137 {
138 OacPtr ret = new Oac(*this);
139 // ret->deepCopy(*this);
140 return ret;
141 }
142} // namespace memoryx
constexpr T c
void setId(const ::std::string &id, const ::Ice::Current &=Ice::emptyCurrent) override
Set id of this entity.
Definition Entity.cpp:174
void setName(const ::std::string &name, const ::Ice::Current &=Ice::emptyCurrent) override
Set name of this entity.
Definition Entity.cpp:188
Entity(const Entity &source)
Definition Entity.cpp:34
virtual armarx::VariantPtr getAttributeValue(const ::std::string &attrName) const
Retrieve value of an attribute from entity.
Definition Entity.cpp:327
void putAttribute(const ::memoryx::EntityAttributeBasePtr &attr, const ::Ice::Current &=Ice::emptyCurrent) override
Store attribute in entity.
Definition Entity.cpp:347
OacStatisticalMeasureBasePtr getStatisticalMeasure(const ::Ice::Current &=Ice::emptyCurrent) const override
Definition Oac.cpp:116
OacPredictionFunctionBasePtr getPredictionFunction(const ::Ice::Current &=Ice::emptyCurrent) const override
Definition Oac.cpp:102
void setPredictionFunction(const ::memoryx::OacPredictionFunctionBasePtr &prediction, const ::Ice::Current &=Ice::emptyCurrent) override
Definition Oac.cpp:109
void setStatisticalMeasure(const ::memoryx::OacStatisticalMeasureBasePtr &measure, const ::Ice::Current &=Ice::emptyCurrent) override
Definition Oac.cpp:123
void setStateUUID(const std::string &stateUUID, const ::Ice::Current &=Ice::emptyCurrent) override
Definition Oac.cpp:84
void setParameters(const std::vector< std::string > &parameters, const ::Ice::Current &=Ice::emptyCurrent) override
Definition Oac.cpp:58
bool isPlannable(const ::Ice::Current &=Ice::emptyCurrent) const override
Definition Oac.cpp:90
Oac(const std::string &name=std::string(), const std::string &id="", const std::string &statechartProxyName="", const std::string &stateUUID="", bool isPlannable=true)
Constructs a new Oac entity.
Definition Oac.cpp:31
void setStatechartProxyName(const std::string &statechartProxyName, const ::Ice::Current &=Ice::emptyCurrent) override
Definition Oac.cpp:72
OacPtr clone(const Ice::Current &c=Ice::emptyCurrent) const
Definition Oac.cpp:136
std::vector< std::string > getParameters(const ::Ice::Current &=Ice::emptyCurrent) const override
Definition Oac.cpp:50
Ice::ObjectPtr ice_clone() const override
Definition Oac.cpp:130
std::string getStatechartProxyName(const ::Ice::Current &=Ice::emptyCurrent) const override
Definition Oac.cpp:66
std::string getStateUUID(const ::Ice::Current &=Ice::emptyCurrent) const override
Definition Oac.cpp:78
void setPlannable(bool isPlannable, const ::Ice::Current &=Ice::emptyCurrent) override
Definition Oac.cpp:96
VirtualRobot headers.
IceInternal::Handle< Oac > OacPtr
Definition Oac.h:39
IceInternal::Handle< OacParameterList > OacParameterListPtr