SpecializedProviderSegment.cpp
Go to the documentation of this file.
2 
5 
8 
9 
11 {
14  const std::string& defaultProviderSegmentName,
15  const std::string& defaultCoreSegmentName,
16  aron::type::ObjectPtr providerSegmentAronType,
17  aron::type::ObjectPtr coreSegmentAronType,
18  int defaultMaxHistorySize,
19  const std::vector<PredictionEngine>& providerSegmentPredictionEngines,
20  const std::vector<PredictionEngine>& coreSegmentPredictionEngines) :
21  Base(iceMemory),
22  aronType(providerSegmentAronType),
23  predictionEngines(providerSegmentPredictionEngines),
24  coreSegment(iceMemory,
25  defaultCoreSegmentName,
26  coreSegmentAronType,
27  -1,
28  providerSegmentPredictionEngines),
29  properties({defaultProviderSegmentName, defaultMaxHistorySize})
30  {
31  Logging::setTag("armarx::armem::SpecializedProviderSegment");
32  }
33 
34 
36  {
37  }
38 
39 
41  {
43 
44  coreSegment.defineProperties(defs, prefix);
45 
46  defs->optional(properties.segmentName,
47  prefix + "seg.ProviderSegmentName",
48  "Name of the " + properties.segmentName + " provider segment.");
49 
50  defs->optional(properties.maxHistorySize,
51  prefix + "seg.ProviderMaxHistorySize",
52  "Maximal size of the " + properties.segmentName + " entity histories (-1 for infinite).");
53  }
54 
55 
57  {
59 
60  coreSegment.init();
61 
62  Logging::setTag(properties.segmentName + " Provider Segment");
63 
65  {
67  }
68  else
69  {
70  ARMARX_INFO << "Adding provider segment '" << properties.segmentName << "'";
72 
76  }
77  }
78 
79  void SpecializedProviderSegment::setDefaultProviderSegmentName(const std::string& providerSegmentName)
80  {
81  this->properties.segmentName = providerSegmentName;
82  }
83 
84 
86  {
87  this->properties.maxHistorySize = maxHistorySize;
88  }
89 
90 
92  {
93  this->aronType = aronType;
94  }
95 
96  void
98  const std::vector<PredictionEngine>& predictionEngines)
99  {
100  this->predictionEngines = predictionEngines;
101  }
102 
104  {
106  return *segmentPtr;
107  }
108 
109 
111  {
113  return *segmentPtr;
114  }
115 
116 }
armarx::armem::server::MemoryToIceAdapter::workingMemory
server::wm::Memory * workingMemory
Definition: MemoryToIceAdapter.h:65
armarx::armem::server::segment::SpecializedProviderSegment::Properties::maxHistorySize
int64_t maxHistorySize
Definition: SpecializedProviderSegment.h:60
armarx::armem::server::wm::detail::MaxHistorySizeParent::setMaxHistorySize
void setMaxHistorySize(long maxSize)
Sets the maximum history size of entities in this container.
Definition: MaxHistorySize.h:46
armarx::armem::server::segment::SpecializedProviderSegment::coreSegment
SpecializedCoreSegment coreSegment
Definition: SpecializedProviderSegment.h:55
armarx::armem::server::segment::SpecializedProviderSegment::properties
Properties properties
Definition: SpecializedProviderSegment.h:62
armarx::armem::server::MemoryToIceAdapter
Helps connecting a Memory server to the Ice interface.
Definition: MemoryToIceAdapter.h:19
armarx::armem::base::CoreSegmentBase::hasProviderSegment
bool hasProviderSegment(const std::string &name) const
Definition: CoreSegmentBase.h:116
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:18
armarx::armem::server::segment::SpecializedProviderSegment::Properties::segmentName
std::string segmentName
Definition: SpecializedProviderSegment.h:59
armarx::armem::server::segment::SpecializedProviderSegment::setPredictionEngines
void setPredictionEngines(const std::vector< PredictionEngine > &predictionEngines)
Definition: SpecializedProviderSegment.cpp:97
armarx::armem::base::detail::Predictive::setPredictionEngines
void setPredictionEngines(const std::vector< PredictionEngine > &engines)
Definition: Predictive.h:58
armarx::armem::server::segment::SpecializedProviderSegment::setDefaultMaxHistorySize
void setDefaultMaxHistorySize(int64_t maxHistorySize)
Definition: SpecializedProviderSegment.cpp:85
armarx::armem::server::segment::SpecializedProviderSegment::~SpecializedProviderSegment
virtual ~SpecializedProviderSegment() override
Definition: SpecializedProviderSegment.cpp:35
Object.h
armarx::armem::server::segment::SpecializedProviderSegment::setDefaultProviderSegmentName
void setDefaultProviderSegmentName(const std::string &providerSegmentName)
Definition: SpecializedProviderSegment.cpp:79
armarx::armem::server::segment::detail::SegmentBase::segmentPtr
SegmentType * segmentPtr
Definition: SpecializedSegment.h:54
armarx::armem::server::segment::detail::SegmentBase< server::wm::ProviderSegment >
armarx::armem::server::segment::SpecializedCoreSegment::init
virtual void init() override
Definition: SpecializedCoreSegment.cpp:49
armarx::armem::server::segment::SpecializedProviderSegment::getProviderSegment
wm::ProviderSegment & getProviderSegment()
Definition: SpecializedProviderSegment.cpp:103
armarx::armem::base::CoreSegmentBase::getProviderSegment
ProviderSegmentT & getProviderSegment(const std::string &name)
Definition: CoreSegmentBase.h:143
armarx::armem::server::segment::SpecializedProviderSegment::aronType
aron::type::ObjectPtr aronType
Definition: SpecializedProviderSegment.h:53
PluginAll.h
armarx::armem::server::wm::ProviderSegment
Definition: memory_definitions.h:60
armarx::armem::server::segment::SpecializedProviderSegment::setAronType
void setAronType(aron::type::ObjectPtr aronType)
Definition: SpecializedProviderSegment.cpp:91
armarx::armem::server::segment::SpecializedProviderSegment::init
virtual void init() override
Definition: SpecializedProviderSegment.cpp:56
MemoryToIceAdapter.h
armarx::armem::server::segment
Definition: constants.h:1
armarx::armem::server::segment::SpecializedProviderSegment::SpecializedProviderSegment
SpecializedProviderSegment(MemoryToIceAdapter &iceMemory, const std::string &defaultProviderSegmentName="", const std::string &defaultCoreSegmentName="", aron::type::ObjectPtr providerSegmentAronType=nullptr, aron::type::ObjectPtr coreSegmentAronType=nullptr, int defaultMaxHistorySize=10, const std::vector< PredictionEngine > &providerSegmentPredictionEngines={}, const std::vector< PredictionEngine > &coreSegmentPredictionEngines={})
Definition: SpecializedProviderSegment.cpp:12
armarx::armem::server::segment::detail::SegmentBase< server::wm::ProviderSegment >::iceMemory
MemoryToIceAdapter & iceMemory
Definition: SpecializedSegment.h:60
ARMARX_INFO
#define ARMARX_INFO
Definition: Logging.h:174
PropertyDefinitionContainer.h
IceUtil::Handle< class PropertyDefinitionContainer >
SpecializedProviderSegment.h
armarx::aron::type::ObjectPtr
std::shared_ptr< Object > ObjectPtr
Definition: Object.h:36
armarx::Logging::setTag
void setTag(const LogTag &tag)
Definition: Logging.cpp:55
armarx::armem::server::wm::CoreSegment::addProviderSegment
ProviderSegment & addProviderSegment(const std::string &name, Args... args)
Definition: memory_definitions.h:101
armarx::armem::server::segment::SpecializedProviderSegment::predictionEngines
std::vector< PredictionEngine > predictionEngines
Definition: SpecializedProviderSegment.h:54
armarx::armem::server::segment::SpecializedProviderSegment::defineProperties
virtual void defineProperties(armarx::PropertyDefinitionsPtr defs, const std::string &prefix="") override
Definition: SpecializedProviderSegment.cpp:40
armarx::armem::server::segment::SpecializedCoreSegment::defineProperties
virtual void defineProperties(armarx::PropertyDefinitionsPtr defs, const std::string &prefix="") override
Definition: SpecializedCoreSegment.cpp:33