AJA NTV2 SDK  18.0.0.2122
NTV2 SDK 18.0.0.2122
AJAVariant Class Reference

A simple Variant class. More...

#include <variant.h>

Public Member Functions

 AJAVariant (const AJAVariantType type=AJA_VARIANT_INT32)
 
 AJAVariant (const bool value)
 
 AJAVariant (const float value)
 
 AJAVariant (const double value)
 
 AJAVariant (const int8_t value)
 
 AJAVariant (const uint8_t value)
 
 AJAVariant (const int16_t value)
 
 AJAVariant (const uint16_t value)
 
 AJAVariant (const int32_t value)
 
 AJAVariant (const uint32_t value)
 
 AJAVariant (const int64_t value)
 
 AJAVariant (const uint64_t value)
 
 AJAVariant (const char *pStr)
 
 AJAVariant (const char *pStr, size_t len)
 
 AJAVariant (const std::string &value)
 
 AJAVariant (const AJAVariant &other)
 
 ~AJAVariant ()
 
AJAVariantoperator= (const AJAVariant &other)
 
template<typename T >
AJAVariantoperator= (const T inRHS)
 
 operator bool () const
 
 operator float () const
 
 operator double () const
 
 operator int8_t () const
 
 operator uint8_t () const
 
 operator int16_t () const
 
 operator uint16_t () const
 
 operator int32_t () const
 
 operator uint32_t () const
 
 operator int64_t () const
 
 operator uint64_t () const
 
 operator std::string () const
 
AJAVariantType GetType () const
 
bool IsNumeric () const
 
bool IsUnsigned () const
 
bool IsSigned () const
 
bool GetBool () const
 
float GetFloat () const
 
double GetDouble () const
 
int8_t GetInt8 () const
 
uint8_t GetUInt8 () const
 
int16_t GetInt16 () const
 
uint16_t GetUInt16 () const
 
int32_t GetInt32 () const
 
uint32_t GetUInt32 () const
 
int64_t GetInt64 () const
 
uint64_t GetUInt64 () const
 
const std::string & GetString () const
 
void SetBool (bool value)
 
void SetFloat (float value)
 
void SetDouble (double value)
 
void SetInt8 (int8_t value)
 
void SetUInt8 (uint8_t value)
 
void SetInt16 (int16_t value)
 
void SetUInt16 (uint16_t value)
 
void SetInt32 (int32_t value)
 
void SetUInt32 (uint32_t value)
 
void SetInt64 (int64_t value)
 
void SetUInt64 (uint64_t value)
 
void SetString (const char *value)
 
void SetString (const char *pStr, const size_t len)
 
void SetString (const std::string &value)
 
bool AsBool () const
 
float AsFloat () const
 
double AsDouble () const
 
int8_t AsInt8 () const
 
uint8_t AsUInt8 () const
 
int16_t AsInt16 () const
 
uint16_t AsUInt16 () const
 
int32_t AsInt32 () const
 
uint32_t AsUInt32 () const
 
int64_t AsInt64 () const
 
uint64_t AsUInt64 () const
 
std::string AsString () const
 

Detailed Description

A simple Variant class.

Definition at line 39 of file variant.h.

Constructor & Destructor Documentation

◆ AJAVariant() [1/16]

AJAVariant::AJAVariant ( const AJAVariantType  type = AJA_VARIANT_INT32)
explicit

Definition at line 18 of file variant.cpp.

◆ AJAVariant() [2/16]

AJAVariant::AJAVariant ( const bool  value)
inlineexplicit

Definition at line 43 of file variant.h.

◆ AJAVariant() [3/16]

AJAVariant::AJAVariant ( const float  value)
inlineexplicit

Definition at line 44 of file variant.h.

◆ AJAVariant() [4/16]

AJAVariant::AJAVariant ( const double  value)
inlineexplicit

Definition at line 45 of file variant.h.

◆ AJAVariant() [5/16]

AJAVariant::AJAVariant ( const int8_t  value)
inlineexplicit

Definition at line 46 of file variant.h.

◆ AJAVariant() [6/16]

AJAVariant::AJAVariant ( const uint8_t  value)
inlineexplicit

Definition at line 47 of file variant.h.

◆ AJAVariant() [7/16]

AJAVariant::AJAVariant ( const int16_t  value)
inlineexplicit

Definition at line 48 of file variant.h.

◆ AJAVariant() [8/16]

AJAVariant::AJAVariant ( const uint16_t  value)
inlineexplicit

Definition at line 49 of file variant.h.

◆ AJAVariant() [9/16]

AJAVariant::AJAVariant ( const int32_t  value)
inlineexplicit

Definition at line 50 of file variant.h.

◆ AJAVariant() [10/16]

AJAVariant::AJAVariant ( const uint32_t  value)
inlineexplicit

