Clarisse 4.0 SP9 SDK  4.0.0.0.9
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
Public Types | Public Member Functions | Static Public Member Functions | List of all members
ResourceProperty Class Reference

Class representing a property of any kind. It allows to store an array of items that can be composed of several values of the same type. More...

Inheritance diagram for ResourceProperty:
CoreBaseObject CoreBaseType

Public Types

enum  Type {
  TYPE_INT_8,
  TYPE_UINT_8,
  TYPE_INT_16,
  TYPE_UINT_16,
  TYPE_INT_32,
  TYPE_UINT_32,
  TYPE_INT_64,
  TYPE_UINT_64,
  TYPE_FLOAT_16,
  TYPE_FLOAT_32,
  TYPE_FLOAT_64,
  TYPE_CHAR,
  TYPE_WCHAR,
  TYPE_COUNT
}
 Supported value types.
 

Public Member Functions

template<typename RETURN_TYPE >
CoreArray< RETURN_TYPE > get_values_as (const unsigned int &rank=0) const
 
 ResourceProperty (const CoreString &name="")
 Constructor.
 
 ResourceProperty (const ResourceProperty &source)
 Copy constructor.
 
 ~ResourceProperty ()
 Destructor.
 
ResourcePropertyget_copy () const
 Get a copy of the current property.
 
void init (const Type &type, const unsigned int &item_value_count, const unsigned int &item_count)
 Init the items of the property with the same number of values.
 
void init (const Type &type, const unsigned int *item_value_count, const unsigned int &item_count)
 Init the items of the property with different numbers of values.
 
bool remap (const unsigned int &item_value_count, const unsigned int &item_count)
 Remap the items and keep the existing data.
 
void set_name (const CoreString &name)
 Set the name of the property.
 
void set_values (const void *values)
 Set all the values at once.
 
void set_values (const void *values0, const void *values1, const double &weight)
 Set all the values at once by blending between two sets.
 
void set_item_values (const unsigned int &item_index, const void *values, const unsigned int count=1)
 Set values of an item.
 
bool set_string (const unsigned int &item_index, const char *s)
 Set values of an item as a string.
 
bool set_wstring (const unsigned int &item_index, const wchar_t *s)
 Set values of an item as a wide string.
 
bool set_byte (const unsigned int &item_index, const CoreBasicArray< char > &v)
 Set values of an item as an array of byte.
 
bool set_byte (const unsigned int &item_index, const char &v, const unsigned int &rank=0)
 Set a value of an item as a byte.
 
bool set_short (const unsigned int &item_index, const CoreBasicArray< short > &v)
 Set values of an item as an array of short.
 
bool set_short (const unsigned int &item_index, const short &v, const unsigned int &rank=0)
 Set a value of an item as a short.
 
bool set_int (const unsigned int &item_index, const CoreBasicArray< int > &v)
 Set values of an item as an array of int.
 
bool set_int (const unsigned int &item_index, const int &v, const unsigned int &rank=0)
 Set a value of an item as an int.
 
bool set_long (const unsigned int &item_index, const CoreBasicArray< long long > &v)
 Set values of an item as an array of long.
 
bool set_long (const unsigned int &item_index, const long long &v, const unsigned int &rank=0)
 Set a value of an item as a long.
 
bool set_half (const unsigned int &item_index, const CoreBasicArray< GMathHalfFloat > &v)
 Set values of an item as an array of half float.
 
bool set_half (const unsigned int &item_index, const GMathHalfFloat &v, const unsigned int &rank=0)
 Set a value of an item as a half float.
 
bool set_float (const unsigned int &item_index, const CoreBasicArray< float > &v)
 Set values of an item as an array of float.
 
bool set_float (const unsigned int &item_index, const float &v, const unsigned int &rank=0)
 Set a value of an item as a float.
 
bool set_double (const unsigned int &item_index, const CoreBasicArray< double > &v)
 Set values of an item as an array of double.
 
bool set_double (const unsigned int &item_index, const double &v, const unsigned int &rank=0)
 Set a value of an item as a double.
 
size_t get_memory_size () const
 Get the size of the property in memory.
 
const CoreStringget_name () const
 Get the name of the property.
 
const Typeget_value_type () const
 Get the type of values.
 
const size_t & get_value_size () const
 Get the size of a value.
 
const unsigned int & get_item_count () const
 Get the number of items.
 
unsigned int get_value_count () const
 Get the total number of values stored in the property.
 
unsigned int get_item_value_count (const unsigned int &item_index) const
 Get the number of values for an item.
 
unsigned int get_item_value_offset (const unsigned int &item_index) const
 Get the index of the first value of an item.
 
const void * get_values () const
 Get all values.
 
const void * get_value (const unsigned int &value_index) const
 Get a value.
 
const void * get_item_values (const unsigned int &item_index) const
 Get the values of an item.
 
const char * get_string (const unsigned int &item_index) const
 Get values of an item as a string.
 
const wchar_t * get_wstring (const unsigned int &item_index) const
 Get values of an item as a wide string.
 
CoreBasicArray< char > get_byte (const unsigned int &item_index) const
 Get values of an item as an array of char.
 
char get_byte_value (const unsigned int &item_index, const unsigned int &rank=0) const
 Get values of an item as an array of char.
 
CoreBasicArray< short > get_short (const unsigned int &item_index) const
 Get values of an item as an array of short.
 
short get_short_value (const unsigned int &item_index, const unsigned int &rank=0) const
 Get values of an item as an array of short.
 
CoreBasicArray< int > get_int (const unsigned int &item_index) const
 Get values of an item as an array of int.
 
int get_int_value (const unsigned int &item_index, const unsigned int &rank=0) const
 Get values of an item as an array of int.
 
CoreBasicArray< long long > get_long (const unsigned int &item_index) const
 Get values of an item as an array of long.
 
long long get_long_value (const unsigned int &item_index, const unsigned int &rank=0) const
 Get values of an item as an array of long.
 
CoreBasicArray< GMathHalfFloatget_half (const unsigned int &item_index) const
 Get values of an item as an array of half float.
 
GMathHalfFloat get_half_value (const unsigned int &item_index, const unsigned int &rank=0) const
 Get values of an item as an array of half float.
 
CoreBasicArray< float > get_float (const unsigned int &item_index) const
 Get values of an item as an array of float.
 
float get_float_value (const unsigned int &item_index, const unsigned int &rank=0) const
 Get values of an item as an array of float.
 
CoreBasicArray< double > get_double (const unsigned int &item_index) const
 Get values of an item as an array of double.
 
double get_double_value (const unsigned int &item_index, const unsigned int &rank=0) const
 Get values of an item as an array of double.
 
bool is_homogeneous () const
 Tells if all the items have the same number of values.
 
size_t get_serial_size () const
 
bool serialize (CoreSerial &serial) const
 
bool deserialize (CoreSerial &serial)
 
CoreString get_type_description () const
 
- Public Member Functions inherited from CoreBaseObject
bool is_kindof (const CoreBaseObject &object) const
 
CoreString get_class_info_name () const
 
CoreString get_class_interface () const
 
const unsigned long & get_class_info_id () const
 
bool is_kindof (const CoreClassInfo &cinfo) const
 
virtual const CoreClassInfoget_class_info () const
 
bool operator== (const CoreBaseObject &obj) const
 
template<class T >
T * cast ()
 
template<class T >
const T * cast () const
 
- Public Member Functions inherited from CoreBaseType
bool is_kindof (const CoreClassInfo &cinfo) const
 
bool operator== (const CoreBaseType &obj) const
 

Static Public Member Functions

static const size_t & get_type_size (const Type &type)
 
static const char * get_type_name (Type type)
 
- Static Public Member Functions inherited from CoreBaseObject
static const CoreClassInfoclass_info ()
 
static bool ___class_destructor__ (void *instance, const bool &is_array)
 
template<class T >
static T * cast (CoreBaseObject *object)
 
template<class T >
static const T * cast (const CoreBaseObject *object)
 
- Static Public Member Functions inherited from CoreBaseType
static bool ___class_destructor__ (void *instance, const bool &is_array)
 
static const CoreClassInfoclass_info ()
 

Detailed Description

Class representing a property of any kind. It allows to store an array of items that can be composed of several values of the same type.

