SpecializedCoreSegment.cpp
Go to the documentation of this file.
2
5
8
10{
11
14 const std::string& defaultCoreSegmentName,
15 aron::type::ObjectPtr coreSegmentAronType,
16 int defaultMaxHistorySize,
17 const std::vector<PredictionEngine>& predictionEngines) :
18 Base(iceMemory),
19 aronType(coreSegmentAronType),
21 properties({defaultCoreSegmentName, defaultMaxHistorySize})
22 {
23 Logging::setTag("armarx::armem::SpecializedCoreSegment");
24 }
25
29
30 void
32 const std::string& prefix)
33 {
35
36 defs->optional(properties.segmentName,
37 prefix + "seg.CoreSegmentName",
38 "Name of the " + properties.segmentName + " core segment.");
39
40 defs->optional(properties.maxHistorySize,
41 prefix + "seg.CoreMaxHistorySize",
42 "Maximal size of the " + properties.segmentName +
43 " entity histories (-1 for infinite).");
44
45 defs->optional(properties.unlimitedHistoryWarningThreshold,
46 prefix + "seg.UnlimitedHistoryWarningThreshold",
47 "When maxHistorySize is -1 (unlimited) and history exceeds this threshold, "
48 "a warning is emitted. Set to 0 to disable.");
49
50 defs->optional(properties.truncateMaxBatchSize,
51 prefix + "seg.TruncateMaxBatchSize",
52 "Maximum number of snapshots to remove per truncate() call. "
53 "Limits blocking time during cleanup. Set to 0 for unlimited.");
54 }
55
56 void
58 {
59 ARMARX_CHECK_NOT_NULL(iceMemory.workingMemory);
60 Logging::setTag(properties.segmentName + " Core Segment");
61
62 if (iceMemory.workingMemory->hasCoreSegment(properties.segmentName))
63 {
64 segmentPtr = &iceMemory.workingMemory->getCoreSegment(properties.segmentName);
65 }
66 else
67 {
68 ARMARX_INFO << "Adding core segment '" << properties.segmentName << "'";
69 segmentPtr = &iceMemory.workingMemory->addCoreSegment(
71
72 segmentPtr->aronType() = aronType;
73 segmentPtr->setMaxHistorySize(properties.maxHistorySize);
74 segmentPtr->setUnlimitedHistoryWarningThreshold(
75 properties.unlimitedHistoryWarningThreshold);
76 segmentPtr->setTruncateMaxBatchSize(properties.truncateMaxBatchSize);
77 segmentPtr->setPredictionEngines(predictionEngines);
78 ARMARX_DEBUG << "New core segment has aron type: " << segmentPtr->hasAronType();
79 }
80 }
81
82 void
83 SpecializedCoreSegment::setDefaultCoreSegmentName(const std::string& coreSegmentName)
84 {
85 this->properties.segmentName = coreSegmentName;
86 }
87
88 void
90 {
91 this->properties.maxHistorySize = maxHistorySize;
92 }
93
94 void
99
100 void
102 const std::vector<PredictionEngine>& predictionEngines)
103 {
104 this->predictionEngines = predictionEngines;
105 }
106
113
114 const wm::CoreSegment&
120} // namespace armarx::armem::server::segment
void setTag(const LogTag &tag)
Definition Logging.cpp:54
Helps connecting a Memory server to the Ice interface.
virtual void defineProperties(armarx::PropertyDefinitionsPtr defs, const std::string &prefix="") override
void setPredictionEngines(const std::vector< PredictionEngine > &predictionEngines)
SpecializedCoreSegment(MemoryToIceAdapter &iceMemory, const std::string &defaultCoreSegmentName="", aron::type::ObjectPtr coreSegmentAronType=nullptr, int defaultMaxHistorySize=10, const std::vector< PredictionEngine > &predictionEngines={})
void setDefaultCoreSegmentName(const std::string &coreSegmentName)
#define ARMARX_CHECK_NOT_NULL(ptr)
This macro evaluates whether ptr is not null and if it turns out to be false it will throw an Express...
#define ARMARX_INFO
The normal logging level.
Definition Logging.h:181
#define ARMARX_DEBUG
The logging level for output that is only interesting while debugging.
Definition Logging.h:184
std::shared_ptr< Object > ObjectPtr
Definition Object.h:36
IceUtil::Handle< class PropertyDefinitionContainer > PropertyDefinitionsPtr
PropertyDefinitions smart pointer type.