Definition at line 51 of file variant.h.

◆ AJAVariant() [11/16]

AJAVariant::AJAVariant ( const int64_t  value)
inlineexplicit

Definition at line 52 of file variant.h.

◆ AJAVariant() [12/16]

AJAVariant::AJAVariant ( const uint64_t  value)
inlineexplicit

Definition at line 53 of file variant.h.

◆ AJAVariant() [13/16]

AJAVariant::AJAVariant ( const char *  pStr)
inlineexplicit

Definition at line 54 of file variant.h.

◆ AJAVariant() [14/16]

AJAVariant::AJAVariant ( const char *  pStr,
size_t  len 
)
inlineexplicit

Definition at line 55 of file variant.h.

◆ AJAVariant() [15/16]

AJAVariant::AJAVariant ( const std::string &  value)
inlineexplicit

Definition at line 56 of file variant.h.

◆ AJAVariant() [16/16]

AJAVariant::AJAVariant ( const AJAVariant other)
inline

Definition at line 58 of file variant.h.

◆ ~AJAVariant()

AJAVariant::~AJAVariant ( )
inline

Definition at line 60 of file variant.h.

Member Function Documentation

◆ AsBool()

bool AJAVariant::AsBool ( ) const

Get the value of this variant as bool.

Returns
The bool value of this variant, if the type is AJA_VARIANT_BOOL, otherwise type-convert and return the current type as bool.

Definition at line 71 of file variant.cpp.

◆ AsDouble()

double AJAVariant::AsDouble ( ) const

Get the value of this variant as double.

Returns
The double value of this variant, if the type is AJA_VARIANT_DOUBLE, otherwise type-convert and return the current type as double.

Definition at line 129 of file variant.cpp.

◆ AsFloat()

float AJAVariant::AsFloat ( ) const

Get the value of this variant as float.

Returns
The float value of this variant, if the type is AJA_VARIANT_FLOAT, otherwise type-convert and return the current type as float.

Definition at line 102 of file variant.cpp.

◆ AsInt16()

int16_t AJAVariant::AsInt16 ( ) const

Get the value of this variant as int16_t.

Returns
The int16_t value of this variant, if the type is AJA_VARIANT_INT16, otherwise type-convert and return the current type as int16_t.

Definition at line 195 of file variant.cpp.

◆ AsInt32()

int32_t AJAVariant::AsInt32 ( ) const

Get the value of this variant as int32_t.

Returns
The int32_t value of this variant, if the type is AJA_VARIANT_INT32, otherwise type-convert and return the current type as int32_t.

Definition at line 239 of file variant.cpp.

◆ AsInt64()

int64_t AJAVariant::AsInt64 ( ) const

Get the value of this variant as int64_t.

Returns
The int64_t value of this variant, if the type is AJA_VARIANT_INT64, otherwise type-convert and return the current type as int64_t.

Definition at line 283 of file variant.cpp.

◆ AsInt8()

int8_t AJAVariant::AsInt8 ( ) const

Get the value of this variant as int8_t.

Returns
The int8_t value of this variant, if the type is AJA_VARIANT_INT8, otherwise type-convert and return the current type as int8_t.

Definition at line 151 of file variant.cpp.

◆ AsString()

std::string AJAVariant::AsString ( ) const

Get the value of this variant as std::string.

Returns
The std::string value of this variant, if the type is AJA_VARIANT_STRING, otherwise type-convert and return the current type as std::string.

Definition at line 350 of file variant.cpp.

◆ AsUInt16()

uint16_t AJAVariant::AsUInt16 ( ) const

Get the value of this variant as uint16_t.

Returns
The uint16_t value of this variant, if the type is AJA_VARIANT_UINT16, otherwise type-convert and return the current type as uint16_t.

Definition at line 217 of file variant.cpp.

◆ AsUInt32()

uint32_t AJAVariant::AsUInt32 ( ) const

Get the value of this variant as uint32_t.

Returns
The uint32_t value of this variant, if the type is AJA_VARIANT_UINT32, otherwise type-convert and return the current type as uint32_t.

Definition at line 261 of file variant.cpp.

◆ AsUInt64()

uint64_t AJAVariant::AsUInt64 ( ) const

Get the value of this variant as uint64_t.

Returns
The uint64_t value of this variant, if the type is AJA_VARIANT_UINT64, otherwise type-convert and return the current type as uint64_t.

Definition at line 310 of file variant.cpp.

◆ AsUInt8()

uint8_t AJAVariant::AsUInt8 ( ) const

Get the value of this variant as uint8_t.

Returns
The uint8_t value of this variant, if the type is AJA_VARIANT_UINT8, otherwise type-convert and return the current type as uint8_t.

Definition at line 173 of file variant.cpp.

