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 #include "OacParameterList.h"
25 #include "OacPredictionFunction.h"
26 #include "OacStatisticalMeasure.h"
27 
28 namespace memoryx
29 {
30  Oac::Oac(const std::string& name, const std::string& id, const std::string& statechartProxyName, const std::string& stateUUID, bool isPlannable) :
31  Entity()
32  {
33  setName(name);
34  setId(id);
36 
37  setParameters(std::vector<std::string>());
38  setStatechartProxyName(statechartProxyName);
39  setStateUUID(stateUUID);
40  setPredictionFunction(OacPredictionFunctionBasePtr(new OacPredictionFunction));
41  setStatisticalMeasure(OacStatisticalMeasureBasePtr(new OacStatisticalMeasure));
42  }
43 
44  std::vector<std::string> Oac::getParameters(const ::Ice::Current&) const
45  {
46  return OacParameterListPtr::dynamicCast(
47  getAttributeValue("parameters")->getClass<OacParameterListBase>()
48  )->getNames();
49  }
50 
51  void Oac::setParameters(const std::vector<std::string>& parameters, const ::Ice::Current&)
52  {
53  OacParameterListPtr paramObj = new OacParameterList();
54  paramObj->setNames(parameters);
55  putAttribute("parameters", paramObj);
56  }
57 
58  std::string Oac::getStatechartProxyName(const Ice::Current&) const
59  {
60  return getAttributeValue("statechartProxyName")->getString();
61  }
62 
63  void Oac::setStatechartProxyName(const std::string& statechartProxyName, const Ice::Current&)
64  {
65  putAttribute("statechartProxyName", statechartProxyName);
66  }
67 
68  std::string Oac::getStateUUID(const Ice::Current&) const
69  {
70  return getAttributeValue("stateUUID")->getString();
71  }
72 
73  void Oac::setStateUUID(const std::string& stateUUID, const Ice::Current&)
74  {
75  putAttribute("stateUUID", stateUUID);
76  }
77 
78  bool Oac::isPlannable(const ::Ice::Current&) const
79  {
80  return getAttributeValue("plannable")->getBool();
81  }
82 
83  void Oac::setPlannable(bool isPlannable, const ::Ice::Current&)
84  {
85  putAttribute("plannable", isPlannable);
86  }
87 
88  OacPredictionFunctionBasePtr Oac::getPredictionFunction(const ::Ice::Current&) const
89  {
90  return OacPredictionFunctionBasePtr::dynamicCast(
91  getAttributeValue("prediction")->getClass<OacPredictionFunctionBase>()
92  );
93  }
94 
95  void Oac::setPredictionFunction(const ::memoryx::OacPredictionFunctionBasePtr& prediction, const ::Ice::Current&)
96  {
97  putAttribute("prediction", prediction);
98  }
99 
100  OacStatisticalMeasureBasePtr Oac::getStatisticalMeasure(const ::Ice::Current&) const
101  {
102  return OacStatisticalMeasureBasePtr::dynamicCast(
103  getAttributeValue("measure")->getClass<OacStatisticalMeasureBase>()
104  );
105  }
106 
107  void Oac::setStatisticalMeasure(const ::memoryx::OacStatisticalMeasureBasePtr& measure, const ::Ice::Current&)
108  {
109  putAttribute("measure", measure);
110  }
111 
113  {
114  return this->clone();
115  }
116 
117  OacPtr Oac::clone(const Ice::Current& c) const
118  {
119  OacPtr ret = new Oac(*this);
120  // ret->deepCopy(*this);
121  return ret;
122 
123  }
124 }
armarx::aron::ret
ReaderT::InputType T & ret
Definition: rw.h:21
memoryx::Entity::putAttribute
void putAttribute(const ::memoryx::EntityAttributeBasePtr &attr, const ::Ice::Current &=Ice::emptyCurrent) override
Store attribute in entity.
Definition: Entity.cpp:327
OacPredictionFunction.h
memoryx::OacStatisticalMeasure
Definition: OacStatisticalMeasure.h:39
Oac.h
OacStatisticalMeasure.h
memoryx::Oac::getStateUUID
std::string getStateUUID(const ::Ice::Current &=Ice::emptyCurrent) const override
Definition: Oac.cpp:68
memoryx::Oac::isPlannable
bool isPlannable(const ::Ice::Current &=Ice::emptyCurrent) const override
Definition: Oac.cpp:78
memoryx
VirtualRobot headers.
Definition: CommonPlacesTester.cpp:48
c
constexpr T c
Definition: UnscentedKalmanFilterTest.cpp:43
memoryx::Oac::getParameters
std::vector< std::string > getParameters(const ::Ice::Current &=Ice::emptyCurrent) const override
Definition: Oac.cpp:44
memoryx::Oac::setStateUUID
void setStateUUID(const std::string &stateUUID, const ::Ice::Current &=Ice::emptyCurrent) override
Definition: Oac.cpp:73
memoryx::Entity::getAttributeValue
virtual armarx::VariantPtr getAttributeValue(const ::std::string &attrName) const
Retrieve value of an attribute from entity.
Definition: Entity.cpp:308
IceInternal::Handle
Definition: forward_declarations.h:8
memoryx::Oac::Oac
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:30
memoryx::Oac::clone
OacPtr clone(const Ice::Current &c=Ice::emptyCurrent) const
Definition: Oac.cpp:117
memoryx::Oac::getStatisticalMeasure
OacStatisticalMeasureBasePtr getStatisticalMeasure(const ::Ice::Current &=Ice::emptyCurrent) const override
Definition: Oac.cpp:100
memoryx::Entity::setId
void setId(const ::std::string &id, const ::Ice::Current &=Ice::emptyCurrent) override
Set id of this entity.
Definition: Entity.cpp:167
OacParameterList.h
memoryx::Oac::setPlannable
void setPlannable(bool isPlannable, const ::Ice::Current &=Ice::emptyCurrent) override
Definition: Oac.cpp:83
memoryx::Oac::ice_clone
Ice::ObjectPtr ice_clone() const override
Definition: Oac.cpp:112
memoryx::OacPredictionFunction
Definition: OacPredictionFunction.h:39
memoryx::Oac::setStatechartProxyName
void setStatechartProxyName(const std::string &statechartProxyName, const ::Ice::Current &=Ice::emptyCurrent) override
Definition: Oac.cpp:63
memoryx::Oac::setPredictionFunction
void setPredictionFunction(const ::memoryx::OacPredictionFunctionBasePtr &prediction, const ::Ice::Current &=Ice::emptyCurrent) override
Definition: Oac.cpp:95
armarx::aron::type::ObjectPtr
std::shared_ptr< Object > ObjectPtr
Definition: Object.h:36
memoryx::Oac::setStatisticalMeasure
void setStatisticalMeasure(const ::memoryx::OacStatisticalMeasureBasePtr &measure, const ::Ice::Current &=Ice::emptyCurrent) override
Definition: Oac.cpp:107
memoryx::OacParameterList
Definition: OacParameterList.h:39
memoryx::Entity
Definition: Entity.h:246
memoryx::Oac::getPredictionFunction
OacPredictionFunctionBasePtr getPredictionFunction(const ::Ice::Current &=Ice::emptyCurrent) const override
Definition: Oac.cpp:88
memoryx::Entity::setName
void setName(const ::std::string &name, const ::Ice::Current &=Ice::emptyCurrent) override
Set name of this entity.
Definition: Entity.cpp:179
memoryx::Oac::setParameters
void setParameters(const std::vector< std::string > &parameters, const ::Ice::Current &=Ice::emptyCurrent) override
Definition: Oac.cpp:51
memoryx::Oac::getStatechartProxyName
std::string getStatechartProxyName(const ::Ice::Current &=Ice::emptyCurrent) const override
Definition: Oac.cpp:58