libtcspc C++ API
Streaming TCSPC and time tag data processing
Loading...
Searching...
No Matches
tcspc::processor_graph Class Reference

Description

Value type representing a directed acyclic graph of processors.

Each processor implements a member function auto introspect_graph() const -> processor_graph that returns an instance representing that processor and all of its downstream nodes.

The graph includes the notion of entry points in addition to nodes and (directed) edges. The entry points are the upstream-most processors represented in the graph.

The graph and its nodes are pure data types, so that they remain valid even after the processors from which they were constructed are moved or destroyed.

Public Member Functions

auto edges () const -> std::vector< std::pair< processor_node_id, processor_node_id > >
 Return all of the edges of this graph.
auto entry_points () const -> std::vector< processor_node_id >
 Return all of the entry points of this graph.
auto is_entry_point (processor_node_id id) const -> bool
 Return whether the given node is an entry point of this graph.
auto node_index (processor_node_id id) const -> std::size_t
 Return the numerical index of the given node in this graph.
auto node_info (processor_node_id id) const -> processor_info
 Return metadata for the processor represented by the given node.
auto nodes () const -> std::vector< processor_node_id >
 Return all of the nodes of this graph.
template<typename Processor>
auto push_entry_point (Processor const *processor) -> processor_graph &
 Add a processor node to this graph, upstream of the current entry point (if any), making it the new entry point.

Friends

auto merge_processor_graphs (processor_graph const &a, processor_graph const &b) -> processor_graph
 Create a new processor graph by merging two existing ones.

Member Function Documentation

◆ edges()

auto tcspc::processor_graph::edges ( ) const -> std::vector< std::pair< processor_node_id, processor_node_id > >
inlinenodiscard

Return all of the edges of this graph.

Each edge is a pair (source, destination).

Returns
edges, sorted in ascending order

◆ entry_points()

auto tcspc::processor_graph::entry_points ( ) const -> std::vector< processor_node_id >
inlinenodiscard

Return all of the entry points of this graph.

Returns
entry point node ids, sorted in ascending order.

◆ is_entry_point()

auto tcspc::processor_graph::is_entry_point ( processor_node_id id) const -> bool
inlinenodiscard

Return whether the given node is an entry point of this graph.

Parameters
idthe node id
Returns
true if id is an entry point of this graph

◆ node_index()

auto tcspc::processor_graph::node_index ( processor_node_id id) const -> std::size_t
inlinenodiscard

Return the numerical index of the given node in this graph.

The returned index maps bijectively to the node id within the context of this graph, so long as the graph is not modified.

Parameters
ida node id in this graph
Returns
integer index of the node

◆ node_info()

auto tcspc::processor_graph::node_info ( processor_node_id id) const -> processor_info
inlinenodiscard

Return metadata for the processor represented by the given node.

Parameters
ida node in this graph
Returns
processor metadata

◆ nodes()

auto tcspc::processor_graph::nodes ( ) const -> std::vector< processor_node_id >
inlinenodiscard

Return all of the nodes of this graph.

Returns
node ids, sorted in ascending order

◆ push_entry_point()

template<typename Processor>
auto tcspc::processor_graph::push_entry_point ( Processor const * processor) -> processor_graph &
inline

Add a processor node to this graph, upstream of the current entry point (if any), making it the new entry point.

Precondition
The graph must have no more than one entry point. The processor must not already be part of the graph.
Postcondition
A new node is added to the graph, representing the given processor, and made the sole entry point. If there was a previous entry point, an edge is added to the graph from the new node to the previous entry point.
Template Parameters
Processorprocessor type (usually deduced)
Parameters
processorpointer to the processor
Returns
a reference to this graph

◆ merge_processor_graphs

auto merge_processor_graphs ( processor_graph const & a,
processor_graph const & b ) -> processor_graph
friend

Create a new processor graph by merging two existing ones.

The resulting graph contains all of the nodes and edges of a and b. Its entry points are the union of the entry points of a and b.

Parameters
athe first processor graph to merge
bthe second processor graph to merge
Returns
the merged processor graph

The documentation for this class was generated from the following file: