Rumba C++ SDK
maquina::Value Class Reference

Base class of all Rumba values. More...

#include <Value.h>

Inheritance diagram for maquina::Value:
maquina::BufferConst< Imath::V3f > maquina::BufferConst< Imath::V3i > maquina::AnimCurve maquina::Array maquina::BufferConst< T > maquina::BVH3 maquina::BVHTriangle maquina::ChannelBool maquina::ChannelFloat maquina::ChannelInt maquina::Dict maquina::Expr maquina::GraphProperties maquina::Image maquina::IndexedBufferConst< T > maquina::KeySet maquina::MeshEdit maquina::PlugList maquina::SceneConst maquina::Shader maquina::Shape maquina::SparseBufferConst< T > maquina::StringSet maquina::SparseBufferConst< float > maquina::SparseBufferConst< Imath::V3f > maquina::SparseBufferConst< uint32_t >

Public Member Functions

 Value ()
 
Value duplicate () const
 Duplicate the value. More...
 
bool as_bool () const
 Returns the value as a bool. More...
 
int as_int () const
 Returns the value as an integer. More...
 
float as_float () const
 Returns the value as a float. More...
 
double as_double () const
 Returns the value as a double. More...
 
const std::string & as_string () const
 Returns the value as a string. More...
 
std::wstring as_wstring () const
 Returns the value as a wstring. More...
 
Imath::V2f as_V2f () const
 Returns the value as a V2f. More...
 
Imath::V3f as_V3f () const
 Returns the value as a V3f. More...
 
Imath::V4f as_V4f () const
 Returns the value as a V4f. More...
 
const Imath::V2das_V2d () const
 Returns the value as a V2d. More...
 
const Imath::V3das_V3d () const
 Returns the value as a V3d. More...
 
const Imath::V4das_V4d () const
 Returns the value as a V4d. More...
 
const Imath::V2ias_V2i () const
 Returns the value as a V2i. More...
 
const Imath::V3ias_V3i () const
 Returns the value as a V3i. More...
 
const Imath::V4ias_V4i () const
 Returns the value as a V4i. More...
 
Imath::M44f as_M44f () const
 Returns the value as a M44f. More...
 
const Imath::M44das_M44d () const
 Returns the value as a M44d. More...
 
const Imath::Box3fas_Box3f () const
 Returns the value as a Box3f. More...
 
const Imath::Color4fas_Color4f () const
 Returns the value as a Color4f. More...
 
Imath::Quatf as_Quatf () const
 Returns the value as a Quatf. More...
 
const Imath::Quatdas_Quatd () const
 Returns the value as a Quatd. More...
 
std::shared_ptr< const UserDataas_user_data () const
 Returns the value as a user data. More...
 
StringView type_name () const
 Return the type name of the Value. More...
 
bool has_node_delegate () const
 Check if this value can produces a NodeDelegate. More...
 
std::shared_ptr< NodeDelegatenode_delegate (const std::shared_ptr< NodeDelegate > &parent, const StringView &name) const
 
bool operator== (const Value &o) const
 Compare the two values. More...
 
bool operator!= (const Value &o) const
 
bool is_instance (const char *value_type_name) const
 Check if this type derives from another value type. More...
 
bool is_interpolable () const
 Checks if the value is interpolable. More...
 
Value lerp (const Value &other, double weight) const
 Performs linear interpolation between this value and another value. More...
 
Create Rumba objects
 Value (bool)
 Create a boolean value. More...
 
 Value (int)
 Create an integer value. More...
 
 Value (float)
 Create a float value. More...
 
 Value (double)
 Create a double value. More...
 
 Value (const char *string)
 Create a string value. More...
 
 Value (const wchar_t *string)
 Create a string value. More...
 
 Value (const std::string &string)
 Create a string value. More...
 
 Value (const std::wstring &string)
 Create a wide string value. More...
 
 Value (const Imath::V2f &)
 Create a Imath::V2f value. More...
 
 Value (const Imath::V3f &)
 Create a Imath::V3f value. More...
 
 Value (const Imath::V4f &)
 Create a Imath::V4f value. More...
 
 Value (const Imath::V2d &)
 Create a Imath::V2d value. More...
 
 Value (const Imath::V3d &)
 Create a Imath::V3d value. More...
 
 Value (const Imath::V4d &)
 Create a Imath::V4d value. More...
 
 Value (const Imath::V2i &)
 Create a Imath::V2i value. More...
 
 Value (const Imath::V3i &)
 Create a Imath::V3i value. More...
 
 Value (const Imath::V4i &)
 Create a Imath::V4i value. More...
 
 Value (const Imath::Color4f &)
 Create a Imath::Color4f value. More...
 
 Value (const Imath::M44f &)
 Create a Imath::M44f value. More...
 
 Value (const Imath::M44d &)
 Create a Imath::M44d value. More...
 
 Value (const Imath::Box3f &)
 Create a Imath::Box3f value. More...
 
 Value (const Imath::Quatf &)
 Create a Imath::Quatf value. More...
 
 Value (const Imath::Quatd &)
 Create a Imath::Quatd value. More...
 
 Value (const std::shared_ptr< const UserData > &user_data)
 Create a user data value. More...
 

