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 
24 #include <MemoryX/interface/core/MemoryInterface.h>
25 
27 
28 namespace armarx::VariantType
29 {
30  const armarx::VariantTypeId EntityRef = armarx::Variant::addTypeName("::memoryx::EntityRefBase");
31 }
32 
33 namespace memoryx
34 {
35 
36  class EntityRef;
38 
39  class MongoSerializer;
41 
42  /**
43  * @brief The EntityRef class is used to store references to Entities as values in other Entity instances.
44  */
45  class EntityRef :
46  public EntityRefBase
47  {
48  public:
49  EntityRef();
50  EntityRef(const std::string entityName);
51  EntityRef(EntityBasePtr entity, const std::string& segmentName, const std::string& memoryName, MemoryInterfacePrx memoryPrx, EntityMemorySegmentInterfacePrx segmentPrx);
52  EntityRef(const EntityRef& entityRef);
53 
54  // Serializable interface
55  public:
56  void serialize(const armarx::ObjectSerializerBasePtr& serializer, const Ice::Current& c = Ice::emptyCurrent) const override;
57  void deserialize(const armarx::ObjectSerializerBasePtr& serializer, const Ice::Current& c = Ice::emptyCurrent) override;
58 
59  // VariantDataClass interface
60  public:
61  armarx::VariantDataClassPtr clone(const Ice::Current& c = Ice::emptyCurrent) const override;
62  // inherited from VariantDataClass
63  Ice::ObjectPtr ice_clone() const override;
64  std::string output(const Ice::Current& c = Ice::emptyCurrent) const override;
65  Ice::Int getType(const Ice::Current& c = Ice::emptyCurrent) const override;
66 
67  bool validate(const Ice::Current& c = Ice::emptyCurrent) override;
68  EntityBasePtr getEntity(const Ice::Current& c = Ice::emptyCurrent) const override;
69  public:
70  bool equals(const EntityRefBasePtr& other, const Ice::Current& c = Ice::emptyCurrent) const override;
71  };
72 }
73 
armarx::VariantType::EntityRef
const armarx::VariantTypeId EntityRef
Definition: EntityRef.h:30
memoryx::EntityRef::deserialize
void deserialize(const armarx::ObjectSerializerBasePtr &serializer, const Ice::Current &c=Ice::emptyCurrent) override
Definition: EntityRef.cpp:76
memoryx::EntityRef::serialize
void serialize(const armarx::ObjectSerializerBasePtr &serializer, const Ice::Current &c=Ice::emptyCurrent) const override
Definition: EntityRef.cpp:66
memoryx::EntityRef::equals
bool equals(const EntityRefBasePtr &other, const Ice::Current &c=Ice::emptyCurrent) const override
Definition: EntityRef.cpp:148
memoryx
VirtualRobot headers.
Definition: CommonPlacesTester.cpp:48
c
constexpr T c
Definition: UnscentedKalmanFilterTest.cpp:43
memoryx::EntityRef::getEntity
EntityBasePtr getEntity(const Ice::Current &c=Ice::emptyCurrent) const override
Definition: EntityRef.cpp:134
memoryx::EntityRef::getType
Ice::Int getType(const Ice::Current &c=Ice::emptyCurrent) const override
Definition: EntityRef.cpp:124
memoryx::EntityRef
The EntityRef class is used to store references to Entities as values in other Entity instances.
Definition: EntityRef.h:45
IceInternal::Handle
Definition: forward_declarations.h:8
memoryx::EntityRef::EntityRef
EntityRef()
Definition: EntityRef.cpp:35
armarx::VariantType
Definition: ChannelRef.h:160
armarx::VariantTypeId
Ice::Int VariantTypeId
Definition: Variant.h:44
memoryx::EntityRef::clone
armarx::VariantDataClassPtr clone(const Ice::Current &c=Ice::emptyCurrent) const override
Definition: EntityRef.cpp:109
memoryx::EntityRef::ice_clone
Ice::ObjectPtr ice_clone() const override
Definition: EntityRef.cpp:114
memoryx::MongoSerializer
Definition: MongoSerializer.h:40
armarx::armem::laser_scans::constants::memoryName
const std::string memoryName
Definition: constants.h:28
IceUtil::Handle< MongoSerializer >
armarx::VariantType::Int
const VariantTypeId Int
Definition: Variant.h:916
armarx::aron::type::ObjectPtr
std::shared_ptr< Object > ObjectPtr
Definition: Object.h:36
memoryx::EntityRef::output
std::string output(const Ice::Current &c=Ice::emptyCurrent) const override
Definition: EntityRef.cpp:119
Variant.h
armarx::Variant::addTypeName
static VariantTypeId addTypeName(const std::string &typeName)
Register a new type for the use in a Variant.
Definition: Variant.cpp:751
memoryx::EntityRef::validate
bool validate(const Ice::Current &c=Ice::emptyCurrent) override
Definition: EntityRef.cpp:129