EntityRef.h
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 ArmarX::
17* @author Mirko Waechter ( mirko.waechter at kit dot edu)
18* @date 2014
19* @copyright http://www.gnu.org/licenses/gpl-2.0.txt
20* GNU General Public License
21*/
22#pragma once
23
25
26#include <MemoryX/interface/core/MemoryInterface.h>
27
28namespace armarx::VariantType
29{
31 armarx::Variant::addTypeName("::memoryx::EntityRefBase");
32}
33
34namespace memoryx
35{
36
37 class EntityRef;
39
40 class MongoSerializer;
42
43 /**
44 * @brief The EntityRef class is used to store references to Entities as values in other Entity instances.
45 */
46 class EntityRef : public EntityRefBase
47 {
48 public:
49 EntityRef();
50 EntityRef(const std::string entityName);
51 EntityRef(EntityBasePtr entity,
52 const std::string& segmentName,
53 const std::string& memoryName,
54 MemoryInterfacePrx memoryPrx,
55 EntityMemorySegmentInterfacePrx segmentPrx);
56 EntityRef(const EntityRef& entityRef);
57
58 // Serializable interface
59 public:
60 void serialize(const armarx::ObjectSerializerBasePtr& serializer,
61 const Ice::Current& c = Ice::emptyCurrent) const override;
62 void deserialize(const armarx::ObjectSerializerBasePtr& serializer,
63 const Ice::Current& c = Ice::emptyCurrent) override;
64
65 // VariantDataClass interface
66 public:
67 armarx::VariantDataClassPtr clone(const Ice::Current& c = Ice::emptyCurrent) const override;
68 // inherited from VariantDataClass
69 Ice::ObjectPtr ice_clone() const override;
70 std::string output(const Ice::Current& c = Ice::emptyCurrent) const override;
71 Ice::Int getType(const Ice::Current& c = Ice::emptyCurrent) const override;
72
73 bool validate(const Ice::Current& c = Ice::emptyCurrent) override;
74 EntityBasePtr getEntity(const Ice::Current& c = Ice::emptyCurrent) const override;
75
76 public:
77 bool equals(const EntityRefBasePtr& other,
78 const Ice::Current& c = Ice::emptyCurrent) const override;
79 };
80} // namespace memoryx
constexpr T c
static VariantTypeId addTypeName(const std::string &typeName)
Register a new type for the use in a Variant.
Definition Variant.cpp:869
EntityBasePtr getEntity(const Ice::Current &c=Ice::emptyCurrent) const override
std::string output(const Ice::Current &c=Ice::emptyCurrent) const override
void deserialize(const armarx::ObjectSerializerBasePtr &serializer, const Ice::Current &c=Ice::emptyCurrent) override
Definition EntityRef.cpp:83
void serialize(const armarx::ObjectSerializerBasePtr &serializer, const Ice::Current &c=Ice::emptyCurrent) const override
Definition EntityRef.cpp:70
bool validate(const Ice::Current &c=Ice::emptyCurrent) override
bool equals(const EntityRefBasePtr &other, const Ice::Current &c=Ice::emptyCurrent) const override
armarx::VariantDataClassPtr clone(const Ice::Current &c=Ice::emptyCurrent) const override
Ice::Int getType(const Ice::Current &c=Ice::emptyCurrent) const override
Ice::ObjectPtr ice_clone() const override
const armarx::VariantTypeId EntityRef
Definition EntityRef.h:30
Ice::Int VariantTypeId
Definition Variant.h:43
VirtualRobot headers.
IceInternal::Handle< EntityRef > EntityRefPtr
Definition EntityRef.h:38
IceUtil::Handle< MongoSerializer > MongoSerializerPtr
Definition EntityRef.h:41