SpecializedCoreSegment.cpp
Go to the documentation of this file.
1
#include "
SpecializedCoreSegment.h
"
2
3
#include <
ArmarXCore/core/application/properties/PluginAll.h
>
4
#include <
ArmarXCore/core/application/properties/PropertyDefinitionContainer.h
>
5
6
#include <
RobotAPI/libraries/armem/server/MemoryToIceAdapter.h
>
7
#include <
RobotAPI/libraries/aron/core/type/variant/container/Object.h
>
8
9
namespace
armarx::armem::server::segment
10
{
11
12
SpecializedCoreSegment::SpecializedCoreSegment
(
13
armem::server::MemoryToIceAdapter
& iceMemory,
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),
20
predictionEngines(predictionEngines),
21
properties({defaultCoreSegmentName, defaultMaxHistorySize})
22
{
23
Logging::setTag
(
"armarx::armem::SpecializedCoreSegment"
);
24
}
25
26
SpecializedCoreSegment::~SpecializedCoreSegment
()
27
{
28
}
29
30
void
31
SpecializedCoreSegment::defineProperties
(
armarx::PropertyDefinitionsPtr
defs,
32
const
std::string& prefix)
33
{
34
ARMARX_CHECK_NOT_NULL
(defs);
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
46
void
47
SpecializedCoreSegment::init
()
48
{
49
ARMARX_CHECK_NOT_NULL
(
iceMemory
.
workingMemory
);
50
Logging::setTag
(
properties
.
segmentName
+
" Core Segment"
);
51
52
if
(
iceMemory
.
workingMemory
->
hasCoreSegment
(
properties
.
segmentName
))
53
{
54
segmentPtr
= &
iceMemory
.
workingMemory
->
getCoreSegment
(
properties
.
segmentName
);
55
}
56
else
57
{
58
ARMARX_INFO
<<
"Adding core segment '"
<<
properties
.
segmentName
<<
"'"
;
59
segmentPtr
= &
iceMemory
.
workingMemory
->
addCoreSegment
(
60
properties
.
segmentName
,
aronType
,
predictionEngines
);
61
62
segmentPtr
->
aronType
() =
aronType
;
63
segmentPtr
->
setMaxHistorySize
(
properties
.
maxHistorySize
);
64
segmentPtr
->
setPredictionEngines
(
predictionEngines
);
65
ARMARX_DEBUG
<<
"New core segment has aron type: "
<<
segmentPtr
->
hasAronType
();
66
}
67
}
68
69
void
70
SpecializedCoreSegment::setDefaultCoreSegmentName
(
const
std::string& coreSegmentName)
71
{
72
this->
properties
.
segmentName
= coreSegmentName;
73
}
74
75
void
76
SpecializedCoreSegment::setDefaultMaxHistorySize
(int64_t maxHistorySize)
77
{
78
this->
properties
.
maxHistorySize
= maxHistorySize;
79
}
80
81
void
82
SpecializedCoreSegment::setAronType
(
aron::type::ObjectPtr
aronType)
83
{
84
this->aronType =
aronType
;
85
}
86
87
void
88
SpecializedCoreSegment::setPredictionEngines
(
89
const
std::vector<PredictionEngine>& predictionEngines)
90
{
91
this->predictionEngines =
predictionEngines
;
92
}
93
94
wm::CoreSegment
&
95
SpecializedCoreSegment::getCoreSegment
()
96
{
97
ARMARX_CHECK_NOT_NULL
(
segmentPtr
);
98
return
*
segmentPtr
;
99
}
100
101
const
wm::CoreSegment
&
102
SpecializedCoreSegment::getCoreSegment
()
const
103
{
104
ARMARX_CHECK_NOT_NULL
(
segmentPtr
);
105
return
*
segmentPtr
;
106
}
107
}
// namespace armarx::armem::server::segment
armarx::armem::server::MemoryToIceAdapter::workingMemory
server::wm::Memory * workingMemory
Definition:
MemoryToIceAdapter.h:89
armarx::armem::server::segment::SpecializedCoreSegment::Properties::segmentName
std::string segmentName
Definition:
SpecializedCoreSegment.h:58
armarx::armem::server::wm::detail::MaxHistorySizeParent::setMaxHistorySize
void setMaxHistorySize(long maxSize)
Sets the maximum history size of entities in this container.
Definition:
MaxHistorySize.h:41
armarx::armem::server::MemoryToIceAdapter
Helps connecting a Memory server to the Ice interface.
Definition:
MemoryToIceAdapter.h:19
armarx::armem::server::segment::SpecializedCoreSegment::SpecializedCoreSegment
SpecializedCoreSegment(MemoryToIceAdapter &iceMemory, const std::string &defaultCoreSegmentName="", aron::type::ObjectPtr coreSegmentAronType=nullptr, int defaultMaxHistorySize=10, const std::vector< PredictionEngine > &predictionEngines={})
Definition:
SpecializedCoreSegment.cpp:12
armarx::armem::base::MemoryBase::getCoreSegment
CoreSegmentT & getCoreSegment(const std::string &name)
Definition:
MemoryBase.h:134
ARMARX_CHECK_NOT_NULL
#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...
Definition:
ExpressionException.h:206
armarx::armem::base::detail::AronTyped::aronType
aron::type::ObjectPtr & aronType()
Definition:
AronTyped.cpp:19
armarx::armem::server::segment::SpecializedCoreSegment::setAronType
void setAronType(aron::type::ObjectPtr aronType)
Definition:
SpecializedCoreSegment.cpp:82
armarx::armem::base::detail::Predictive::setPredictionEngines
void setPredictionEngines(const std::vector< PredictionEngine > &engines)
Definition:
Predictive.h:58
armarx::armem::base::MemoryBase::hasCoreSegment
bool hasCoreSegment(const std::string &name) const
Definition:
MemoryBase.h:107
Object.h
armarx::armem::server::segment::detail::SegmentBase< server::wm::CoreSegment >::segmentPtr
server::wm::CoreSegment * segmentPtr
Definition:
SpecializedSegment.h:53
armarx::armem::server::segment::SpecializedCoreSegment::predictionEngines
std::vector< PredictionEngine > predictionEngines
Definition:
SpecializedCoreSegment.h:54
armarx::armem::server::segment::SpecializedCoreSegment::getCoreSegment
wm::CoreSegment & getCoreSegment()
Definition:
SpecializedCoreSegment.cpp:95
armarx::armem::server::segment::detail::SegmentBase< server::wm::CoreSegment >
armarx::armem::server::segment::SpecializedCoreSegment::init
virtual void init() override
Definition:
SpecializedCoreSegment.cpp:47
ARMARX_DEBUG
#define ARMARX_DEBUG
Definition:
Logging.h:184
armarx::armem::server::segment::SpecializedCoreSegment::setDefaultCoreSegmentName
void setDefaultCoreSegmentName(const std::string &coreSegmentName)
Definition:
SpecializedCoreSegment.cpp:70
PluginAll.h
MemoryToIceAdapter.h
armarx::armem::server::segment
Definition:
constants.h:1
armarx::armem::server::wm::CoreSegment
base::CoreSegmentBase
Definition:
memory_definitions.h:75
armarx::armem::server::segment::SpecializedCoreSegment::Properties::maxHistorySize
int64_t maxHistorySize
Definition:
SpecializedCoreSegment.h:59
armarx::armem::server::segment::detail::SegmentBase< server::wm::CoreSegment >::iceMemory
MemoryToIceAdapter & iceMemory
Definition:
SpecializedSegment.h:58
armarx::armem::server::segment::SpecializedCoreSegment::setDefaultMaxHistorySize
void setDefaultMaxHistorySize(int64_t maxHistorySize)
Definition:
SpecializedCoreSegment.cpp:76
ARMARX_INFO
#define ARMARX_INFO
Definition:
Logging.h:181
PropertyDefinitionContainer.h
IceUtil::Handle< class PropertyDefinitionContainer >
armarx::armem::base::detail::AronTyped::hasAronType
bool hasAronType() const
Definition:
AronTyped.cpp:13
armarx::aron::type::ObjectPtr
std::shared_ptr< Object > ObjectPtr
Definition:
Object.h:36
armarx::armem::server::segment::SpecializedCoreSegment::setPredictionEngines
void setPredictionEngines(const std::vector< PredictionEngine > &predictionEngines)
Definition:
SpecializedCoreSegment.cpp:88
armarx::Logging::setTag
void setTag(const LogTag &tag)
Definition:
Logging.cpp:54
armarx::armem::server::segment::SpecializedCoreSegment::~SpecializedCoreSegment
virtual ~SpecializedCoreSegment() override
Definition:
SpecializedCoreSegment.cpp:26
armarx::armem::server::segment::SpecializedCoreSegment::aronType
aron::type::ObjectPtr aronType
Definition:
SpecializedCoreSegment.h:53
armarx::armem::server::segment::SpecializedCoreSegment::properties
Properties properties
Definition:
SpecializedCoreSegment.h:62
armarx::armem::server::wm::Memory::addCoreSegment
CoreSegment & addCoreSegment(const std::string &name, Args... args)
Definition:
memory_definitions.h:151
SpecializedCoreSegment.h
armarx::armem::server::segment::SpecializedCoreSegment::defineProperties
virtual void defineProperties(armarx::PropertyDefinitionsPtr defs, const std::string &prefix="") override
Definition:
SpecializedCoreSegment.cpp:31
RobotAPI
libraries
armem
server
segment
SpecializedCoreSegment.cpp
Generated by
1.8.17