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 access object 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 Access>
auto access (std::string const &name) -> Access
 Obtain an access for the named object.
template<typename Access>
auto tracker (std::string name) -> access_tracker< Access >
 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 Access>
class access_tracker

Member Function Documentation

◆ access()

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

Obtain an access for the named object.

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

◆ tracker()

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

Obtain a tracker for an object with the given name.

Template Parameters
Accessthe object's access 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: