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"
26 #include "OacPredictionFunction.h"
27 #include "OacStatisticalMeasure.h"
28 
29 namespace 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  {
60  OacParameterListPtr paramObj = new OacParameterList();
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 
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
armarx::aron::ret
ReaderT::InputType T & ret
Definition: rw.h:13
memoryx::Entity::putAttribute
void putAttribute(const ::memoryx::EntityAttributeBasePtr &attr, const ::Ice::Current &=Ice::emptyCurrent) override
Store attribute in entity.
Definition: Entity.cpp:347
OacPredictionFunction.h
memoryx::OacStatisticalMeasure
Definition: OacStatisticalMeasure.h:40
Oac.h
OacStatisticalMeasure.h
memoryx::Oac::getStateUUID
std::string getStateUUID(const ::Ice::Current &=Ice::emptyCurrent) const override
Definition: Oac.cpp:78
memoryx::Oac::isPlannable
bool isPlannable(const ::Ice::Current &=Ice::emptyCurrent) const override
Definition: Oac.cpp:90
memoryx
VirtualRobot headers.
Definition: CommonPlacesTester.cpp:48
c
constexpr T c
Definition: UnscentedKalmanFilterTest.cpp:46
memoryx::Oac::getParameters
std::vector< std::string > getParameters(const ::Ice::Current &=Ice::emptyCurrent) const override
Definition: Oac.cpp:50
memoryx::Oac::setStateUUID
void setStateUUID(const std::string &stateUUID, const ::Ice::Current &=Ice::emptyCurrent) override
Definition: Oac.cpp:84
memoryx::Entity::getAttributeValue
virtual armarx::VariantPtr getAttributeValue(const ::std::string &attrName) const
Retrieve value of an attribute from entity.
Definition: Entity.cpp:327
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:31
memoryx::Oac::clone
OacPtr clone(const Ice::Current &c=Ice::emptyCurrent) const
Definition: Oac.cpp:136
memoryx::Oac::getStatisticalMeasure
OacStatisticalMeasureBasePtr getStatisticalMeasure(const ::Ice::Current &=Ice::emptyCurrent) const override
Definition: Oac.cpp:116
memoryx::Entity::setId
void setId(const ::std::string &id, const ::Ice::Current &=Ice::emptyCurrent) override
Set id of this entity.
Definition: Entity.cpp:174
OacParameterList.h
memoryx::Oac::setPlannable
void setPlannable(bool isPlannable, const ::Ice::Current &=Ice::emptyCurrent) override
Definition: Oac.cpp:96
memoryx::Oac::ice_clone
Ice::ObjectPtr ice_clone() const override
Definition: Oac.cpp:130
memoryx::OacPredictionFunction
Definition: OacPredictionFunction.h:40
memoryx::Oac::setStatechartProxyName
void setStatechartProxyName(const std::string &statechartProxyName, const ::Ice::Current &=Ice::emptyCurrent) override
Definition: Oac.cpp:72
memoryx::Oac::setPredictionFunction
void setPredictionFunction(const ::memoryx::OacPredictionFunctionBasePtr &prediction, const ::Ice::Current &=Ice::emptyCurrent) override
Definition: Oac.cpp:109
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:123
memoryx::OacParameterList
Definition: OacParameterList.h:40
memoryx::Entity
Definition: Entity.h:245
memoryx::Oac::getPredictionFunction
OacPredictionFunctionBasePtr getPredictionFunction(const ::Ice::Current &=Ice::emptyCurrent) const override
Definition: Oac.cpp:102
memoryx::Entity::setName
void setName(const ::std::string &name, const ::Ice::Current &=Ice::emptyCurrent) override
Set name of this entity.
Definition: Entity.cpp:188
memoryx::Oac::setParameters
void setParameters(const std::vector< std::string > &parameters, const ::Ice::Current &=Ice::emptyCurrent) override
Definition: Oac.cpp:58
memoryx::Oac::getStatechartProxyName
std::string getStatechartProxyName(const ::Ice::Current &=Ice::emptyCurrent) const override
Definition: Oac.cpp:66