PredictionTaskEntity.cpp
Go to the documentation of this file.
1/*
2 * This file is part of ArmarX.
3 *
4 * Copyright (C) 2012-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 MemoryX::Core
19 * @author Manfred Kroehnert (Manfred dot Kroehnert at kit dot edu)
20 * @date 2015
21 * @copyright http://www.gnu.org/licenses/gpl-2.0.txt
22 * GNU General Public License
23 */
24
26
28
29namespace memoryx
30{
31 const std::string PredictionTaskEntity::TASK_NAME_ATTRIBUTE("predictionTaskName");
32 const std::string PredictionTaskEntity::PREDICTION_LIST_ATTRIBUTE("predictionList");
33
38
39 PredictionTaskEntity::PredictionTaskEntity(const std::string& predictionTaskName,
40 const EntityRefBaseList& predictionEntityRefList) :
41 Entity()
42 {
44 setPredictionTaskName(predictionTaskName);
45 setPredictionEntityRefList(predictionEntityRefList);
46 }
47
49 IceUtil::Shared(source),
50 ::armarx::Serializable(source),
51 EntityBase(), // dont copy
52 PredictionTaskEntityBase(source),
53 Entity(source)
54 {
55 }
56
60
61 void
63 {
64 putAttribute(new EntityAttribute(PredictionTaskEntity::TASK_NAME_ATTRIBUTE));
65 putAttribute(new EntityAttribute(PredictionTaskEntity::PREDICTION_LIST_ATTRIBUTE));
66 }
67
68 void
69 PredictionTaskEntity::output(std::ostream& stream) const
70 {
71 Entity::output(stream);
72 }
73
74 Ice::ObjectPtr
76 {
77 return this->clone();
78 }
79
81 PredictionTaskEntity::clone(const Ice::Current& context) const
82 {
83 std::shared_lock entityLock(entityMutex);
84 std::scoped_lock attributesLock(attributesMutex);
85 std::scoped_lock wrappersLock(wrappersMutex);
86 return new PredictionTaskEntity(*this);
87 }
88
89 std::string
91 {
92 return getAttribute(PredictionTaskEntity::TASK_NAME_ATTRIBUTE)->getValue()->getString();
93 }
94
95 void
96 PredictionTaskEntity::setPredictionTaskName(const std::string& predictionTaskName,
97 const Ice::Current&)
98 {
99 getAttribute(PredictionTaskEntity::TASK_NAME_ATTRIBUTE)
100 ->setValue(new armarx::Variant(predictionTaskName));
101 }
102
103 EntityRefBaseList
105 {
106 // EntityAttributeBasePtr attribute = getAttribute(PredictionTaskEntity::PREDICTION_LIST_ATTRIBUTE);
107 // EntityRefBaseList entityList;
108 // for (int i = 0; i < attribute->size(); i++)
109 // {
110 // armarx::VariantPtr attributeValue = armarx::VariantPtr::dynamicCast(attribute->getValueAt(i));
111 // entityList.push_back(attributeValue->get<EntityRef>());
112 // }
113 // return entityList;
114 return EntityRefBaseList{};
115 }
116
117 void
119 const EntityRefBaseList& predictedEntityRefList,
120 const Ice::Current&)
121 {
122 // EntityAttributeBasePtr attribute = getAttribute(PredictionTaskEntity::PREDICTION_LIST_ATTRIBUTE);
123 // attribute->clear();
124 // for (const EntityRefBasePtr & entityRef : predictedMemorySnapshotRefList)
125 // {
126 // attribute->addValue(new armarx::Variant(entityRef));
127 // }
128 }
129} // namespace memoryx
The Variant class is described here: Variants.
Definition Variant.h:224
Attribute of MemoryX entities.
EntityAttributeBasePtr getAttribute(const ::std::string &attrName, const ::Ice::Current &=Ice::emptyCurrent) const override
Retrieve attribute from entity.
Definition Entity.cpp:311
Entity(const Entity &source)
Definition Entity.cpp:34
std::mutex attributesMutex
Definition Entity.h:524
std::recursive_mutex wrappersMutex
Definition Entity.h:526
void output(std::ostream &stream) const
Definition Entity.cpp:436
void putAttribute(const ::memoryx::EntityAttributeBasePtr &attr, const ::Ice::Current &=Ice::emptyCurrent) override
Store attribute in entity.
Definition Entity.cpp:347
std::shared_mutex entityMutex
Definition Entity.h:525
void setPredictionEntityRefList(const EntityRefBaseList &predictedEntityRefList, const Ice::Current &c=Ice::emptyCurrent) override
void setPredictionTaskName(const std::string &predictionTaskName, const Ice::Current &c=Ice::emptyCurrent) override
Ice::ObjectPtr ice_clone() const override
EntityRefBaseList getPredictionEntityRefList(const Ice::Current &c=Ice::emptyCurrent) const override
PredictionTaskEntityPtr clone(const Ice::Current &c=Ice::emptyCurrent) const
std::string getPredictionTaskName(const Ice::Current &c=Ice::emptyCurrent) const override
This file offers overloads of toIce() and fromIce() functions for STL container types.
VirtualRobot headers.
IceInternal::Handle< PredictionTaskEntity > PredictionTaskEntityPtr