Constructor & Destructor Documentation

ResourceProperty::ResourceProperty ( const CoreString name = "")
explicit

Constructor.

Parameters
[in]namethe name of the property
ResourceProperty::ResourceProperty ( const ResourceProperty source)

Copy constructor.

Parameters
[in]sourcethe property to copy

Member Function Documentation

CoreBasicArray<char> ResourceProperty::get_byte ( const unsigned int &  item_index) const
inline

Get values of an item as an array of char.

Parameters
[in]item_indexthe index of the item
Returns
an array of char
char ResourceProperty::get_byte_value ( const unsigned int &  item_index,
const unsigned int &  rank = 0 
) const
inline

Get values of an item as an array of char.

Parameters
[in]item_indexthe index of the item
[in]rankthe rank of the value
Returns
the value at the specified index and rank
CoreBasicArray<double> ResourceProperty::get_double ( const unsigned int &  item_index) const
inline

Get values of an item as an array of double.

Parameters
[in]item_indexthe index of the item
Returns
an array of double
double ResourceProperty::get_double_value ( const unsigned int &  item_index,
const unsigned int &  rank = 0 
) const
inline

Get values of an item as an array of double.

Parameters
[in]item_indexthe index of the item
[in]rankthe rank of the value
Returns
the value at the specified index and rank
CoreBasicArray<float> ResourceProperty::get_float ( const unsigned int &  item_index) const
inline

Get values of an item as an array of float.

Parameters
[in]item_indexthe index of the item
Returns
an array of float
float ResourceProperty::get_float_value ( const unsigned int &  item_index,
const unsigned int &  rank = 0 
) const
inline

Get values of an item as an array of float.

Parameters
[in]item_indexthe index of the item
[in]rankthe rank of the value
Returns
the value at the specified index and rank
CoreBasicArray<GMathHalfFloat> ResourceProperty::get_half ( const unsigned int &  item_index) const
inline

Get values of an item as an array of half float.

Parameters
[in]item_indexthe index of the item
Returns
an array of half float
GMathHalfFloat ResourceProperty::get_half_value ( const unsigned int &  item_index,
const unsigned int &  rank = 0 
) const

Get values of an item as an array of half float.

Parameters
[in]item_indexthe index of the item
[in]rankthe rank of the value
Returns
the value at the specified index and rank
CoreBasicArray<int> ResourceProperty::get_int ( const unsigned int &  item_index) const
inline

Get values of an item as an array of int.

Parameters
[in]item_indexthe index of the item
Returns
an array of int
int ResourceProperty::get_int_value ( const unsigned int &  item_index,
const unsigned int &  rank = 0 
) const
inline

Get values of an item as an array of int.

Parameters
[in]item_indexthe index of the item
[in]rankthe rank of the value
Returns
the value at the specified index and rank
const unsigned int& ResourceProperty::get_item_count ( ) const
inline

Get the number of items.

Returns
the number of items
unsigned int ResourceProperty::get_item_value_count ( const unsigned int &  item_index) const
inline

Get the number of values for an item.

Parameters
[in]item_indexthe index of the item
Returns
the number of values for the given item
unsigned int ResourceProperty::get_item_value_offset ( const unsigned int &  item_index) const
inline

Get the index of the first value of an item.

Parameters
[in]item_indexthe index of the item
Returns
the index of the first value
const void* ResourceProperty::get_item_values ( const unsigned int &  item_index) const
inline

Get the values of an item.

Parameters
[in]item_indexthe index of the item
Returns
a pointer to the values of the item
CoreBasicArray<long long> ResourceProperty::get_long ( const unsigned int &  item_index) const
inline

Get values of an item as an array of long.

Parameters
[in]item_indexthe index of the item
Returns
an array of long
long long ResourceProperty::get_long_value ( const unsigned int &  item_index,
const unsigned int &  rank = 0 
) const
inline

Get values of an item as an array of long.

Parameters
[in]item_indexthe index of the item
[in]rankthe rank of the value
Returns
the value at the specified index and rank
size_t ResourceProperty::get_memory_size ( void  ) const
virtual

Get the size of the property in memory.

Returns
the size in bytes

Reimplemented from CoreBaseObject.