Static Public Member Functions

static bool validate_type_name (const char *type_name)
 Return true if the name is a valid type name. More...
 
static Value get_default_value (const char *type_name)
 Return a default value for a given type. More...
 

Static Public Attributes

static const Value default_value
 The default value. More...
 

Detailed Description

Base class of all Rumba values.

Constructor & Destructor Documentation

◆ Value() [1/25]

maquina::Value::Value ( )

◆ Value() [2/25]

maquina::Value::Value ( bool  )

Create a boolean value.

◆ Value() [3/25]

maquina::Value::Value ( int  )

Create an integer value.

◆ Value() [4/25]

maquina::Value::Value ( float  )

Create a float value.

◆ Value() [5/25]

maquina::Value::Value ( double  )

Create a double value.

◆ Value() [6/25]

maquina::Value::Value ( const char *  string)

Create a string value.

◆ Value() [7/25]

maquina::Value::Value ( const wchar_t *  string)

Create a string value.

◆ Value() [8/25]

maquina::Value::Value ( const std::string &  string)

Create a string value.

◆ Value() [9/25]

maquina::Value::Value ( const std::wstring &  string)

Create a wide string value.

◆ Value() [10/25]

maquina::Value::Value ( const Imath::V2f )

Create a Imath::V2f value.

◆ Value() [11/25]

maquina::Value::Value ( const Imath::V3f )

Create a Imath::V3f value.

◆ Value() [12/25]

maquina::Value::Value ( const Imath::V4f )

Create a Imath::V4f value.

◆ Value() [13/25]

maquina::Value::Value ( const Imath::V2d )

Create a Imath::V2d value.

◆ Value() [14/25]

maquina::Value::Value ( const Imath::V3d )

Create a Imath::V3d value.

◆ Value() [15/25]

maquina::Value::Value ( const Imath::V4d )

Create a Imath::V4d value.

◆ Value() [16/25]

maquina::Value::Value ( const Imath::V2i )

Create a Imath::V2i value.

◆ Value() [17/25]

maquina::Value::Value ( const Imath::V3i )

Create a Imath::V3i value.

◆ Value() [18/25]

maquina::Value::Value ( const Imath::V4i )

Create a Imath::V4i value.

◆ Value() [19/25]

maquina::Value::Value ( const Imath::Color4f )

Create a Imath::Color4f value.

◆ Value() [20/25]

maquina::Value::Value ( const Imath::M44f )

Create a Imath::M44f value.

◆ Value() [21/25]

maquina::Value::Value ( const Imath::M44d )

Create a Imath::M44d value.

◆ Value() [22/25]

maquina::Value::Value ( const Imath::Box3f )

Create a Imath::Box3f value.

◆ Value() [23/25]

maquina::Value::Value ( const Imath::Quatf )

Create a Imath::Quatf value.

◆ Value() [24/25]

maquina::Value::Value ( const Imath::Quatd )

Create a Imath::Quatd value.

◆ Value() [25/25]

maquina::Value::Value ( const std::shared_ptr< const UserData > &  user_data)

Create a user data value.

Member Function Documentation

◆ as_bool()

bool maquina::Value::as_bool ( ) const

Returns the value as a bool.

You must be sure this value is an integer, a float or a boolean or you get false.

◆ as_Box3f()

const Imath::Box3f& maquina::Value::as_Box3f ( ) const

Returns the value as a Box3f.

You must be sure this value is a Box3f or you will have an empty box.

◆ as_Color4f()

const Imath::Color4f& maquina::Value::as_Color4f ( ) const

Returns the value as a Color4f.

You must be sure this value is a Color4f or you will have {0,0,0,0}.

◆ as_double()

double maquina::Value::as_double ( ) const

Returns the value as a double.

You must be sure this value is an integer, a float or a boolean or you get 0.0.

◆ as_float()

float maquina::Value::as_float ( ) const

Returns the value as a float.

You must be sure this value is an integer, a float or a boolean or you get 0.f.

◆ as_int()

int maquina::Value::as_int ( ) const

Returns the value as an integer.

You must be sure this value is an integer, a float or a boolean or you get 0.

◆ as_M44d()

const Imath::M44d& maquina::Value::as_M44d ( ) const

Returns the value as a M44d.

You must be sure this value is a M44f or M44d or you will have an identity matrix.

◆ as_M44f()

Imath::M44f maquina::Value::as_M44f ( ) const

Returns the value as a M44f.

You must be sure this value is a M44f or M44d or you will have an identity matrix.

◆ as_Quatd()

const Imath::Quatd& maquina::Value::as_Quatd ( ) const

Returns the value as a Quatd.

