libtcspc C++ API
Streaming TCSPC and time tag data processing
Loading...
Searching...
No Matches
Context

Description

Mechanism providing access to objects (especially processors) after they have been incorporated into a processing graph.

From the viewpoint of user code, this works as follows:

  1. Create a tcspc::context.
  2. Build the processing graph. Some processors (and auxiliary objects) require a tcspc::access_tracker; obtain trackers from the context (specifying a uniquely identifying name).
  3. The processors and other objects, having been moved into the graph, are not directly accessible. However, corresponding access objects can be obtained from the context by name.

From the viewpoint of the object that provides access through the context, this works as follows:

  1. On construction, the object receives a tcspc::access_tracker (a movable but noncopyable object) and stores it in a data member.
  2. Also during construction, the object calls the tracker's tcspc::access_tracker::register_access_factory() member function, passing the access factory, which is a function (usually a lambda) taking a reference to the tracker and returning an accessor.
  3. The tracker stored in the member variable tracks the object as it is moved or destroyed, updating the associated context's mapping from name to tracker address.
  4. When user code retrieves an accessor from the context, the access factory is called with a reference to the (potentially moved) tracker. The access factory usually converts this to a reference (address) to the object, and returns an accessor object holding a reference to the object.

The macro LIBTCSPC_OBJECT_FROM_TRACKER() can be used by access factories to obtain the address of an object holding a tracker in a data member.

Topics

 Accessor types
 Objects providing access via context.

Classes

class  tcspc::access_tracker< Access >
 Tracker that mediates access to objects via a tcspc::context. More...
class  tcspc::context
 Context for enabling access to objects after they have been incorporated into a processing graph. More...

Macros

#define LIBTCSPC_OBJECT_FROM_TRACKER(obj_type, tracker_field_name, tracker)
 Recover the object address from a tcspc::access_tracker embedded in the object.

Macro Definition Documentation

◆ LIBTCSPC_OBJECT_FROM_TRACKER

#define LIBTCSPC_OBJECT_FROM_TRACKER ( obj_type,
tracker_field_name,
tracker )

Recover the object address from a tcspc::access_tracker embedded in the object.

This can be used in the implementation of an access factory (see tcspc::access_tracker::register_access_factory()).

Parameters
obj_typeobject type (no commas or angle brackets)
tracker_field_namename of data member of obj_type holding the tracker
trackerthe tracker (must be lvalue)
Returns
pointer to the object