Newer
Older
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
#include "SpecializedSegment.h"
#include <ArmarXCore/core/application/properties/PropertyDefinitionContainer.h>
#include <ArmarXCore/core/application/properties/PluginAll.h>
#include <ArmarXCore/core/exceptions/local/ExpressionException.h>
#include <RobotAPI/libraries/aron/core/navigator/type/container/Object.h>
#include <RobotAPI/libraries/armem/server/MemoryToIceAdapter.h>
namespace armarx::armem::server::segment
{
SpecializedSegment::SpecializedSegment(
server::MemoryToIceAdapter& iceMemory,
aron::typenavigator::ObjectNavigatorPtr aronType,
const std::string& defaultCoreSegmentName,
int64_t defaultMaxHistorySize
) :
iceMemory(iceMemory), aronType(aronType)
{
setDefaultCoreSegmentName(defaultCoreSegmentName);
setDefaultMaxHistorySize(defaultMaxHistorySize);
}
SpecializedSegment::~SpecializedSegment()
{
}
void SpecializedSegment::defineProperties(armarx::PropertyDefinitionsPtr defs, const std::string& prefix)
{
defs->optional(properties.coreSegmentName,
prefix + "seg.CoreSegmentName",
"Name of the " + properties.coreSegmentName + " core segment.");
defs->optional(properties.maxHistorySize,
prefix + "seg.MaxHistorySize",
"Maximal size of the " + properties.coreSegmentName + " entity histories (-1 for infinite).");
}
void SpecializedSegment::init()
{
ARMARX_CHECK_NOT_NULL(iceMemory.workingMemory);
Logging::setTag(properties.coreSegmentName + " Core Segment");
ARMARX_INFO << "Adding core segment '" << properties.coreSegmentName << "'";
coreSegment = &iceMemory.workingMemory->addCoreSegment(properties.coreSegmentName, aronType);
coreSegment->setMaxHistorySize(properties.maxHistorySize);
}
std::mutex& SpecializedSegment::mutex() const
{
ARMARX_CHECK_NOT_NULL(coreSegment);
return coreSegment->mutex();
}
void SpecializedSegment::setDefaultCoreSegmentName(const std::string& coreSegmentName)
{
this->properties.coreSegmentName = coreSegmentName;
}
void SpecializedSegment::setDefaultMaxHistorySize(int64_t maxHistorySize)
{
this->properties.maxHistorySize = maxHistorySize;
}
void SpecializedSegment::setAronType(aron::typenavigator::ObjectNavigatorPtr aronType)
{
this->aronType = aronType;
}
}