Class IProcessor¶
Defined in File iprocessor.hpp
Class Documentation¶
-
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()¶
Protected Functions
-
void create_file(std::string prefix, std::string variable_name, std::string extension = "bin")¶
-
void prepare_latency_test(ProcessingContext &context)¶
-
void save_source_timestamps_to_disk(std::uint64_t n_timestamps)¶
-
template<typename TValue>
inline void add_option(std::string name, TValue &value, std::string description = "", bool required = false)¶ Add an option to the processor.
A static state can only be read by the owning processor. If
shared
is true, then the state can be read by other processors as well (if their states are connected). Otherwise, a non-shared static state is created that is not accessible from other processors. The main use of static states is to expose the state value to clients by setting theexternal
permissions toPermission::READ
orPermission::WRITE
.- Template Parameters
TValue – The type of the option value.
- Parameters
name – The name of the option that is unique within the processor.
value – A reference to the linked Value object (should be derived from ValueBase).
description – A brief description of the option.
required – Makes it a required option that clients need to specify in the graph definition
-
void remove_option(std::string name)¶
Remove an existing processor option.
- Parameters
name – The name of the existing option.
-
template<typename DATATYPE>
inline PortOut<DATATYPE> *create_output_port(std::string name, const typename DATATYPE::Capabilities &capabilities, const typename DATATYPE::Parameters ¶meters, const PortOutPolicy &policy)¶ Create an data output port on the processor.
- Template Parameters
DATATYPE – The type of data that will be streamed through the port.
- Parameters
capabilities – The data type specific capabilities of the port.
parameters – The data type specific parameters of the port.
policy – The output port policy.
- Returns
An observing pointer to the output port.
-
template<typename DATATYPE>
inline PortOut<DATATYPE> *create_output_port(const typename DATATYPE::Capabilities &capabilities, const typename DATATYPE::Parameters ¶meters, const PortOutPolicy &policy)¶ Create an output port on the processor.
The port name is set to the default data type name.
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
-
template<typename DATATYPE>
inline PortIn<DATATYPE> *create_input_port(std::string name, const typename DATATYPE::Capabilities &capabilities, const PortInPolicy &policy)¶ Create an data input port on the processor.
- Template Parameters
DATATYPE – The type of data that will be streamed through the port.
- Parameters
capabilities – The data type specific capabilities of the port.
policy – The input port policy.
- Returns
An observing pointer to the input port.
-
template<typename DATATYPE>
inline PortIn<DATATYPE> *create_input_port(const typename DATATYPE::Capabilities &capabilities, const PortInPolicy &policy)¶ Create an input port on the processor.
The port name is set to the default data type name.
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
-
inline IPortIn *input_port(std::string port)¶
Retrieve observing pointer to input port.
- Parameters
port – The name of the input port.
-
inline IPortOut *output_port(std::string port)¶
Retrieve observing pointer to output port.
- Parameters
port – The name of the output port.
-
IPortIn *input_port(const PortAddress &address)¶
Retrieve observing pointer to input port.
- Parameters
port – The address of the input port.
-
IPortOut *output_port(const PortAddress &address)¶
Retrieve observing pointer to output port.
- Parameters
port – The address of the output port.
-
ISlotIn *input_slot(const SlotAddress &address)¶
Retrieve observing pointer to input slot.
- Parameters
port – The address of the input slot.
-
ISlotOut *output_slot(const SlotAddress &address)¶
Retrieve observing pointer to output slot.
- Parameters
port – The address of the output slot.
-
template<typename T>
inline StaticState<T> *create_static_state(std::string state, T default_value, bool shared = true, Permission external = Permission::WRITE, std::string description = "")¶ Create a static state on the processor.
A static state can only be read by the owning processor. If
shared
is true, then the state can be read by other processors as well (if their states are connected). Otherwise, a non-shared static state is created that is not accessible from other processors. The main use of static states is to expose the state value to clients by setting theexternal
permissions toPermission::READ
orPermission::WRITE
.- Template Parameters
T – The type of the state value.
- Parameters
state – The name of the state that is unique within the processor.
default_value – The initial value of the state.
cooperative – Creates a cooperative or isolated producer state.
external – The external read/write permissions.
description – A brief description of the state’s purpose.
- Returns
An observing pointer to the static state.
-
template<typename T>
inline ProducerState<T> *create_producer_state(std::string state, T default_value, bool cooperative = false, Permission external = Permission::READ, std::string description = "")¶ Create a producer state on the processor.
A producer state can be written by the owning processor. If
cooperative
is true, then the state can be written to by other processors as well (if their states are connected). Otherwise, an isolated producer is created that is not accessible from other processors. The main use of isolated producers is to expose the state value to clients by setting theexternal
permissions toPermission::READ
orPermission::WRITE
.- Template Parameters
T – The type of the state value.
- Parameters
state – The name of the state that is unique within the processor.
default_value – The initial value of the state.
cooperative – Creates a cooperative or isolated producer state.
external – The external read/write permissions.
description – A brief description of the state’s purpose.
- Returns
An observing pointer to the producer state.
-
template<typename T>
inline BroadcasterState<T> *create_broadcaster_state(std::string state, T default_value, Permission external = Permission::NONE, std::string description = "")¶ Create a broadcaster state on the processor.
A broadcaster state can be written by the owning processor and can only be read by other processors (if their states are connected). If
external
permissions are set toPermission::READ
orPermission::WRITE
, then the state value can also accessed by clients.- Template Parameters
T – The type of the state value.
- Parameters
state – The name of the state that is unique within the processor.
default_value – The initial value of the state.
external – The external read/write permissions.
description – A brief description of the state’s purpose.
- Returns
An observing pointer to the broadcaster state.
-
template<typename T>
inline FollowerState<T> *create_follower_state(std::string state, T default_value, Permission external = Permission::NONE, std::string description = "")¶ Create a follower state on the processor.
A follower state can only be read the owning processor and can be written to by other processors (if their states are connected). The initial value of the state is only used if the state is not connected to any other state. If
external
permissions are set toPermission::READ
orPermission::WRITE
, then the state value can also accessed by clients.- Template Parameters
T – The type of the state value.
- Parameters
state – The name of the state that is unique within the processor.
default_value – The initial value of the state.
external – The external read/write permissions.
description – A brief description of the state’s purpose.
- Returns
An observing pointer to the follower state.
Create a readable shared state on the processor.
A readable state can only be read the owning processor. Access permissions for other processors (if their states are linked) and clients can be set by the
peers
andexternal
parameters.- Template Parameters
T – The type of the state value.
- Parameters
state – The name of the state that is unique within the processor.
default_value – The initial value of the state.
peers – The state access permissions for other processors.
external – The external read/write permissions.
description – A brief description of the state’s purpose.
- Returns
An observing pointer to the readable state.
Create a writable shared state on the processor.
A writable state can be written to by the owning processor. Access permissions for other processors (if their states are linked) and clients can be set by the
peers
andexternal
parameters.- Template Parameters
T – The type of the state value.
- Parameters
state – The name of the state that is unique within the processor.
default_value – The initial value of the state.
peers – The state access permissions for other processors.
external – The external read/write permissions.
description – A brief description of the state’s purpose.
- Returns
An observing pointer to the writable state.
Retrieve a pointer to a state.
- Parameters
state – The name of the state.
-
template<class T>
inline void expose_method(std::string methodname, YAML::Node (T::* method)(const YAML::Node&))¶
-
inline std::function<YAML::Node(const YAML::Node&)> &exposed_method(std::string method)¶
-
virtual std::string default_input_port() const¶
-
virtual std::string default_output_port() const¶
Protected Attributes
-
std::map<std::string, std::shared_ptr<std::ostream>> streams_¶
-
options::OptionList options_¶
-
options::OptionList advanced_options_¶
Friends
- friend class graph::ProcessorGraph
-
inline IProcessor(ThreadPriority priority = PRIORITY_NONE)¶