DataCollector_T.h
Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008 #ifndef DATA_COLLECTOR_H
00009 #define DATA_COLLECTOR_H
00010
00011
00012 #include "ace/pre.h"
00013 #include "ace/config-all.h"
00014
00015 #if !defined (ACE_LACKS_PRAGMA_ONCE)
00016 #pragma once
00017 #endif
00018
00019 #include "dds/DCPS/PoolAllocator.h"
00020 #include "dds/DCPS/SafetyProfileStreams.h"
00021
00022 OPENDDS_BEGIN_VERSIONED_NAMESPACE_DECL
00023
00024 namespace OpenDDS {
00025 namespace DCPS {
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036 template<typename DatumType>
00037 class DataCollector {
00038 public:
00039
00040 enum OnFull { KeepOldest, KeepNewest, Unbounded};
00041
00042
00043
00044
00045
00046
00047
00048
00049
00050
00051
00052
00053
00054
00055
00056
00057
00058
00059
00060
00061
00062
00063
00064
00065 DataCollector(unsigned int bound = 0, OnFull onFull = KeepOldest);
00066
00067
00068 virtual ~DataCollector();
00069
00070
00071 void collect(const DatumType& datum);
00072
00073
00074 unsigned int size() const;
00075
00076 #ifndef OPENDDS_SAFETY_PROFILE
00077
00078
00079 DataCollector<DatumType>& operator<<(DatumType datum);
00080
00081
00082 std::ostream& insert(std::ostream& str) const;
00083 #endif //OPENDDS_SAFETY_PROFILE
00084
00085 private:
00086
00087 OPENDDS_VECTOR(DatumType) buffer_;
00088
00089
00090 unsigned int writeAt_;
00091
00092
00093 unsigned int bound_;
00094
00095
00096
00097 bool full_;
00098
00099
00100 OnFull onFull_;
00101 };
00102
00103 #ifndef OPENDDS_SAFETY_PROFILE
00104
00105 template<typename DatumType>
00106 std::ostream& operator<<(
00107 std::ostream& str,
00108 const DataCollector<DatumType>& value);
00109 #endif //OPENDDS_SAFETY_PROFILE
00110
00111 }
00112 }
00113
00114
00115 OPENDDS_END_VERSIONED_NAMESPACE_DECL
00116
00117 #if defined (__ACE_INLINE__)
00118 #include "DataCollector_T.inl"
00119 #endif
00120
00121 #if defined (ACE_TEMPLATES_REQUIRE_SOURCE)
00122 #include "DataCollector_T.cpp"
00123 #endif
00124
00125 #if defined (ACE_TEMPLATES_REQUIRE_PRAGMA)
00126 #pragma implementation ("DataCollector_T.cpp")
00127 #endif
00128
00129 #include "ace/post.h"
00130
00131 #endif