DataStorm  0.1
Data Distribution Service
Public Types | Public Member Functions | List of all members
DataStorm::Sample< Key, Value, UpdateTag > Class Template Reference

A sample provides information about a data element update. More...

#include <DataStorm/DataStorm.h>

Public Types

using KeyType = Key
 The type of the sample key. More...
 
using ValueType = Value
 The type of the sample value. More...
 
using UpdateTagType = UpdateTag
 The type of the update tag. More...
 

Public Member Functions

SampleEvent getEvent () const noexcept
 The event associated with the sample. More...
 
const Key & getKey () const noexcept
 The key of the sample. More...
 
const Value & getValue () const noexcept
 The value of the sample. More...
 
UpdateTag getUpdateTag () const noexcept
 The update tag for the partial update. More...
 
std::chrono::time_point< std::chrono::system_clock > getTimeStamp () const noexcept
 The timestamp of the sample. More...
 
std::string getOrigin () const noexcept
 The origin of the sample. More...
 
std::string getSession () const noexcept
 Get the session identifier of the session that received this sample. More...
 

Detailed Description

template<typename Key, typename Value, typename UpdateTag = std::string>
class DataStorm::Sample< Key, Value, UpdateTag >

A sample provides information about a data element update.

The Sample template provides access to the key, value as well as additional information such as the event, timestamp, update tag. Samples are generated and published by writers and received by readers.

Member Typedef Documentation

◆ KeyType

template<typename Key , typename Value , typename UpdateTag = std::string>
using DataStorm::Sample< Key, Value, UpdateTag >::KeyType = Key

The type of the sample key.

◆ UpdateTagType

template<typename Key , typename Value , typename UpdateTag = std::string>
using DataStorm::Sample< Key, Value, UpdateTag >::UpdateTagType = UpdateTag

The type of the update tag.

The update tag type defaults to string if it's not explicitly specified with the Sample template paremeters.

◆ ValueType

template<typename Key , typename Value , typename UpdateTag = std::string>
using DataStorm::Sample< Key, Value, UpdateTag >::ValueType = Value

The type of the sample value.

Member Function Documentation

◆ getEvent()

template<typename Key , typename Value , typename UpdateTag >
SampleEvent DataStorm::Sample< Key, Value, UpdateTag >::getEvent ( ) const
noexcept

The event associated with the sample.

Returns
The sample event.

◆ getKey()

template<typename Key , typename Value , typename UpdateTag >
const Key & DataStorm::Sample< Key, Value, UpdateTag >::getKey ( ) const
noexcept

The key of the sample.

Returns
The sample key.

◆ getOrigin()

template<typename Key , typename Value , typename UpdateTag >
std::string DataStorm::Sample< Key, Value, UpdateTag >::getOrigin ( ) const
noexcept

The origin of the sample.

The origin of the sample identifies uniquely on the node the writer that created the sample. It's the name of the writer if a name was explicitly provided on creation of the writer. Otherwise, if no name was provided, an unique identifier is generated by DataStorm.

Returns
The origin of the sample.

◆ getSession()

template<typename Key , typename Value , typename UpdateTag >
std::string DataStorm::Sample< Key, Value, UpdateTag >::getSession ( ) const
noexcept

Get the session identifier of the session that received this sample.

This session identifier can be used to retrieve the Ice connection with the node.

Returns
The session identifier.

◆ getTimeStamp()

template<typename Key , typename Value , typename UpdateTag >
std::chrono::time_point< std::chrono::system_clock > DataStorm::Sample< Key, Value, UpdateTag >::getTimeStamp ( ) const
noexcept

The timestamp of the sample.

The timestamp is generated by the writer and corresponds to the time of sending.

Returns
The timestamp.

◆ getUpdateTag()

template<typename Key , typename Value , typename UpdateTag >
UpdateTag DataStorm::Sample< Key, Value, UpdateTag >::getUpdateTag ( ) const
noexcept

The update tag for the partial update.

This method should only be called if the sample event is PartialUpdate.

Returns
The update tag.

◆ getValue()

template<typename Key , typename Value , typename UpdateTag >
const Value & DataStorm::Sample< Key, Value, UpdateTag >::getValue ( ) const
noexcept

The value of the sample.

Depending on the sample event, the sample value might not always be available. It's the case if the sample event is Remove where this method will return a default value.

Returns
The sample value.

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