30#include "ringbuffer.hpp"
32#include "datatype_generated.h"
33#include "flatbuffers/flatbuffers.h"
34#include "flatbuffers/flexbuffers.h"
35#include "logging/log.hpp"
36#include "serialization.hpp"
37#include "utilities/string.hpp"
38#include "utilities/time.hpp"
39#include "yaml-cpp/yaml.h"
51 static bool ispure() {
return true; }
73template <
typename DATA,
typename BASETYPE,
bool pure =
false,
74 typename CAPS =
typename DATA::Capabilities,
typename PARAMS =
typename DATA::Parameters>
77 static const std::string datatype() {
return DATA::static_datatype(); }
78 static const std::string dataname() {
return DATA::static_dataname(); }
80 static bool ispure() {
return pure && BASETYPE::ispure(); }
83 using Parameters = PARAMS;
84 using Capabilities = CAPS;
85 using Base = BASETYPE;
94template <
typename T,
typename BASETYPE>
95class IData :
public BASETYPE::Data {
97 using Base =
typename BASETYPE::Data;
101 virtual std::string datatype()
const {
return T::static_datatype(); }
102 virtual std::string dataname()
const {
return T::static_dataname(); }
129class Data :
public IData<Data, BaseType> {
152 uint64_t serial_number()
const;
153 void set_serial_number(uint64_t n);
199 template <
typename DURATION = std::chrono::microseconds>
201 return std::chrono::duration_cast<DURATION>(Clock::now() - source_timestamp_);
211 template <
typename DURATION = std::chrono::microseconds>
213 return std::chrono::duration_cast<DURATION>(Clock::now() - reference);
222 void set_hardware_timestamp(uint64_t t);
239 virtual void SerializeBinary(std::ostream& stream, Serialization::Format format)
const;
256 virtual void SerializeYAML(YAML::Node& node, Serialization::Format format)
const;
269 virtual void YAMLDescription(YAML::Node& node, Serialization::Format format)
const;
288 TimePoint source_timestamp_;
289 uint64_t hardware_timestamp_;
290 uint64_t serial_number_;
The base class of AnyType::Data.
Definition idata.hpp:44
The parent data type of AnyType.
Definition idata.hpp:49
Convenient template class to define data types.
Definition idata.hpp:75
Base class of all data object classes.
Definition idata.hpp:95
The datatype capabilities is used to restrict the data object parameterizations that an input port on...
Definition idata.hpp:298
void Validate(const Data &_) const
Validate method is used to validate incoming data objects against the capabilities....
Definition idata.hpp:307
int64_t ingestion_tsc_
CPU timestamp counter when the data packet was first ingested by Falcon.
Definition idata.hpp:287
virtual void YAMLDescription(YAML::Node &node, Serialization::Format format) const
YAMLDescription - Add the datatype metadata (list of data with type and size) to the header used for ...
Definition idata.cpp:102
void set_source_timestamp()
set_source_timestamp set the timepoint based on the internal Falcon clock.
Definition idata.cpp:44
virtual std::string_view serialized_type_name() const
Identifies the underlying dynamic type for binary serialization.
Definition idata.hpp:245
static const std::string static_datatype()
datatype
Definition idata.hpp:138
uint64_t hardware_timestamp() const
hardware_timestamp timestamp given by the hardware. The unit depends on the hardware.
Definition idata.cpp:56
virtual void SerializeYAML(YAML::Node &node, Serialization::Format format) const
SerializeYAML - Serialize data specific for the data type in yaml form according to the layout descri...
Definition idata.cpp:89
DURATION time_since(TimePoint reference) const
Definition idata.hpp:212
DURATION time_passed() const
Definition idata.hpp:200
void CloneTimestamps(const Data &data)
CloneTimestamps - copy timestamps from one packet to the other.
Definition idata.cpp:64
void forward_ingestion_tsc(const Data &data)
Forward the ingestion timestamp from an upstream data packet to this data packet.
Definition idata.cpp:40
static const std::string static_dataname()
dataname
Definition idata.hpp:143
virtual void ClearData()
ClearData class is called each time a data packet is claimed on the output port.
Definition idata.hpp:150
TimePoint source_timestamp() const
source_timestamp getter for the source_timestamp_. This timestamp is set by the internal Falcon clock...
Definition idata.cpp:52
virtual void SerializeBinary(std::ostream &stream, Serialization::Format format) const
SerializeBinary - Serialize data specific for the data type in binary form according to the layout de...
Definition idata.cpp:69
int64_t ingestion_tsc() const
This timestamp is set when the data packet is first ingested by Falcon.
Definition idata.cpp:32
void set_ingestion_tsc()
Set the ingestion timestamp to now. This should only be called by a "source" processor when the data ...
Definition idata.cpp:36
virtual void SerializeFlatBuffer(flexbuffers::Builder &flex_builder)
SerializeFlatBuffer - Serialize with a flexbuffer the data specific for each datatype.
Definition idata.cpp:112
The Parameters structure is a container for parameters used to initialize data object and provide an ...
Definition idata.hpp:119