mars_lib  0.1.0.3dc76ee85e09
Modular and Robust Sensor-Fusion
buffer_entry_type.h
Go to the documentation of this file.
1 // Copyright (C) 2021 Christian Brommer, Control of Networked Systems, University of Klagenfurt, Austria.
2 //
3 // All rights reserved.
4 //
5 // This software is licensed under the terms of the BSD-2-Clause-License with
6 // no commercial use allowed, the full terms of which are made available
7 // in the LICENSE file. No license in patents is granted.
8 //
9 // You can contact the author at <christian.brommer@ieee.org>
10 
11 #ifndef BUFFERENTRYTYPE_H
12 #define BUFFERENTRYTYPE_H
13 
15 #include <mars/time.h>
17 #include <iostream>
18 #include <set>
19 
21 {
27 {
33 };
34 } // namespace BufferMetadataTypes
35 
36 namespace mars
37 {
39 
41 {
42 public:
43  Time timestamp_{ 0.0 };
45  std::shared_ptr<SensorAbsClass> sensor_handle_{ nullptr };
47 
48  BufferEntryType() = default;
49 
50  BufferEntryType(const Time& timestamp, BufferDataType data, std::shared_ptr<SensorAbsClass> sensor,
51  const int& metadata = BufferMetadataType::none);
52 
53  bool operator<(const BufferEntryType& rhs) const;
54  bool operator<=(const BufferEntryType& rhs) const;
55  bool operator>(const BufferEntryType& rhs) const;
56  bool operator>=(const BufferEntryType& rhs) const;
57  friend std::ostream& operator<<(std::ostream& out, const BufferEntryType& entry);
58 
64  static std::string get_metadata_label(int label);
65 
70  bool IsMeasurement() const;
71 
78  bool IsValid() const;
79 
84  bool IsAutoGenerated() const;
85 
92  bool HasStates() const;
93 
97  void ClearStates();
98 
99 private:
100  std::set<int> metadata_valid_filter_;
101  std::set<int> metadata_auto_filter_;
102 };
103 } // namespace mars
104 #endif // BUFFERENTRYTYPE_H
The BufferDataType binds the core and sensor state in form of a shared void pointer.
Definition: buffer_data_type.h:36
Definition: buffer_entry_type.h:41
BufferEntryType()=default
Time timestamp_
Definition: buffer_entry_type.h:43
bool operator<(const BufferEntryType &rhs) const
bool IsValid() const
IsValid Check if the entry is valid for usage.
bool operator<=(const BufferEntryType &rhs) const
std::set< int > metadata_valid_filter_
Definition: buffer_entry_type.h:100
bool HasStates() const
HasState checks if the BufferDataType has a (core) state.
BufferDataType data_
Definition: buffer_entry_type.h:44
BufferEntryType(const Time &timestamp, BufferDataType data, std::shared_ptr< SensorAbsClass > sensor, const int &metadata=BufferMetadataType::none)
int metadata_
Definition: buffer_entry_type.h:46
friend std::ostream & operator<<(std::ostream &out, const BufferEntryType &entry)
bool IsAutoGenerated() const
IsAutoGenerated.
void ClearStates()
ClearStates resets states of the buffer entry.
bool operator>(const BufferEntryType &rhs) const
static std::string get_metadata_label(int label)
get_metadata_label decodes the 'BufferMetadataType' enum to strings
bool IsMeasurement() const
IsMeasurement.
std::shared_ptr< SensorAbsClass > sensor_handle_
Definition: buffer_entry_type.h:45
bool operator>=(const BufferEntryType &rhs) const
std::set< int > metadata_auto_filter_
Definition: buffer_entry_type.h:101
Definition: time.h:20
Definition: buffer_entry_type.h:21
BufferMetadataType
Possible metadata states.
Definition: buffer_entry_type.h:27
@ none
Definition: buffer_entry_type.h:28
@ out_of_order
Definition: buffer_entry_type.h:31
@ invalid
Definition: buffer_entry_type.h:29
@ init
Definition: buffer_entry_type.h:30
@ auto_add
auto generated measurement e.g. introduced by interpolation
Definition: buffer_entry_type.h:32
Definition: buffer.h:27