SpecializedCoreSegment.h
Go to the documentation of this file.
1#pragma once
2
3#include <string>
4
7
11
13
15{
16 /**
17 * @brief A base class for core segments
18 */
19 class SpecializedCoreSegment : public detail::SegmentBase<server::wm::CoreSegment>
20 {
22
23 public:
25 const std::string& defaultCoreSegmentName = "",
26 aron::type::ObjectPtr coreSegmentAronType = nullptr,
27 int defaultMaxHistorySize = 10,
28 const std::vector<PredictionEngine>& predictionEngines = {});
29
30 virtual ~SpecializedCoreSegment() override;
31
33 const std::string& prefix = "") override;
34 virtual void init() override;
35
36 /**
37 * @brief Execute function under shared (read) lock.
38 * Multiple readers can hold the lock simultaneously.
39 */
40 template <class FunctionT>
41 auto
42 doLocked(FunctionT&& function) const
43 {
44 return segmentPtr->doLocked(function);
45 }
46
47 /**
48 * @brief Execute function under exclusive (write) lock.
49 * Only one writer can hold the lock, and no readers.
50 */
51 template <class FunctionT>
52 auto
53 doLockedExclusive(FunctionT&& function)
54 {
55 return segmentPtr->doLockedExclusive(function);
56 }
57
58 void setDefaultCoreSegmentName(const std::string& coreSegmentName);
59 void setDefaultMaxHistorySize(int64_t maxHistorySize);
61 void setPredictionEngines(const std::vector<PredictionEngine>& predictionEngines);
62
64 const wm::CoreSegment& getCoreSegment() const;
65
66
67 public:
69 std::vector<PredictionEngine> predictionEngines;
70
72 {
73 std::string segmentName;
75 /// Threshold for warning about unlimited history growth (0 to disable)
77 /// Max snapshots to remove per truncate() call (0 for unlimited)
79 };
80
82 };
83} // namespace armarx::armem::server::segment
Helps connecting a Memory server to the Ice interface.
virtual void defineProperties(armarx::PropertyDefinitionsPtr defs, const std::string &prefix="") override
auto doLocked(FunctionT &&function) const
Execute function under shared (read) lock.
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={})
auto doLockedExclusive(FunctionT &&function)
Execute function under exclusive (write) lock.
void setDefaultCoreSegmentName(const std::string &coreSegmentName)
A base class for memory servers to manage their segments.
std::shared_ptr< Object > ObjectPtr
Definition Object.h:36
IceUtil::Handle< class PropertyDefinitionContainer > PropertyDefinitionsPtr
PropertyDefinitions smart pointer type.
size_t truncateMaxBatchSize
Max snapshots to remove per truncate() call (0 for unlimited)
size_t unlimitedHistoryWarningThreshold
Threshold for warning about unlimited history growth (0 to disable)