◆ GetBool()

bool AJAVariant::GetBool ( ) const
inline

Get the bool value from this variant.

Returns
My bool value.

Definition at line 107 of file variant.h.

◆ GetDouble()

double AJAVariant::GetDouble ( ) const
inline

Get the double value from this variant.

Returns
My double value.

Definition at line 119 of file variant.h.

◆ GetFloat()

float AJAVariant::GetFloat ( ) const
inline

Get the float value from this variant.

Returns
My float value.

Definition at line 113 of file variant.h.

◆ GetInt16()

int16_t AJAVariant::GetInt16 ( ) const
inline

Get the int16_t value from this variant.

Returns
My int16_t value.

Definition at line 137 of file variant.h.

◆ GetInt32()

int32_t AJAVariant::GetInt32 ( ) const
inline

Get the int32_t value from this variant.

Returns
My int32_t value.

Definition at line 149 of file variant.h.

◆ GetInt64()

int64_t AJAVariant::GetInt64 ( ) const
inline

Get the int64_t value from this variant.

Returns
My int64_t value.

Definition at line 161 of file variant.h.

◆ GetInt8()

int8_t AJAVariant::GetInt8 ( ) const
inline

Get the int8_t value from this variant.

Returns
My int8_t value.

Definition at line 125 of file variant.h.

◆ GetString()

const std::string& AJAVariant::GetString ( ) const
inline

Get the std::string value from this variant.

Returns
My std::string value.

Definition at line 173 of file variant.h.

◆ GetType()

AJAVariantType AJAVariant::GetType ( ) const
inline
Returns
My data type

Definition at line 97 of file variant.h.

◆ GetUInt16()

uint16_t AJAVariant::GetUInt16 ( ) const
inline

Get the uint16_t value from this variant.

Returns
My uint16_t value.

Definition at line 143 of file variant.h.

◆ GetUInt32()

uint32_t AJAVariant::GetUInt32 ( ) const
inline

Get the uint32_t value from this variant.

Returns
My uint32_t value.

Definition at line 155 of file variant.h.

◆ GetUInt64()

uint64_t AJAVariant::GetUInt64 ( ) const
inline

Get the uint64_t value from this variant.

Returns
My uint64_t value.

Definition at line 167 of file variant.h.

◆ GetUInt8()

uint8_t AJAVariant::GetUInt8 ( ) const
inline

Get the uint8_t value from this variant.

Returns
My uint8_t value.

Definition at line 131 of file variant.h.

◆ IsNumeric()

bool AJAVariant::IsNumeric ( ) const
Returns
True if I have a numeric type

Definition at line 372 of file variant.cpp.

◆ IsSigned()

bool AJAVariant::IsSigned ( ) const
Returns
True if I have a signed numeric type

Definition at line 408 of file variant.cpp.

◆ IsUnsigned()

bool AJAVariant::IsUnsigned ( ) const
Returns
True if I have an unsigned numeric type;

Definition at line 393 of file variant.cpp.

◆ operator bool()

AJAVariant::operator bool ( ) const
inline

Definition at line 84 of file variant.h.

◆ operator double()

AJAVariant::operator double ( ) const
inline

Definition at line 86 of file variant.h.

◆ operator float()

AJAVariant::operator float ( ) const
inline

Definition at line 85 of file variant.h.

◆ operator int16_t()

AJAVariant::operator int16_t ( ) const
inline

Definition at line 89 of file variant.h.

◆ operator int32_t()

AJAVariant::operator int32_t ( ) const
inline

Definition at line 91 of file variant.h.

◆ operator int64_t()

AJAVariant::operator int64_t ( ) const
inline

Definition at line 93 of file variant.h.

◆ operator int8_t()

AJAVariant::operator int8_t ( ) const
inline

Definition at line 87 of file variant.h.

◆ operator std::string()

AJAVariant::operator std::string ( ) const
inline

Definition at line 95 of file variant.h.

◆ operator uint16_t()

AJAVariant::operator uint16_t ( ) const
inline

Definition at line 90 of file variant.h.

◆ operator uint32_t()

AJAVariant::operator uint32_t ( ) const
inline

Definition at line 92 of file variant.h.

◆ operator uint64_t()

AJAVariant::operator uint64_t ( ) const
inline

Definition at line 94 of file variant.h.

◆ operator uint8_t()

AJAVariant::operator uint8_t ( ) const
inline

Definition at line 88 of file variant.h.

◆ operator=() [1/2]

AJAVariant & AJAVariant::operator= ( const AJAVariant other)

Assigns the value and type of another AJAVariant to me.

Parameters
[in]otherThe AJAVariant to assign to me.
Returns
A non-const reference to me.

Definition at line 44 of file variant.cpp.

◆ operator=() [2/2]

