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

 OIIO_STRONG_PARAM_TYPE (Copy, bool)
 
 OIIO_STRONG_PARAM_TYPE (FromUstring, bool)
 
 ParamValue () noexcept
 
 ParamValue (const ustring &_name, TypeDesc _type, int _nvalues, const void *_value, Copy _copy=Copy(true)) noexcept
 
 ParamValue (const ustring &_name, TypeDesc _type, int _nvalues, Interp _interp, const void *_value, Copy _copy=Copy(true)) noexcept
 
 ParamValue (string_view _name, TypeDesc _type, int _nvalues, const void *_value, Copy _copy=Copy(true)) noexcept
 
 ParamValue (string_view _name, TypeDesc _type, int _nvalues, Interp _interp, const void *_value, Copy _copy=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, ustringhash value) noexcept
 
 ParamValue (string_view _name, TypeDesc type, string_view value)
 
 ParamValue (const ParamValue &p) noexcept
 
 ParamValue (const ParamValue &p, Copy _copy) noexcept
 
 ParamValue (ParamValue &&p) noexcept
 
 ~ParamValue () noexcept
 
void init (ustring _name, TypeDesc _type, int _nvalues, Interp _interp, const void *_value, Copy _copy) noexcept
 
void init (ustring _name, TypeDesc _type, int _nvalues, const void *_value, Copy _copy=Copy(true)) noexcept
 
void init (string_view _name, TypeDesc _type, int _nvalues, const void *_value, Copy _copy=Copy(true)) noexcept
 
void init (string_view _name, TypeDesc _type, int _nvalues, Interp _interp, const void *_value, Copy _copy=Copy(true)) noexcept
 
const ParamValue & operator= (const ParamValue &p) noexcept
 
const ParamValue & operator= (ParamValue &&p) noexcept
 
const ustring & name () const noexcept
 
const ustring & uname () const noexcept
 
TypeDesc type () const noexcept
 
int nvalues () const noexcept
 
const void * data () const noexcept
 
int datasize () const noexcept
 
Interp interp () const noexcept
 
void interp (Interp i) noexcept
 
bool is_nonlocal () const noexcept
 
template<typename T >
const T & get (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 33 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 37 of file paramlist.h.

Constructor & Destructor Documentation

ParamValue::ParamValue ( )
inlinenoexcept

Definition at line 47 of file paramlist.h.

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

Definition at line 74 of file paramlist.h.

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

Definition at line 79 of file paramlist.h.

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

Definition at line 85 of file paramlist.h.

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

Definition at line 90 of file paramlist.h.

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

Definition at line 96 of file paramlist.h.

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

Definition at line 100 of file paramlist.h.

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

Definition at line 104 of file paramlist.h.

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

Definition at line 109 of file paramlist.h.

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

Definition at line 113 of file paramlist.h.

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

Definition at line 123 of file paramlist.h.

ParamValue::ParamValue ( const ParamValue &  p,
Copy  _copy 
)
inlinenoexcept

Definition at line 128 of file paramlist.h.

ParamValue::ParamValue ( ParamValue &&  p)
inlinenoexcept

Definition at line 135 of file paramlist.h.

ParamValue::~ParamValue ( )
inlinenoexcept

Definition at line 144 of file paramlist.h.

Member Function Documentation

const void* ParamValue::data ( ) const
inlinenoexcept

Definition at line 204 of file paramlist.h.

int ParamValue::datasize ( ) const
inlinenoexcept

Definition at line 208 of file paramlist.h.

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

Definition at line 227 of file paramlist.h.

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

Retrieve a float, with conversions from a wide variety of type cases, including integers. It will retrieve 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

Retrieve an integer, with conversions from a wide variety of type cases, including unsigned, short, byte. Not float. It will retrieve 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. For an array or aggregate, at most maxsize elements are returned (if maxsize is 0, all elements are returned, no matter how large it is).

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. For an array or aggregate, at most maxsize elements are returned (if maxsize is 0, all elements are returned, no matter how large it is).

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

Definition at line 171 of file paramlist.h.

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

Definition at line 177 of file paramlist.h.

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

Definition at line 182 of file paramlist.h.

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

Definition at line 187 of file paramlist.h.

Interp ParamValue::interp ( ) const
inlinenoexcept

Definition at line 212 of file paramlist.h.

void ParamValue::interp ( Interp  i)
inlinenoexcept

Definition at line 213 of file paramlist.h.

bool ParamValue::is_nonlocal ( ) const
inlinenoexcept

Definition at line 214 of file paramlist.h.

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

Definition at line 200 of file paramlist.h.

int ParamValue::nvalues ( ) const
inlinenoexcept

Definition at line 203 of file paramlist.h.

ParamValue::OIIO_STRONG_PARAM_TYPE ( Copy  ,
bool   
)
ParamValue::OIIO_STRONG_PARAM_TYPE ( FromUstring  ,
bool   
)
const ParamValue& ParamValue::operator= ( const ParamValue &  p)
noexcept
const ParamValue& ParamValue::operator= ( ParamValue &&  p)
noexcept
TypeDesc ParamValue::type ( ) const
inlinenoexcept

Definition at line 202 of file paramlist.h.

const ustring& ParamValue::uname ( ) const
inlinenoexcept

Definition at line 201 of file paramlist.h.

Friends And Related Function Documentation

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

Definition at line 216 of file paramlist.h.

Member Data Documentation

char ParamValue::localval[16]

Definition at line 267 of file paramlist.h.

const void* ParamValue::ptr

Definition at line 268 of file paramlist.h.


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