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 void onInitLongtermMemory() override;
92 void onConnectLongtermMemory() override;
93
94 std::string getMemoryName(const Ice::Current& = Ice::emptyCurrent) const override;
95
96 // inherited from LongtermMemoryInterface
97 WorkingMemorySnapshotListSegmentBasePrx
98 getWorkingMemorySnapshotListSegment(const ::Ice::Current& = Ice::emptyCurrent) override;
99
100 PersistentObjectInstanceSegmentBasePrx
101 getCustomInstancesSegment(const std::string& segmentName,
102 bool createIfMissing,
103 const ::Ice::Current& c = Ice::emptyCurrent) override;
104 OacMemorySegmentBasePrx getOacSegment(const ::Ice::Current& = Ice::emptyCurrent) override;
105 KBMSegmentBasePrx getKBMSegment(const Ice::Current&) override;
106 PersistentDMPDataSegmentBasePrx
107 getDMPSegment(const ::Ice::Current& = Ice::emptyCurrent) override;
108 PersistentProfilerDataSegmentBasePrx
109 getProfilerDataSegment(const Ice::Current& c = Ice::emptyCurrent) override;
110 PersistentPredictionDataSegmentBasePrx
111 getPredictionDataSegment(const Ice::Current& c = Ice::emptyCurrent) override;
112 PersistentResourceProfileSegmentBasePrx
113 getResourceProfileSegment(const Ice::Current& c = Ice::emptyCurrent) override;
114 PersistentEntitySegmentBasePrx
115 getSelfLocalisationSegment(const Ice::Current& c = Ice::emptyCurrent) override;
116
117 PersistentObjectClassSegmentBasePrx
118 getObjectClassesSegment(const ::Ice::Current& c = Ice::emptyCurrent) const override;
119 CommonStorageInterfacePrx
120 getCommonStorage(const ::Ice::Current& c = Ice::emptyCurrent) const override;
121
122 // snapshot management
123 void loadWorkingMemorySnapshot(const std::string& snapshotName,
124 const AbstractWorkingMemoryInterfacePrx& workingMemory,
125 const ::Ice::Current& = Ice::emptyCurrent) override;
126 bool saveWorkingMemorySnapshot(const std::string& snapshotName,
127 const AbstractWorkingMemoryInterfacePrx& workingMemory,
128 const ::Ice::Current& = Ice::emptyCurrent) override;
129 bool removeWorkingMemorySnapshot(const std::string& snapshotName,
130 const ::Ice::Current& = Ice::emptyCurrent) override;
131 WorkingMemorySnapshotInterfacePrx
132 openWorkingMemorySnapshot(const std::string& snapshotName,
133 const ::Ice::Current& = Ice::emptyCurrent) override;
134 NameList getSnapshotNames(const ::Ice::Current& = Ice::emptyCurrent) override;
135
136 /**
137 * @see PropertyUser::createPropertyDefinitions()
138 */
145
146 AbstractMemorySegmentPrx addGenericSegment(const std::string& segmentName,
147 const Ice::Current&) override;
148
149 private:
150 DatabaseInterfacePrx databaseInterfacePrx;
151 PriorKnowledgeInterfacePrx priorKnowledgePrx;
152 NameList classCollNames;
153 };
154
156} // 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
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