const CoreString& ResourceProperty::get_name ( ) const
inline

Get the name of the property.

Returns
the name of the property
CoreBasicArray<short> ResourceProperty::get_short ( const unsigned int &  item_index) const
inline

Get values of an item as an array of short.

Parameters
[in]item_indexthe index of the item
Returns
an array of short
short ResourceProperty::get_short_value ( const unsigned int &  item_index,
const unsigned int &  rank = 0 
) const
inline

Get values of an item as an array of short.

Parameters
[in]item_indexthe index of the item
[in]rankthe rank of the value
Returns
the value at the specified index and rank
const char* ResourceProperty::get_string ( const unsigned int &  item_index) const
inline

Get values of an item as a string.

Parameters
[in]item_indexthe index of the item
Returns
the string contained in the item
CoreString ResourceProperty::get_type_description ( ) const

Get a description of the property type as a string.

Output format: value_type[item_value_count][item_count].
Example: the description of a property containing 10 vec3 of 32 bits float = FLOAT_32[3][10].

const char * ResourceProperty::get_type_name ( Type  type)
static

Get the name of a ResourceProperty::Type as a string.

const void* ResourceProperty::get_value ( const unsigned int &  value_index) const
inline

Get a value.

Parameters
[in]value_indexthe absolute index of the value in the array of all values
Returns
a pointer to the value
unsigned int ResourceProperty::get_value_count ( ) const
inline

Get the total number of values stored in the property.

Returns
the total number of values
const size_t& ResourceProperty::get_value_size ( ) const
inline

Get the size of a value.

Returns
the size of a value
const Type& ResourceProperty::get_value_type ( ) const
inline

Get the type of values.

Returns
the type of values
const void* ResourceProperty::get_values ( ) const
inline

Get all values.

Returns
a pointer to values
const wchar_t* ResourceProperty::get_wstring ( const unsigned int &  item_index) const
inline

Get values of an item as a wide string.

Parameters
[in]item_indexthe index of the item
Returns
the wide string contained in the item
void ResourceProperty::init ( const Type type,
const unsigned int &  item_value_count,
const unsigned int &  item_count 
)

Init the items of the property with the same number of values.

Parameters
[in]typethe type of values stored in each item
[in]item_value_countnumber of values per item
[in]item_countthe number of items
void ResourceProperty::init ( const Type type,
const unsigned int *  item_value_count,
const unsigned int &  item_count 
)

Init the items of the property with different numbers of values.

Parameters
[in]typethe type of values stored in each item
[in]item_value_countarray containing the number of values for each item
[in]item_countthe number of items
bool ResourceProperty::is_homogeneous ( ) const
inline

Tells if all the items have the same number of values.

Returns
true if items have the same number of values, else false
bool ResourceProperty::remap ( const unsigned int &  item_value_count,
const unsigned int &  item_count 
)

Remap the items and keep the existing data.

Parameters
[in]item_value_countnumber of values per item
[in]item_countthe number of items
Returns
true if the operation is possible (same total number of values) else false
bool ResourceProperty::set_byte ( const unsigned int &  item_index,
const CoreBasicArray< char > &  v 
)

Set values of an item as an array of byte.

Parameters
[in]item_indexthe index of the item
[in]vthe array of byte
Returns
true if the operation is possible, else false
bool ResourceProperty::set_byte ( const unsigned int &  item_index,
const char &  v,
const unsigned int &  rank = 0 
)

Set a value of an item as a byte.

Parameters
[in]item_indexthe index of the item
[in]vthe value
[in]rankthe rank of the value
Returns
true if the operation is possible, else false
bool ResourceProperty::set_double ( const unsigned int &  item_index,
const CoreBasicArray< double > &  v 
)

Set values of an item as an array of double.

Parameters
[in]item_indexthe index of the item
[in]vthe array of double
Returns
true if the operation is possible, else false
bool ResourceProperty::set_double ( const unsigned int &  item_index,
const double &  v,
const unsigned int &  rank = 0 
)

Set a value of an item as a double.

Parameters
[in]item_indexthe index of the item
[in]vthe value
[in]rankthe rank of the value
Returns
true if the operation is possible, else false
bool ResourceProperty::set_float ( const unsigned int &  item_index,
const CoreBasicArray< float > &  v 
)

