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

Description

Context for enabling access to objects after they have been incorporated into a processing graph.

Instances are nonmovable and must be handled by std::shared_ptr.

A context mediates external access to the state of individual objects (typically processors) within the processing graph. This is done by means of a tcspc::access_tracker object that is obtained from the context and embedded into the object. The tracker moves and is destroyed together with the tracked object, allowing the context to track how to access the object after being moved into the processing graph.

A name is associated with each tracked object. The name must be unique within a given context (and may not be reused even after destroying the corresponding tracker).

Actual access to object state is through an accessor whose type is defined by the object and whose instances can be obtained from the context by name.

Inherits std::enable_shared_from_this< context >.

Public Member Functions

template<typename Accessor>
auto access (std::string const &name) -> Accessor
 Obtain an accessor for the named object.
template<typename Accessor>
auto tracker (std::string name) -> access_tracker< Accessor >
 Obtain a tracker for an object with the given name.

Static Public Member Functions

static auto create () -> std::shared_ptr< context >
 Create an instance.

Friends

template<typename Accessor>
class access_tracker

Member Function Documentation

◆ access()

template<typename Accessor>
auto tcspc::context::access ( std::string const & name) -> Accessor
inline

Obtain an accessor for the named object.

Attention
The returned accessor becomes invalid if the object to which it refers is moved or destroyed. Do not store accessor instances.
Template Parameters
Accessorthe accessor type
Parameters
namethe name identifying the tracked object

◆ tracker()

template<typename Accessor>
auto tcspc::context::tracker ( std::string name) -> access_tracker< Accessor >
inline

Obtain a tracker for an object with the given name.

Template Parameters
Accessorthe object's accessor type
Parameters
namename to assign to the tracked object
Returns
tracker to be stored in the object

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