Twitch SDK (Internal)
Public Member Functions | Private Attributes | List of all members
ttv::TrackingContext Class Reference

#include <trackingcontext.h>

Public Member Functions

 TrackingContext ()
 
 TrackingContext (const std::shared_ptr< TrackingContext > &parent)
 
void SetProperty (const std::string &key, const TrackingValue &value)
 
void SetProperties (std::initializer_list< std::pair< std::string, TrackingValue >> properties)
 
TTV_ErrorCode TrackEvent (const std::string &eventName, std::map< std::string, TrackingValue > &&properties)
 

Private Attributes

std::shared_ptr< ttv::IMutexmMutex
 
std::shared_ptr< TrackingContextmParentContext
 
std::map< std::string, TrackingValuemProperties
 

Detailed Description

A class to send tracking events with shared properties.

Shared properties can be set on this class, which will be added to any tracking events sent through this class. Tracking contexts can be a root context, which direcly sends the tracking events, or a child context, which forwards the events to its parent. As such, a child context inherits the shared properties of its parent.

Shared properties in a child context override the values of properties in the parent context with the same key. Similarly, properties directly passed into TrackEvent override any shared properties with the same key.

Constructor & Destructor Documentation

◆ TrackingContext() [1/2]

ttv::TrackingContext::TrackingContext ( )

Create a root tracking context that directly sends tracking events.

◆ TrackingContext() [2/2]

ttv::TrackingContext::TrackingContext ( const std::shared_ptr< TrackingContext > &  parent)

Create a child tracking context, which sends events to its parent.

Parameters
[in]parentThe parent tracking context.

Member Function Documentation

◆ SetProperties()

void ttv::TrackingContext::SetProperties ( std::initializer_list< std::pair< std::string, TrackingValue >>  properties)

Sets multiple properties on the context. These are guaranteed to be atomically set.

◆ SetProperty()

void ttv::TrackingContext::SetProperty ( const std::string &  key,
const TrackingValue value 
)

Sets a property on the context.

◆ TrackEvent()

TTV_ErrorCode ttv::TrackingContext::TrackEvent ( const std::string &  eventName,
std::map< std::string, TrackingValue > &&  properties 
)

Track an event.

Parameters
[in]eventNameThe name of the event to be tracked.
[in]propertiesA map of properties to send with the event.

Member Data Documentation

◆ mMutex

std::shared_ptr<ttv::IMutex> ttv::TrackingContext::mMutex
private

◆ mParentContext

std::shared_ptr<TrackingContext> ttv::TrackingContext::mParentContext
private

◆ mProperties

std::map<std::string, TrackingValue> ttv::TrackingContext::mProperties
private

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