MaxHistorySize.h
Go to the documentation of this file.
1 #pragma once
2 
4 {
5  // TODO: Replace by ConstrainedHistorySize (not only max entries, e.g. delete oldest / delete least accessed / ...)
6 
8  {
9  public:
10 
11  /**
12  * @brief Set the maximum number of snapshots to be contained in an entity.
13  * Affected entities are to be update right away.
14  */
15  void setMaxHistorySize(long maxSize, const std::string& additionalInfo = "");
16 
17  long getMaxHistorySize() const;
18 
19 
20  protected:
21 
22  /**
23  * @brief Maximum size of entity histories.
24  *
25  * If negative, the size of `history` is not limited.
26  *
27  * @see Entity::maxHstorySize
28  */
29  long _maxHistorySize = -1;
30 
31  };
32 
33 
34 
35  template <class DerivedT>
37  {
38  public:
39 
40  /**
41  * @brief Sets the maximum history size of entities in this container.
42  * This affects all current entities as well as new ones.
43  *
44  * @see MaxHistorySize::setMaxHistorySize()
45  */
46  void setMaxHistorySize(long maxSize)
47  {
49  static_cast<DerivedT&>(*this).forEachChild([maxSize](auto & child)
50  {
51  child.setMaxHistorySize(maxSize);
52  });
53  }
54 
55  };
56 }
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::wm::detail
Definition: MaxHistorySize.cpp:6
armarx::armem::server::wm::detail::MaxHistorySize::_maxHistorySize
long _maxHistorySize
Maximum size of entity histories.
Definition: MaxHistorySize.h:29
armarx::armem::server::wm::detail::MaxHistorySizeParent
Definition: MaxHistorySize.h:36
armarx::armem::server::wm::detail::MaxHistorySize::getMaxHistorySize
long getMaxHistorySize() const
Definition: MaxHistorySize.cpp:26
armarx::armem::server::wm::detail::MaxHistorySize
Definition: MaxHistorySize.h:7
armarx::armem::server::wm::detail::MaxHistorySize::setMaxHistorySize
void setMaxHistorySize(long maxSize, const std::string &additionalInfo="")
Set the maximum number of snapshots to be contained in an entity.
Definition: MaxHistorySize.cpp:8