Set values of an item as an array of float.

Parameters
[in]item_indexthe index of the item
[in]vthe array of float
Returns
true if the operation is possible, else false
bool ResourceProperty::set_float ( const unsigned int &  item_index,
const float &  v,
const unsigned int &  rank = 0 
)

Set a value of an item as a float.

Parameters
[in]item_indexthe index of the item
[in]vthe value
[in]rankthe rank of the value
Returns
true if the operation is possible, else false
bool ResourceProperty::set_half ( const unsigned int &  item_index,
const CoreBasicArray< GMathHalfFloat > &  v 
)

Set values of an item as an array of half float.

Parameters
[in]item_indexthe index of the item
[in]vthe array of half float
Returns
true if the operation is possible, else false
bool ResourceProperty::set_half ( const unsigned int &  item_index,
const GMathHalfFloat v,
const unsigned int &  rank = 0 
)

Set a value of an item as a half float.

Parameters
[in]item_indexthe index of the item
[in]vthe value
[in]rankthe rank of the value
Returns
true if the operation is possible, else false
bool ResourceProperty::set_int ( const unsigned int &  item_index,
const CoreBasicArray< int > &  v 
)

Set values of an item as an array of int.

Parameters
[in]item_indexthe index of the item
[in]vthe array of int
Returns
true if the operation is possible, else false
bool ResourceProperty::set_int ( const unsigned int &  item_index,
const int &  v,
const unsigned int &  rank = 0 
)

Set a value of an item as an int.

Parameters
[in]item_indexthe index of the item
[in]vthe value
[in]rankthe rank of the value
Returns
true if the operation is possible, else false
void ResourceProperty::set_item_values ( const unsigned int &  item_index,
const void *  values,
const unsigned int  count = 1 
)

Set values of an item.

Parameters
[in]item_indexthe index of the item
[in]valuesbuffer containing the values of the item
[in]countnumber of contiguous items to set
bool ResourceProperty::set_long ( const unsigned int &  item_index,
const CoreBasicArray< long long > &  v 
)

Set values of an item as an array of long.

Parameters
[in]item_indexthe index of the item
[in]vthe array of long
Returns
true if the operation is possible, else false
bool ResourceProperty::set_long ( const unsigned int &  item_index,
const long long &  v,
const unsigned int &  rank = 0 
)

Set a value of an item as a long.

Parameters
[in]item_indexthe index of the item
[in]vthe value
[in]rankthe rank of the value
Returns
true if the operation is possible, else false
void ResourceProperty::set_name ( const CoreString name)
inline

Set the name of the property.

Parameters
[in]namethe name of the property
bool ResourceProperty::set_short ( const unsigned int &  item_index,
const CoreBasicArray< short > &  v 
)

Set values of an item as an array of short.

Parameters
[in]item_indexthe index of the item
[in]vthe array of short
Returns
true if the operation is possible, else false
bool ResourceProperty::set_short ( const unsigned int &  item_index,
const short &  v,
const unsigned int &  rank = 0 
)

Set a value of an item as a short.

Parameters
[in]item_indexthe index of the item
[in]vthe value
[in]rankthe rank of the value
Returns
true if the operation is possible, else false
bool ResourceProperty::set_string ( const unsigned int &  item_index,
const char *  s 
)

Set values of an item as a string.

Parameters
[in]item_indexthe index of the item
[in]sstring to set
Returns
true if the operation is possible, else false
void ResourceProperty::set_values ( const void *  values)

Set all the values at once.

Parameters
[in]valuesbuffer containing all the values of the property
void ResourceProperty::set_values ( const void *  values0,
const void *  values1,
const double &  weight 
)

Set all the values at once by blending between two sets.

Parameters
[in]values0buffer containing the first values of the property
[in]values1buffer containing the second values of the property
[in]weightblending weight between values0 and values1
bool ResourceProperty::set_wstring ( const unsigned int &  item_index,
const wchar_t *  s 
)

Set values of an item as a wide string.

Parameters
[in]item_indexthe index of the item
[in]swide string to set
Returns
true if the operation is possible, else false