OpenDDS
Snapshot(2023/04/07-19:43)
|
#include <DataCollector_T.h>
Public Types | |
enum | OnFull { KeepOldest, KeepNewest, Unbounded } |
Selectors for behavior when buffer fills. More... | |
Public Member Functions | |
DataCollector (unsigned int bound=0, OnFull onFull=KeepOldest) | |
virtual | ~DataCollector () |
Allow the class to be extended. More... | |
void | collect (const DatumType &datum) |
Implement data collection. More... | |
unsigned int | size () const |
Amount of data actually stored. More... | |
DataCollector< DatumType > & | operator<< (DatumType datum) |
std::ostream & | insert (std::ostream &str) const |
Implement insertion of collected data onto an ostream. More... | |
Private Member Functions | |
OPENDDS_VECTOR (DatumType) buffer_ | |
The collected data goes here. More... | |
Private Attributes | |
unsigned int | writeAt_ |
Where to write the next datum collected. More... | |
unsigned int | bound_ |
Total or initial capacity of buffer. More... | |
bool | full_ |
OnFull | onFull_ |
Selector for behavior when buffer fills. More... | |
Definition at line 37 of file DataCollector_T.h.
enum OpenDDS::DCPS::DataCollector::OnFull |
Selectors for behavior when buffer fills.
Enumerator | |
---|---|
KeepOldest | |
KeepNewest | |
Unbounded |
Definition at line 40 of file DataCollector_T.h.
ACE_INLINE OpenDDS::DCPS::DataCollector< DatumType >::DataCollector | ( | unsigned int | bound = 0 , |
OnFull | onFull = KeepOldest |
||
) |
Construct with optional buffer size and full behavior.
bound | - amount of data to store or reserve as buffer. |
onFull | - behavior of collector when bound is reached. |
OnFull == KeepOldest: The buffer is limited to the amount of data specified by the bound parameter and only the data collected first is retained. OnFull == KeepNewest: The buffer is limited to the amount of data specified by the bound parameter and only the most recently collected data is retained. OnFull == Unbounded: The buffer contains all collected data and the bound parameter is used as an initial reservation amount.
Collection is either bounded or unbounded. In the case of a bounded collection, either the first data collected or the most recent data collected is retained. When an unbounded collection is specified, then the bound parameter is used as a capacity hint and that amount of data is reserved initially.
Definition at line 26 of file DataCollector_T.inl.
|
virtual |
void OpenDDS::DCPS::DataCollector< DatumType >::collect | ( | const DatumType & | datum | ) |
Implement data collection.
Definition at line 27 of file DataCollector_T.cpp.
std::ostream & OpenDDS::DCPS::DataCollector< DatumType >::insert | ( | std::ostream & | str | ) | const |
Implement insertion of collected data onto an ostream.
Definition at line 64 of file DataCollector_T.cpp.
|
private |
The collected data goes here.
ACE_INLINE DataCollector< DatumType > & OpenDDS::DCPS::DataCollector< DatumType >::operator<< | ( | DatumType | datum | ) |
Convenience operator for collecting data by inserting it into the collector.
Definition at line 42 of file DataCollector_T.inl.
unsigned int OpenDDS::DCPS::DataCollector< DatumType >::size | ( | void | ) | const |
Amount of data actually stored.
Definition at line 52 of file DataCollector_T.cpp.
Referenced by OpenDDS::DCPS::WriterStats::raw_data().
|
private |
Total or initial capacity of buffer.
Definition at line 93 of file DataCollector_T.h.
|
private |
Flag indicating that we have collected as much or more data than we can store.
Definition at line 97 of file DataCollector_T.h.
|
private |
Selector for behavior when buffer fills.
Definition at line 100 of file DataCollector_T.h.
|
private |
Where to write the next datum collected.
Definition at line 90 of file DataCollector_T.h.