carb::tasking::Tracker

Defined in carb/tasking/TaskingHelpers.h

struct Tracker : public carb::tasking::Object

Helper class to provide correct types to the Trackers class.

The following types are valid trackers:

  • Anything convertible to Counter*, such as CounterWrapper. Counters are deprecated however. The Counter is incremented before the task can possibly begin executing and decremented when the task finishes.

  • Future<void>&: This can be used to atomically populate a Future<void> before the task could possibly start executing.

  • Future<void>*: Can be nullptr, but if not, can be used to atomically populate a Future<void> before the task could possibly start executing.

  • TaskContext&: By providing a reference to a TaskContext it will be atomically filled before the task could possibly begin executing.

  • TaskContext*: By providing a pointer to a TaskContext (that can be nullptr), it will be atomically filled before the task could possibly begin executing, if valid.

Public Functions

inline constexpr Tracker(std::nullptr_t)

Constructor that accepts a std::nullptr_t.

template<class T, std::enable_if_t<std::is_convertible<T, Counter*>::value, bool> = false>
inline constexpr Tracker(T &&c)

Constructor that accepts a Counter* or an object convertible to Counter*, such as CounterWrapper.

Parameters

c – The object convertible to Counter*.

template<class T, std::enable_if_t<std::is_convertible<T, const char*>::value, bool> = false>
inline constexpr Tracker(T &&name)

Constructor that accepts a task name.

See also

ITasking::nameTask()

Note

This is not a Tracker per se; this is syntactic sugar to name a task as it is created.

Template Parameters

T – A type that is convertible to const char*.

Parameters

name – Either a const char* (dynamic string) or a const char (&)[N] (literal string) as the string name for a task.

inline Tracker(Future<> &fut)

Constructor that accepts a Future<void>&.

The Future will be initialized before the task can begin.

inline Tracker(Future<> *fut)

Constructor that accepts a Future<void>*.

The Future<void> will be initialized before the task can begin. The Future<void> pointer can be nullptr.

inline Tracker(SharedFuture<> &fut)

Constructor that accepts a SharedFuture<void>&.

The SharedFuture will be initialized before the task can begin.

inline Tracker(SharedFuture<> *fut)

Constructor that accepts a SharedFuture<void>*.

The SharedFuture<void> will be initialized before the task can begin. The SharedFuture<void> pointer can be nullptr.

inline constexpr Tracker(TaskContext &ctx)

Constructor that accepts a TaskContext&.

The value will be atomically written before the task can begin.

inline constexpr Tracker(TaskContext *ctx)

Constructor that accepts a TaskContext*.

The value will be atomically written before the task can begin. The TaskContext* can be nullptr.

inline Tracker(TaskGroup &grp)

Constructor that accepts a TaskGroup&.

The TaskGroup will be entered immediately and left when the task finishes. The TaskGroup must exist until the task completes.

inline Tracker(TaskGroup *grp)

Constructor that accepts a TaskGroup*.

The TaskGroup will be entered immediately and left when the task finishes. The TaskGroup* can be nullptr in which case nothing happens. The TaskGroup must exist until the task completes.

Public Members

ObjectType type

The ObjectType of the represented type.

void *data

Interpreted based on the ObjectType provided.