template<typename T >
AJAVariant& AJAVariant::operator= ( const T  inRHS)
inline

Assigns a scalar value of any type to me.

Parameters
[in]inRHSThe scalar value to assign to me.
Returns
A non-const reference to me.

Definition at line 74 of file variant.h.

◆ SetBool()

void AJAVariant::SetBool ( bool  value)
inline

Sets my value from the specified bool.

Parameters
[in]valueThe bool value to set.

Definition at line 179 of file variant.h.

◆ SetDouble()

void AJAVariant::SetDouble ( double  value)
inline

Sets my value from the specified double.

Parameters
[in]valueThe double value to set.

Definition at line 189 of file variant.h.

◆ SetFloat()

void AJAVariant::SetFloat ( float  value)
inline

Sets my value from the specified float.

Parameters
[in]valueThe float value to set.

Definition at line 184 of file variant.h.

◆ SetInt16()

void AJAVariant::SetInt16 ( int16_t  value)
inline

Sets my value from the specified int16_t.

Parameters
[in]valueThe int16_t value to set.

Definition at line 204 of file variant.h.

◆ SetInt32()

void AJAVariant::SetInt32 ( int32_t  value)
inline

Sets my value from the specified int32_t.

Parameters
[in]valueThe int32_t value to set.

Definition at line 214 of file variant.h.

◆ SetInt64()

void AJAVariant::SetInt64 ( int64_t  value)
inline

Sets my value from the specified int64_t.

Parameters
[in]valueThe int64_t value to set.

Definition at line 224 of file variant.h.

◆ SetInt8()

void AJAVariant::SetInt8 ( int8_t  value)
inline

Sets my value from the specified int8_t.

Parameters
[in]valueThe int8_t value to set.

Definition at line 194 of file variant.h.

◆ SetString() [1/3]

void AJAVariant::SetString ( const char *  value)
inline

Sets my value from the specified c-string.

Parameters
[in]valueThe c-string value to set.

Definition at line 234 of file variant.h.

◆ SetString() [2/3]

void AJAVariant::SetString ( const char *  pStr,
const size_t  len 
)
inline

Sets my value from the given c-style string.

Parameters
[in]pStrPoints to the character buffer to copy from. Cannot be nullptr.
[in]lenThe number of bytes to copy from the string value.

Definition at line 240 of file variant.h.

◆ SetString() [3/3]

void AJAVariant::SetString ( const std::string &  value)
inline

Sets my value from the given std::string.

Parameters
[in]valueThe std::string value to set.

Definition at line 245 of file variant.h.

◆ SetUInt16()

void AJAVariant::SetUInt16 ( uint16_t  value)
inline

Sets my value from the specified uint16_t.

Parameters
[in]valueThe uint16_t value to set.

Definition at line 209 of file variant.h.

◆ SetUInt32()

void AJAVariant::SetUInt32 ( uint32_t  value)
inline

Sets my value from the specified uint32_t.

Parameters
[in]valueThe uint32_t value to set.

Definition at line 219 of file variant.h.

◆ SetUInt64()

void AJAVariant::SetUInt64 ( uint64_t  value)
inline

Sets my value from the specified uint64_t.

Parameters
[in]valueThe uint64_t value to set.

Definition at line 229 of file variant.h.

◆ SetUInt8()

void AJAVariant::SetUInt8 ( uint8_t  value)
inline

Sets my value from the specified uint8_t.

Parameters
[in]valueThe uint8_t value to set.

Definition at line 199 of file variant.h.

Member Data Documentation

◆ mBooleanValue

bool AJAVariant::mBooleanValue

Definition at line 315 of file variant.h.

◆ mDoubleValue

double AJAVariant::mDoubleValue

Definition at line 317 of file variant.h.

◆ mFloatValue

float AJAVariant::mFloatValue

Definition at line 316 of file variant.h.

◆ mInt16Value

int16_t AJAVariant::mInt16Value

Definition at line 320 of file variant.h.

◆ mInt32Value

int32_t AJAVariant::mInt32Value

Definition at line 322 of file variant.h.

◆ mInt64Value

int64_t AJAVariant::mInt64Value

Definition at line 324 of file variant.h.

◆ mInt8Value

int8_t AJAVariant::mInt8Value

Definition at line 318 of file variant.h.

◆ mUInt16Value

uint16_t AJAVariant::mUInt16Value

Definition at line 321 of file variant.h.

◆ mUInt32Value

uint32_t AJAVariant::mUInt32Value

Definition at line 323 of file variant.h.

◆ mUInt64Value

uint64_t AJAVariant::mUInt64Value

Definition at line 325 of file variant.h.

◆ mUInt8Value

uint8_t AJAVariant::mUInt8Value

Definition at line 319 of file variant.h.


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