HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
ParamValue Class Reference

#include <paramlist.h>

Public Types

enum  Interp { INTERP_CONSTANT = 0, INTERP_PERPIECE = 1, INTERP_LINEAR = 2, INTERP_VERTEX = 3 }
 

Public Member Functions

 ParamValue () noexcept
 
 ParamValue (const ustring &_name, TypeDesc _type, int _nvalues, const void *_value, bool _copy=true) noexcept
 
 ParamValue (const ustring &_name, TypeDesc _type, int _nvalues, Interp _interp, const void *_value, bool _copy=true) noexcept
 
 ParamValue (string_view _name, TypeDesc _type, int _nvalues, const void *_value, bool _copy=true) noexcept
 
 ParamValue (string_view _name, TypeDesc _type, int _nvalues, Interp _interp, const void *_value, bool _copy=true) noexcept
 
 ParamValue (string_view _name, int value) noexcept
 
 ParamValue (string_view _name, float value) noexcept
 
 ParamValue (string_view _name, ustring value) noexcept
 
 ParamValue (string_view _name, string_view value) noexcept
 
 ParamValue (string_view _name, TypeDesc type, string_view value)
 
 ParamValue (const ParamValue &p) noexcept
 
 ParamValue (const ParamValue &p, bool _copy) noexcept
 
 ParamValue (ParamValue &&p) noexcept
 
 ~ParamValue () noexcept
 
void init (ustring _name, TypeDesc _type, int _nvalues, Interp _interp, const void *_value, bool _copy=true) noexcept
 
void init (ustring _name, TypeDesc _type, int _nvalues, const void *_value, bool _copy=true) noexcept
 
void init (string_view _name, TypeDesc _type, int _nvalues, const void *_value, bool _copy=true) noexcept
 
void init (string_view _name, TypeDesc _type, int _nvalues, Interp _interp, const void *_value, bool _copy=true) noexcept
 
const ParamValueoperator= (const ParamValue &p) noexcept
 
const ParamValueoperator= (ParamValue &&p) noexcept
 
const ustringname () const noexcept
 
const ustringuname () const noexcept
 
TypeDesc type () const noexcept
 
int nvalues () const noexcept
 
const voiddata () const noexcept
 
int datasize () const noexcept
 
Interp interp () const noexcept
 
void interp (Interp i) noexcept
 
bool is_nonlocal () const noexcept
 
template<typename T >
const Tget (int i=0) const noexcept
 
int get_int (int defaultval=0) const
 
int get_int_indexed (int index, int defaultval=0) const
 
float get_float (float defaultval=0) const
 
float get_float_indexed (int index, float defaultval=0) const
 
std::string get_string (int maxsize=64) const
 
std::string get_string_indexed (int index) const
 
ustring get_ustring (int maxsize=64) const
 
ustring get_ustring_indexed (int index) const
 

Friends

void swap (ParamValue &a, ParamValue &b) noexcept
 

Detailed Description

ParamValue holds a parameter and a pointer to its value(s)

Nomenclature: if you have an array of 4 colors for each of 15 points...

  • There are 15 VALUES
  • Each value has an array of 4 ELEMENTS, each of which is a color
  • A color has 3 COMPONENTS (R, G, B)

Definition at line 32 of file paramlist.h.

Member Enumeration Documentation

Interpolation types

Enumerator
INTERP_CONSTANT 

Constant for all pieces/faces.

INTERP_PERPIECE 

Piecewise constant per piece/face.

INTERP_LINEAR 

Linearly interpolated across each piece/face.

INTERP_VERTEX 

Interpolated like vertices.

Definition at line 36 of file paramlist.h.

Constructor & Destructor Documentation

ParamValue::ParamValue ( )
inlinenoexcept

Definition at line 43 of file paramlist.h.

ParamValue::ParamValue ( const ustring _name,
TypeDesc  _type,
int  _nvalues,
const void _value,
bool  _copy = true 
)
inlinenoexcept

Definition at line 44 of file paramlist.h.

ParamValue::ParamValue ( const ustring _name,
TypeDesc  _type,
int  _nvalues,
Interp  _interp,
const void _value,
bool  _copy = true 
)
inlinenoexcept

Definition at line 49 of file paramlist.h.

ParamValue::ParamValue ( string_view  _name,
TypeDesc  _type,
int  _nvalues,
const void _value,
bool  _copy = true 
)
inlinenoexcept

Definition at line 54 of file paramlist.h.

ParamValue::ParamValue ( string_view  _name,
TypeDesc  _type,
int  _nvalues,
Interp  _interp,
const void _value,
bool  _copy = true 
)
inlinenoexcept

Definition at line 59 of file paramlist.h.

ParamValue::ParamValue ( string_view  _name,
int  value 
)
inlinenoexcept

Definition at line 64 of file paramlist.h.

ParamValue::ParamValue ( string_view  _name,
float  value 
)
inlinenoexcept