You must be sure this value is a Quatf/Quatd or you will have an identity quaternion.

◆ as_Quatf()

Imath::Quatf maquina::Value::as_Quatf ( ) const

Returns the value as a Quatf.

You must be sure this value is a Quatf or you will have an identity quaternion.

◆ as_string()

const std::string& maquina::Value::as_string ( ) const

Returns the value as a string.

You must be sure this value is a string or you will have an empty string.

◆ as_user_data()

std::shared_ptr<const UserData> maquina::Value::as_user_data ( ) const

Returns the value as a user data.

You must be sure this value is a user data or you will have a nullptr.

◆ as_V2d()

const Imath::V2d& maquina::Value::as_V2d ( ) const

Returns the value as a V2d.

You must be sure this value is a V2d or you will have {0,0}.

◆ as_V2f()

Imath::V2f maquina::Value::as_V2f ( ) const

Returns the value as a V2f.

You must be sure this value is a V2f/V2d or you will have {0,0}.

◆ as_V2i()

const Imath::V2i& maquina::Value::as_V2i ( ) const

Returns the value as a V2i.

You must be sure this value is a V2i or you will have {0,0}.

◆ as_V3d()

const Imath::V3d& maquina::Value::as_V3d ( ) const

Returns the value as a V3d.

You must be sure this value is a V3d or you will have {0,0,0}.

◆ as_V3f()

Imath::V3f maquina::Value::as_V3f ( ) const

Returns the value as a V3f.

You must be sure this value is a V3f/V3d or you will have {0,0,0}.

◆ as_V3i()

const Imath::V3i& maquina::Value::as_V3i ( ) const

Returns the value as a V3i.

You must be sure this value is a V3i or you will have {0,0,0}.

◆ as_V4d()

const Imath::V4d& maquina::Value::as_V4d ( ) const

Returns the value as a V4d.

You must be sure this value is a V4d or you will have {0,0,0,0}.

◆ as_V4f()

Imath::V4f maquina::Value::as_V4f ( ) const

Returns the value as a V4f.

You must be sure this value is a V4f/V4d or you will have {0,0,0,0}.

◆ as_V4i()

const Imath::V4i& maquina::Value::as_V4i ( ) const

Returns the value as a V4i.

You must be sure this value is a V4i or you will have {0,0,0,0}.

◆ as_wstring()

std::wstring maquina::Value::as_wstring ( ) const

Returns the value as a wstring.

You must be sure this value is a string or you will have an empty string.

◆ duplicate()

Value maquina::Value::duplicate ( ) const

Duplicate the value.

In most cases, the duplication is a light process, i-e, the internal buffers are shared and copied-on-write

◆ get_default_value()

static Value maquina::Value::get_default_value ( const char *  type_name)
static

Return a default value for a given type.

◆ has_node_delegate()

bool maquina::Value::has_node_delegate ( ) const

Check if this value can produces a NodeDelegate.

◆ is_instance()

bool maquina::Value::is_instance ( const char *  value_type_name) const

Check if this type derives from another value type.

◆ is_interpolable()

bool maquina::Value::is_interpolable ( ) const

Checks if the value is interpolable.

This function determines whether the current value can be smoothly interpolated using interpolation methods like lerp() or weighted_sum().

Returns
True if the value is interpolable; otherwise, false.

◆ lerp()

Value maquina::Value::lerp ( const Value other,
double  weight 
) const

Performs linear interpolation between this value and another value.

This function interpolates between the current value and the specified other value based on the given weight. If the value is not interpolable, it returns this if the weight is less than or equal to 0.5, and returns other otherwise.

Parameters
otherThe value to interpolate with.
weightThe interpolation weight. A weight of 0.0 returns this, while a weight of 1.0 returns other.
Returns
The interpolated value, or this or other depending on the weight if the value is not interpolable.

◆ node_delegate()

std::shared_ptr< NodeDelegate> maquina::Value::node_delegate ( const std::shared_ptr< NodeDelegate > &  parent,
const StringView name 
) const

Build a NodeDelegate from this value. This method returns nullptr if has_node_delegate() is false.

Parameters
parentancestor of the produced delegate, typically the owner of this Value, can be nullptr
namegiven name to node delegate.

◆ operator!=()

bool maquina::Value::operator!= ( const Value o) const

◆ operator==()

bool maquina::Value::operator== ( const Value o) const

Compare the two values.

◆ type_name()

StringView maquina::Value::type_name ( ) const

Return the type name of the Value.

For basic types names are : "Int", "Bool", "Float", "String", "V2f", "V3f", "V4f", "V2i", "V3i", "V4i", "M44f", "Box3f", "Color4f", "Quat4f"

◆ validate_type_name()

static bool maquina::Value::validate_type_name ( const char *  type_name)
static

Return true if the name is a valid type name.

Member Data Documentation

◆ default_value

const Value maquina::Value::default_value
static

The default value.


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