Graph API

Context


class RunContext : public StorageContext

Public Functions

inline RunContext(GlobalContext &context, std::atomic<bool> &terminate_signal, std::string run_group_id, std::string run_id, std::string template_id, bool test_flag)
inline GlobalContext &global()
inline bool terminated() const
inline void Terminate()
inline void TerminateWithError(std::string processor_name, std::string step, std::string error_message)
inline TimePoint start_time() const
inline TimePoint stop_time() const
inline int minutes() const
inline int seconds() const
inline std::string error_message()
inline bool error()
inline std::string run_group_id() const
inline std::string run_id() const
inline std::string template_id() const
inline bool test() const

Friends

friend class graph::ProcessorGraph
friend class IProcessor
class ProcessingContext : public StorageContext

Public Functions

inline ProcessingContext(RunContext &context, std::string processor_name, bool test)
inline RunContext &run()
inline bool test() const
inline bool terminated() const
inline void Terminate()
inline void TerminateWithError(std::string step, std::string error_message)

Processor


class IProcessor

Public Functions

inline IProcessor(ThreadPriority priority = PRIORITY_NONE)
inline virtual ~IProcessor()
inline const std::string name() const

Get processor’s name.

The processor’s name is set during the graph build phase after construction.

inline const std::string type() const

Get processor’s class name.

The processor’s class name is set during the graph build phase after construction.

inline unsigned int n_input_ports() const

Get number of input ports on the processor.

inline unsigned int n_output_ports() const

Get number of output ports on the processor.

const std::set<std::string> input_port_names() const

Get set of all input port names.

const std::set<std::string> output_port_names() const

Get set of all output port names.

inline bool has_input_port(std::string port)

Check if input port with given name exists.

Parameters

port – The name of the port.

inline bool has_output_port(std::string port)

Check if output port with given name exists.

Parameters

port – The name of the port.

inline virtual bool issource() const
inline virtual bool issink() const
inline virtual bool isfilter() const
inline virtual bool isautonomous() const
inline ThreadPriority thread_priority() const
inline ThreadCore thread_core() const
inline bool running() const
YAML::Node ExportYAML()

Friends

friend class graph::ProcessorGraph

Datatype


namespace nsAnyType
class Capabilities
#include <idata.hpp>

The datatype capabilities is used to restrict the data object parameterizations that an input port on a processor can handle.

Public Functions

inline void Validate(const Data &prototype) const

Validate method is used to validate incoming data objects against the capabilities. Capabilities are defined at the level of input ports and all slots on a port share the same capabilities.

Parameters

prototype

class Data : public IData<Data, BaseType>

Public Functions

inline Data()
inline virtual ~Data()
inline virtual void ClearData()

ClearData class is called each time a data packet is claimed on the output port.

uint64_t serial_number() const
void set_serial_number(uint64_t n)
void set_source_timestamp()

set_source_timestamp set the timepoint based on the internal Falcon clock.

void set_source_timestamp(TimePoint t)

set_source_timestamp set a given timepoint.

Parameters

t

TimePoint source_timestamp() const

source_timestamp getter for the source_timestamp_. This timestamp is set by the internal Falcon clock.

Returns

TimePoint

template<typename DURATION = std::chrono::microseconds>
inline DURATION time_passed() const

Compute the duration since the timestamp has been set. The default unit is in microseconds but can be changed based on the template.

template<typename DURATION = std::chrono::microseconds>
inline DURATION time_since(TimePoint reference) const

Compute the duration since the given reference. The default unit is in microseconds but can be changed based on the template.

Parameters

reference – selected timepoint

uint64_t hardware_timestamp() const

hardware_timestamp timestamp given by the hardware. The unit depends on the hardware.

Returns

void set_hardware_timestamp(uint64_t t)
void CloneTimestamps(const Data &data)

CloneTimestamps - copy timestamps from one packet to the other.

Parameters

data

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 described in YAMLDescription. At this level, only serialize the source timestamp, hardware timestamp and serial number.

Parameters
  • stream – binary stream where to add the data

  • format – Compact or Full

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 described in YAMLDescription. At this level, only serialize the source timestamp duration, hardware timestamp and serial number.

Parameters
  • node – yaml node where to add the data

  • format – compact or full

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 yaml and binary serialization.

At this level add the source timestamp duration, hardware timestamp and serial number format description.

Parameters
  • node – - data node where to add a list of data element with the type and the size

  • format – compact or full

virtual void SerializeFlatBuffer(flexbuffers::Builder &flex_builder)

SerializeFlatBuffer - Serialize with a flexbuffer the data specific for each datatype.

At this level add the source timestamp duration, hardware timestamp and serial number format description.

Parameters

flex_builder – flexbuffer builder

Public Static Functions

static inline const std::string static_datatype()

datatype

Returns

name of the datatype

static inline const std::string static_dataname()

dataname

Returns

label for the data

struct Parameters
#include <idata.hpp>

The Parameters structure is a container for parameters used to initialize data object and provide an additional control over the stored data.

The parameterization is applied at the level of output ports, but parameters can be customized for each slot. The parameters are set during construction of the data objects.

Note

Parameters cannot be set for input ports because they receive whatever is streamed from the upstream output port.


Shared states, atomic variables


class IState

Subclassed by StateCloneable< IState, ReadableState< T > >

Public Functions

IState(const Permissions &permissions, std::string description = "")
IState(const IState &other)
inline virtual ~IState()
virtual IState *clone() const = 0
bool IsCompatible(const Permissions &permissions)
const Permissions &permissions() const
Permission external_permission()
std::string description()
virtual std::string get_string(bool cache = true) = 0

Friends

friend class graph::ProcessorGraph
template<typename T>
class ReadableState : public StateCloneable<IState, ReadableState<T>>

Subclassed by WritableState< T >

Public Functions

inline ReadableState(T default_value, std::string description = "", Permission peers = Permission::WRITE, Permission external = Permission::NONE)
inline ReadableState(const ReadableState &other)
inline T get(bool cache = true)
inline bool changed_get(T &val, bool cache = true)
inline virtual std::string get_string(bool cache = true) override
template<typename T>
class WritableState : public ReadableState<T>

Public Functions

inline WritableState(T default_value, std::string description = "", Permission peers = Permission::READ, Permission external = Permission::NONE)
inline void set(T value, bool cache = true)
inline T exchange(T value, bool cache = true)
inline virtual bool set_string(const std::string &value, bool cache = true) override
inline void reset()