LongtermMemory.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::LongtermMemory
17* @author Alexey Kozlov ( kozlov at kit dot edu)
18* @date 2012
19* @copyright http://www.gnu.org/licenses/gpl-2.0.txt
20* GNU General Public License
21*/
22
23#pragma once
24
27
30#include <MemoryX/interface/components/CommonStorageInterface.h>
31#include <MemoryX/interface/components/LongtermMemoryInterface.h>
32#include <MemoryX/interface/components/PriorKnowledgeInterface.h>
34
35namespace memoryx
36{
37
39 {
40 public:
43 {
45 "SnapshotListCollection",
46 LTM::SegmentNames::SNAPSHOTS,
47 "Mongo collection holding a list of snapshots with corresponding metadata");
49 "OacCollection", LTM::SegmentNames::OACS, "Mongo collection holding all OACs");
51 "DmpCollection", LTM::SegmentNames::DMP, "Mongo collection holding all DMPs");
53 LTM::SegmentNames::KBM,
54 "Mongo collection holding all KBM instances");
55 defineOptionalProperty<std::string>("ProfilerDataCollection",
56 "ltm_" + LTM::SegmentNames::PROFILER,
57 "Mongo collection for storing Profiler data");
58 defineOptionalProperty<std::string>("ResourceProfileCollection",
59 "ltm_" + LTM::SegmentNames::RESOURCE_PROFILES,
60 "Mongo collection for storing ResourceProfile");
61 defineOptionalProperty<std::string>("PredictionDataCollection",
62 "ltm_" + LTM::SegmentNames::PREDICTION_DATA,
63 "Mongo collection for storing ResourceProfile");
65 "SelfLocalisationCollection",
66 "ltm_" + LTM::SegmentNames::SELF_LOCALISATION,
67 "Mongo collection for storing self localisation results");
69 "ClassCollections",
70 "memdb.Longterm_Objects",
71 "Comma separated list of MongoDB collections (<db>.<collection>) which store known "
72 "object classes. First collection will be used for writing.");
73 }
74 };
75
76 /*!
77 * \brief The LongtermMemory class provides persistent data that has been learned or copied as a snapshot from working memory.
78 *
79 * The LongtermMemory is a segmented memory and provides methods to store the current WorkingMemory into a snapshot and to fill the WorkingMemory with
80 * previously stored snapshots.
81 *
82 * See \ref longtermmemory "memoryx::LongtermMemory" - "offline" memory, built mostly from earlier experience
83 */
85 virtual public LongtermMemoryInterface,
86 virtual public AbstractLongtermMemory
87 {
88 public:
89 // inherited from AbstractLongtermMemory
90 std::string getDefaultName() const override;
91 static std::string GetDefaultName();
92 void onInitLongtermMemory() override;
93 void onConnectLongtermMemory() override;
94
95 std::string getMemoryName(const Ice::Current& = Ice::emptyCurrent) const override;
96
97 // inherited from LongtermMemoryInterface
98 WorkingMemorySnapshotListSegmentBasePrx
99 getWorkingMemorySnapshotListSegment(const ::Ice::Current& = Ice::emptyCurrent) override;
100
101 PersistentObjectInstanceSegmentBasePrx
102 getCustomInstancesSegment(const std::string& segmentName,
103 bool createIfMissing,
104 const ::Ice::Current& c = Ice::emptyCurrent) override;
105 OacMemorySegmentBasePrx getOacSegment(const ::Ice::Current& = Ice::emptyCurrent) override;
106 KBMSegmentBasePrx getKBMSegment(const Ice::Current&) override;
107 PersistentDMPDataSegmentBasePrx
108 getDMPSegment(const ::Ice::Current& = Ice::emptyCurrent) override;
109 PersistentProfilerDataSegmentBasePrx
110 getProfilerDataSegment(const Ice::Current& c = Ice::emptyCurrent) override;
111 PersistentPredictionDataSegmentBasePrx
112 getPredictionDataSegment(const Ice::Current& c = Ice::emptyCurrent) override;
113 PersistentResourceProfileSegmentBasePrx
114 getResourceProfileSegment(const Ice::Current& c = Ice::emptyCurrent) override;
115 PersistentEntitySegmentBasePrx
116 getSelfLocalisationSegment(const Ice::Current& c = Ice::emptyCurrent) override;
117
118 PersistentObjectClassSegmentBasePrx
119 getObjectClassesSegment(const ::Ice::Current& c = Ice::emptyCurrent) const override;
120 CommonStorageInterfacePrx
121 getCommonStorage(const ::Ice::Current& c = Ice::emptyCurrent) const override;
122
123 // snapshot management
124 void loadWorkingMemorySnapshot(const std::string& snapshotName,
125 const AbstractWorkingMemoryInterfacePrx& workingMemory,
126 const ::Ice::Current& = Ice::emptyCurrent) override;
127 bool saveWorkingMemorySnapshot(const std::string& snapshotName,
128 const AbstractWorkingMemoryInterfacePrx& workingMemory,
129 const ::Ice::Current& = Ice::emptyCurrent) override;
130 bool removeWorkingMemorySnapshot(const std::string& snapshotName,
131 const ::Ice::Current& = Ice::emptyCurrent) override;
132 WorkingMemorySnapshotInterfacePrx
133 openWorkingMemorySnapshot(const std::string& snapshotName,
134 const ::Ice::Current& = Ice::emptyCurrent) override;
135 NameList getSnapshotNames(const ::Ice::Current& = Ice::emptyCurrent) override;
136
137 /**
138 * @see PropertyUser::createPropertyDefinitions()
139 */
146
147 AbstractMemorySegmentPrx addGenericSegment(const std::string& segmentName,
148 const Ice::Current&) override;
149
150 private:
151 DatabaseInterfacePrx databaseInterfacePrx;
152 PriorKnowledgeInterfacePrx priorKnowledgePrx;
153 NameList classCollNames;
154 };
155
157} // namespace memoryx
#define ARMARXCOMPONENT_IMPORT_EXPORT
constexpr T c
std::string getConfigIdentifier()
Retrieve config identifier for this component as set in constructor.
Definition Component.cpp:90
std::string prefix
Prefix of the properties such as namespace, domain, component name, etc.
PropertyDefinition< PropertyType > & defineOptionalProperty(const std::string &name, PropertyType defaultValue, const std::string &description="", PropertyDefinitionBase::PropertyConstness constness=PropertyDefinitionBase::eConstant)
LongtermMemoryPropertyDefinitions(std::string prefix)
The LongtermMemory class provides persistent data that has been learned or copied as a snapshot from ...
NameList getSnapshotNames(const ::Ice::Current &=Ice::emptyCurrent) override
PersistentObjectInstanceSegmentBasePrx getCustomInstancesSegment(const std::string &segmentName, bool createIfMissing, const ::Ice::Current &c=Ice::emptyCurrent) override
void loadWorkingMemorySnapshot(const std::string &snapshotName, const AbstractWorkingMemoryInterfacePrx &workingMemory, const ::Ice::Current &=Ice::emptyCurrent) override
OacMemorySegmentBasePrx getOacSegment(const ::Ice::Current &=Ice::emptyCurrent) override
bool removeWorkingMemorySnapshot(const std::string &snapshotName, const ::Ice::Current &=Ice::emptyCurrent) override
bool saveWorkingMemorySnapshot(const std::string &snapshotName, const AbstractWorkingMemoryInterfacePrx &workingMemory, const ::Ice::Current &=Ice::emptyCurrent) override
CommonStorageInterfacePrx getCommonStorage(const ::Ice::Current &c=Ice::emptyCurrent) const override
armarx::PropertyDefinitionsPtr createPropertyDefinitions() override
PersistentProfilerDataSegmentBasePrx getProfilerDataSegment(const Ice::Current &c=Ice::emptyCurrent) override
KBMSegmentBasePrx getKBMSegment(const Ice::Current &) override
void onConnectLongtermMemory() override
PersistentDMPDataSegmentBasePrx getDMPSegment(const ::Ice::Current &=Ice::emptyCurrent) override
std::string getMemoryName(const Ice::Current &=Ice::emptyCurrent) const override
PersistentEntitySegmentBasePrx getSelfLocalisationSegment(const Ice::Current &c=Ice::emptyCurrent) override
PersistentResourceProfileSegmentBasePrx getResourceProfileSegment(const Ice::Current &c=Ice::emptyCurrent) override
static std::string GetDefaultName()
WorkingMemorySnapshotListSegmentBasePrx getWorkingMemorySnapshotListSegment(const ::Ice::Current &=Ice::emptyCurrent) override
void onInitLongtermMemory() override
PersistentPredictionDataSegmentBasePrx getPredictionDataSegment(const Ice::Current &c=Ice::emptyCurrent) override
PersistentObjectClassSegmentBasePrx getObjectClassesSegment(const ::Ice::Current &c=Ice::emptyCurrent) const override
WorkingMemorySnapshotInterfacePrx openWorkingMemorySnapshot(const std::string &snapshotName, const ::Ice::Current &=Ice::emptyCurrent) override
std::string getDefaultName() const override
Retrieve default name of component.
IceUtil::Handle< class PropertyDefinitionContainer > PropertyDefinitionsPtr
PropertyDefinitions smart pointer type.
VirtualRobot headers.
IceUtil::Handle< LongtermMemory > LongtermMemoryPtr