EntityFusionMethod.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 MemoryX::Core
17* @author Kai Welke <welke@kit.edu>
18* @copyright 2012 Kai Welke
19* @license http://www.gnu.org/licenses/gpl-2.0.txt
20* GNU General Public License
21*/
22
23#pragma once
24
25#include <string>
26
27#include <IceUtil/Handle.h>
28
30
31#include <MemoryX/interface/core/FusionMethods.h>
32
33namespace memoryx
34{
37
38 /**
39 * @class EntityFusionMethod
40 * @brief Interface for fusion methods used for entities in working memory
41 * @ingroup WorkingMemory
42 *
43 * Define fusion methods by subclassing EntityFusionMethod. The pure virtual method fuse()
44 * needs to be implemented.
45 */
46 class ARMARXCORE_IMPORT_EXPORT EntityFusionMethod : virtual public EntityFusionMethodBase
47 {
48 public:
49 /**
50 * Constructs a new fusion method
51 *
52 * @param name of the fusion method
53 */
54 EntityFusionMethod(std::string methodName)
55 {
56 this->methodName = methodName;
57 }
58
59 /**
60 * Initialization of an entity. Implement this method in order to add attributes which are fusion method
61 * specific, if you need it. The default implementation just returns the updateEntity.
62 *
63 * @param updateEntity entity to be initilialized
64 * @return initialized entity
65 */
66 EntityBasePtr
67 initEntity(const EntityBasePtr& updateEntity,
68 const ::Ice::Current& = Ice::emptyCurrent) override
69 {
70 return updateEntity;
71 }
72
73 /**
74 * Fusion method. Fuses two entities with the same key. Implement this in a concrete EntityFusionMethod.
75 * @param baseEntity base entity for fusion
76 * @param updateEntity entity to be fused with base entity
77 *
78 * @return fused entity
79 */
80 EntityBasePtr fuseEntity(const EntityBasePtr& baseEntity,
81 const EntityBasePtr& updateEntity,
82 const ::Ice::Current& = Ice::emptyCurrent) override = 0;
83
84 std::string
85 getMethodName(const ::Ice::Current& = Ice::emptyCurrent) const override
86 {
87 return methodName;
88 }
89
90 private:
91 std::string methodName;
92 };
93} // namespace memoryx
#define ARMARXCORE_IMPORT_EXPORT
Interface for fusion methods used for entities in working memory.
EntityFusionMethod(std::string methodName)
Constructs a new fusion method.
EntityBasePtr initEntity(const EntityBasePtr &updateEntity, const ::Ice::Current &=Ice::emptyCurrent) override
Initialization of an entity.
std::string getMethodName(const ::Ice::Current &=Ice::emptyCurrent) const override
EntityBasePtr fuseEntity(const EntityBasePtr &baseEntity, const EntityBasePtr &updateEntity, const ::Ice::Current &=Ice::emptyCurrent) override=0
Fusion method.
VirtualRobot headers.
IceInternal::Handle< EntityFusionMethod > EntityFusionMethodPtr