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>
27 #include <IceUtil/Handle.h>
28 #include <MemoryX/interface/core/FusionMethods.h>
29 
30 namespace memoryx
31 {
32  class EntityFusionMethod;
34 
35  /**
36  * @class EntityFusionMethod
37  * @brief Interface for fusion methods used for entities in working memory
38  * @ingroup WorkingMemory
39  *
40  * Define fusion methods by subclassing EntityFusionMethod. The pure virtual method fuse()
41  * needs to be implemented.
42  */
44  virtual public EntityFusionMethodBase
45  {
46  public:
47  /**
48  * Constructs a new fusion method
49  *
50  * @param name of the fusion method
51  */
52  EntityFusionMethod(std::string methodName)
53  {
54  this->methodName = methodName;
55  }
56 
57  /**
58  * Initialization of an entity. Implement this method in order to add attributes which are fusion method
59  * specific, if you need it. The default implementation just returns the updateEntity.
60  *
61  * @param updateEntity entity to be initilialized
62  * @return initialized entity
63  */
64  EntityBasePtr initEntity(const EntityBasePtr& updateEntity, const ::Ice::Current& = Ice::emptyCurrent) override
65  {
66  return updateEntity;
67  }
68 
69  /**
70  * Fusion method. Fuses two entities with the same key. Implement this in a concrete EntityFusionMethod.
71  * @param baseEntity base entity for fusion
72  * @param updateEntity entity to be fused with base entity
73  *
74  * @return fused entity
75  */
76  EntityBasePtr fuseEntity(const EntityBasePtr& baseEntity, const EntityBasePtr& updateEntity, const ::Ice::Current& = Ice::emptyCurrent) override = 0;
77 
78  std::string getMethodName(const ::Ice::Current& = Ice::emptyCurrent) const override
79  {
80  return methodName;
81  }
82  private:
83  std::string methodName;
84  };
85 }
86 
memoryx::EntityFusionMethod::getMethodName
std::string getMethodName(const ::Ice::Current &=Ice::emptyCurrent) const override
Definition: EntityFusionMethod.h:78
memoryx
VirtualRobot headers.
Definition: CommonPlacesTester.cpp:48
memoryx::EntityFusionMethod
Interface for fusion methods used for entities in working memory.
Definition: EntityFusionMethod.h:43
IceInternal::Handle< EntityFusionMethod >
memoryx::EntityFusionMethod::initEntity
EntityBasePtr initEntity(const EntityBasePtr &updateEntity, const ::Ice::Current &=Ice::emptyCurrent) override
Initialization of an entity.
Definition: EntityFusionMethod.h:64
memoryx::EntityFusionMethod::EntityFusionMethod
EntityFusionMethod(std::string methodName)
Constructs a new fusion method.
Definition: EntityFusionMethod.h:52
ImportExport.h
ARMARXCORE_IMPORT_EXPORT
#define ARMARXCORE_IMPORT_EXPORT
Definition: ImportExport.h:38