Definition at line 68 of file paramlist.h.

ParamValue::ParamValue ( string_view  _name,
ustring  value 
)
inlinenoexcept

Definition at line 72 of file paramlist.h.

ParamValue::ParamValue ( string_view  _name,
string_view  value 
)
inlinenoexcept

Definition at line 76 of file paramlist.h.

ParamValue::ParamValue ( string_view  _name,
TypeDesc  type,
string_view  value 
)
ParamValue::ParamValue ( const ParamValue p)
inlinenoexcept

Definition at line 86 of file paramlist.h.

ParamValue::ParamValue ( const ParamValue p,
bool  _copy 
)
inlinenoexcept

Definition at line 91 of file paramlist.h.

ParamValue::ParamValue ( ParamValue &&  p)
inlinenoexcept

Definition at line 98 of file paramlist.h.

ParamValue::~ParamValue ( )
inlinenoexcept

Definition at line 107 of file paramlist.h.

Member Function Documentation

const void* ParamValue::data ( ) const
inlinenoexcept

Definition at line 157 of file paramlist.h.

int ParamValue::datasize ( ) const
inlinenoexcept

Definition at line 161 of file paramlist.h.

template<typename T >
const T& ParamValue::get ( int  i = 0) const
inlinenoexcept

Definition at line 180 of file paramlist.h.

float ParamValue::get_float ( float  defaultval = 0) const

Retrive a float, with converstions from a wide variety of type cases, including integers. It will retrive from a string, but only if the string is entirely a valid float format. Unconvertible types return the default value.

float ParamValue::get_float_indexed ( int  index,
float  defaultval = 0 
) const
int ParamValue::get_int ( int  defaultval = 0) const

Retrive an integer, with converstions from a wide variety of type cases, including unsigned, short, byte. Not float. It will retrive from a string, but only if the string is entirely a valid int format. Unconvertible types return the default value.

int ParamValue::get_int_indexed ( int  index,
int  defaultval = 0 
) const
std::string ParamValue::get_string ( int  maxsize = 64) const

Convert any type to a string value. An optional maximum number of elements is also passed. In the case of a single string, just the string directly is returned. But for an array of strings, the array is returned as one string that's a comma-separated list of double- quoted, escaped strings.

std::string ParamValue::get_string_indexed ( int  index) const
ustring ParamValue::get_ustring ( int  maxsize = 64) const

Convert any type to a ustring value. An optional maximum number of elements is also passed. Same behavior as get_string, but returning a ustring.

ustring ParamValue::get_ustring_indexed ( int  index) const
void ParamValue::init ( ustring  _name,
TypeDesc  _type,
int  _nvalues,
Interp  _interp,
const void _value,
bool  _copy = true 
)
inlinenoexcept

Definition at line 109 of file paramlist.h.

void ParamValue::init ( ustring  _name,
TypeDesc  _type,
int  _nvalues,
const void _value,
bool  _copy = true 
)
inlinenoexcept

Definition at line 115 of file paramlist.h.

void ParamValue::init ( string_view  _name,
TypeDesc  _type,
int  _nvalues,
const void _value,
bool  _copy = true 
)
inlinenoexcept

Definition at line 120 of file paramlist.h.

void ParamValue::init ( string_view  _name,
TypeDesc  _type,
int  _nvalues,
Interp  _interp,
const void _value,
bool  _copy = true 
)
inlinenoexcept

Definition at line 125 of file paramlist.h.

Interp ParamValue::interp ( ) const
inlinenoexcept

Definition at line 165 of file paramlist.h.

void ParamValue::interp ( Interp  i)
inlinenoexcept

Definition at line 166 of file paramlist.h.

bool ParamValue::is_nonlocal ( ) const
inlinenoexcept

Definition at line 167 of file paramlist.h.

const ustring& ParamValue::name ( void  ) const
inlinenoexcept

Definition at line 153 of file paramlist.h.

int ParamValue::nvalues ( ) const
inlinenoexcept

Definition at line 156 of file paramlist.h.

const ParamValue& ParamValue::operator= ( const ParamValue p)
inlinenoexcept

Definition at line 132 of file paramlist.h.

const ParamValue& ParamValue::operator= ( ParamValue &&  p)
inlinenoexcept

Definition at line 139 of file paramlist.h.

TypeDesc ParamValue::type ( ) const
inlinenoexcept

Definition at line 155 of file paramlist.h.

const ustring& ParamValue::uname ( ) const
inlinenoexcept

Definition at line 154 of file paramlist.h.

Friends And Related Function Documentation

void swap ( ParamValue a,
ParamValue b 
)
friend

Definition at line 169 of file paramlist.h.

Member Data Documentation

char ParamValue::localval[16]

Definition at line 216 of file paramlist.h.

const void* ParamValue::ptr

Definition at line 217 of file paramlist.h.


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