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

#include <UN_ParmData.h>

+ Inheritance diagram for UN_ParmData:

Classes

class  IDIterator
 Iterator for traversing valid parm IDs. More...
 
class  OrderedIDIterator
 Iterator for traversing valid parm IDs in an ascending order. More...
 

Public Types

using IDRange = UT_IteratorRange< IDIterator >
 Returns a range for iterating valid parm IDs. More...
 
using OrderedIDRange = UT_IteratorRange< OrderedIDIterator >
 Returns a range for iterating valid parm IDs. More...
 
- Public Types inherited from UN_Data
using IDRange = UN_DataIndexMap::IDRange
 Returns a range for iterating valid IDs. More...
 
using OrderedIDRange = UN_DataIndexMap::OrderedIDRange
 Returns a range for iterating valid IDs in an ascending order. More...
 

Public Member Functions

 UN_ParmData (UN_CustomParmDataPtr custom_data=UN_CustomParmDataPtr())
 Constructors and destructors. More...
 
 ~UN_ParmData ()=default
 
 UN_ParmData (UN_ParmData &&)
 
UN_ParmDataoperator= (UN_ParmData &&)
 
void setCapacityIfNeeded (UN_DataSize min_capacity)
 
UN_ParmIDRemap merge (const UN_ParmData &src_parm_data)
 
UN_OptionsPtr asOptionsClassic (UN_ParmID parm_id, bool include_name=true) const
 
UN_ParmID addParm ()
 
void clearParm (UN_ParmID parm_id)
 Clears the data for the given parameter to the default state. More...
 
bool removeParm (UN_ParmID parm_id)
 
void removeAllParms (bool reset_next_id)
 
bool isValid (UN_ParmID parm_id) const
 
IDRange idRange () const
 
OrderedIDRange orderedIDRange () const
 
UN_ParmIDList parmIDs () const
 Returns a list of all the valid parm IDs in the graph. More...
 
UN_ParmIDList sortedParmIDs () const
 Returns a list of all the valid parm IDs in the graph. More...
 
UN_CustomParmDatacustomParmData ()
 Returns parm's custom data container, if one was provided. More...
 
const UN_CustomParmDatacustomParmData () const
 Returns parm's custom data container, if one was provided. More...
 
void merge (UN_ParmID parm_id, const UT_OptionEntry &parm_entry)
 Sets and configures the parameter based on the given options. More...
 
void merge (UN_ParmID parm_id, const UN_Options &parm_opts)
 Sets and configures the parameter based on the given options. More...
 
void setName (UN_ParmID parm_id, const UT_StringRef &name)
 The name of the parameter. More...
 
const UT_StringHoldername (UN_ParmID parm_id) const
 The name of the parameter. More...
 
void setTypeName (UN_ParmID parm_id, const UT_StringRef &type_name)
 The name of the parameter. More...
 
const UT_StringHoldertypeName (UN_ParmID parm_id) const
 The name of the parameter. More...
 
void setValue (UN_ParmID parm_id, const UT_OptionEntry &opt)
 The parameter value. More...
 
void setValue (UN_ParmID parm_id, UT_OptionEntryPtr &&opt)
 The parameter value. More...
 
const UT_OptionEntryPtrvalue (UN_ParmID parm_id) const
 The parameter value. More...
 
- Public Member Functions inherited from UN_Data
 UN_Data (UN_CustomDataPtr custom_data=UN_CustomDataPtr())
 Constructors and destructors. More...
 
 ~UN_Data ()=default
 
 UN_Data (UN_Data &&)
 Move operators. More...
 
UN_Dataoperator= (UN_Data &&)
 
IDRange idRange () const
 
OrderedIDRange orderedIDRange () const
 
UN_DataIDList dataIDs () const
 Returns a list of all the valid IDs in this container. More...
 
UN_DataIDList sortedDataIDs () const
 Returns a sorted list of all the valid IDs in this container. More...
 
UN_DataSize size () const
 Returns the number of valid data items in the buffer. More...
 
UN_DataSize indexSize () const
 
UN_DataSize idSize () const
 
template<typename D >
UN_GenericBufferID addGenericBuffer (const UT_StringRef &name, UN_GenericBufferType type, const D &default_value)
 
UN_GenericBufferType genericBufferType (UN_GenericBufferID id) const
 Returns the type of the generic buffer identified by the given ID. More...
 
UN_GenericBufferID findGenericBuffer (const UT_StringRef &name) const
 
const UT_StringHoldergenericBufferName (UN_GenericBufferID id) const
 Returns the name of the generic buffer identified by the given ID. More...
 
UN_CustomDatacustomData ()
 Returns the custom data container, if one was provided. More...
 
const UN_CustomDatacustomData () const
 Returns the custom data container, if one was provided. More...
 

Protected Member Functions

 UN_ParmData (const UN_ParmData &)=default
 
UN_ParmDataoperator= (const UN_ParmData &)=default
 
UN_ParmIndex parmIndex (UN_ParmID id) const
 Returns the parm's data index into the data buffer arrays. More...
 
- Protected Member Functions inherited from UN_Data
 UN_Data (const UN_Data &)
 
UN_Dataoperator= (const UN_Data &)
 
UN_DataMergeInfo mergeData (const UN_Data &src_data, bool combine_id_zero=false)
 
std::pair< UN_DataID,
UN_DataIndex
addData ()
 
std::pair< UN_DataID,
UN_DataIndex
findOrAddData (UN_DataID data_id)
 
bool removeData (UN_DataID data_id)
 
void removeAllData (bool reset_next_id)
 
bool isValid (UN_DataID data_id) const
 
UN_DataIndex dataIndex (UN_DataID id) const
 
UN_DataSize dataBufferSize () const
 
UN_DataSize freeDataBufferSize () const
 
UN_DataSize usedDataBufferSize () const
 
template<typename V , typename B >
void setData (B &buffer, UN_DataID id, const V &value)
 Helper method to copy-assign the value to an entry in the data buffer. More...
 
template<typename V , typename B >
void setData (B &buffer, UN_DataID id, V &&value)
 Helper method to move-assign the value to an entry in the data buffer. More...
 
template<typename V , typename B >
const V & getDataRef (const B &buffer, UN_DataID id, const V &default_value) const
 Helper method to return a const ref to an entry in the data buffer. More...
 
template<typename V , typename B >
getDataVal (const B &buffer, UN_DataID id, const V &default_value) const
 
template<typename V , typename B >
stealData (B &buffer, UN_DataID id, const V &default_value)
 Helper method to return a value moved from an entry in the data buffer. More...
 
template<typename OP , typename B >
void updateData (B &buffer, UN_DataID id, const OP &op)
 
template<typename T >
void setGenericData (UN_GenericBufferID buf_id, UN_DataID id, const T &value)
 Sets the data value in a generic buffer for a given data ID. More...
 
template<typename T >
void setGenericData (UN_GenericBufferID buf_id, UN_DataID id, T &&value)
 Sets the data value in a generic buffer via move. More...
 
template<typename T >
const TgenericDataRef (UN_GenericBufferID buf_id, UN_DataID id) const
 Returns a const ref to the data value in a generic buffer. More...
 
template<typename T >
T genericDataVal (UN_GenericBufferID buf_id, UN_DataID id) const
 
template<typename T >
T stealGenericData (UN_GenericBufferID buf_id, UN_DataID id)
 Moves the data value out of a generic buffer. More...
 
template<typename T , typename OP >
void updateGenericData (UN_GenericBufferID buf_id, UN_DataID id, const OP &op)
 Updates the data value in a generic buffer in-place via a callable. More...
 
void addGenericData (UN_DataIndex index)
 Adds a data slot at the given index to all generic buffers. More...
 
void clearGenericData (UN_DataIndex index)
 Clears the generic data at the given index to defaults. More...
 
void removeAllGenericData ()
 Removes all data from all generic buffers. More...
 
void setGenericDataCapacityIfNeeded (UN_DataSize min_capacity)
 Grows all generic buffers to the given minimum capacity. More...
 
void mergeGenericData (const UN_Data &src, const UN_DataMergeInfo &merge_info)
 Merges generic data from another UN_Data container. More...
 
bool isGenericDataSizeConsistent (UN_DataSize expected_size) const
 Returns true if all generic buffers have the expected size. More...
 

Protected Attributes

friend UN_GraphData
 

Detailed Description

Container of data for all the parameters in the graph.

NOTE: This class is generally not trivially relocatable, because its base class (UN_Data) is not trivially relocatable (see comment there).

Definition at line 30 of file UN_ParmData.h.

Member Typedef Documentation

Returns a range for iterating valid parm IDs.

Definition at line 142 of file UN_ParmData.h.

Returns a range for iterating valid parm IDs.

Definition at line 150 of file UN_ParmData.h.

Constructor & Destructor Documentation

UN_ParmData::UN_ParmData ( UN_CustomParmDataPtr  custom_data = UN_CustomParmDataPtr())

Constructors and destructors.

UN_ParmData::~UN_ParmData ( )
default
UN_ParmData::UN_ParmData ( UN_ParmData &&  )
UN_ParmData::UN_ParmData ( const UN_ParmData )
protecteddefault

Member Function Documentation

UN_ParmID UN_ParmData::addParm ( )

Adds a slot for a new parameter in this container. Returns an ID that should be used to refer to this new parameter for accessing its data (eg, name, value, etc).

UN_OptionsPtr UN_ParmData::asOptionsClassic ( UN_ParmID  parm_id,
bool  include_name = true 
) const

Returns the options object representing this parameter data, such as name, type and value. This can be then used for serialization to JSON, etc.

Parameters
include_nameIf true, the result will contain the entry for the node name; otherwise, the name will be skipped.
void UN_ParmData::clearParm ( UN_ParmID  parm_id)

Clears the data for the given parameter to the default state.

UN_CustomParmData* UN_ParmData::customParmData ( )
inline

Returns parm's custom data container, if one was provided.

Definition at line 55 of file UN_ParmData.h.

const UN_CustomParmData* UN_ParmData::customParmData ( ) const
inline

Returns parm's custom data container, if one was provided.

Definition at line 60 of file UN_ParmData.h.

IDRange UN_ParmData::idRange ( ) const
inline

Definition at line 143 of file UN_ParmData.h.

bool UN_ParmData::isValid ( UN_ParmID  parm_id) const
inline

Returns true if the given ID refers to a valid parm entry in the data buffers. Ie, such a parm exists and is valid.

Definition at line 108 of file UN_ParmData.h.

UN_ParmIDRemap UN_ParmData::merge ( const UN_ParmData src_parm_data)

Merges another parameter data container into this one. Returns a mapping between the data IDs in the merge source and destination (this) data buffers.

void UN_ParmData::merge ( UN_ParmID  parm_id,
const UT_OptionEntry parm_entry 
)

Sets and configures the parameter based on the given options.

void UN_ParmData::merge ( UN_ParmID  parm_id,
const UN_Options parm_opts 
)

Sets and configures the parameter based on the given options.

const UT_StringHolder& UN_ParmData::name ( UN_ParmID  parm_id) const

The name of the parameter.

UN_ParmData& UN_ParmData::operator= ( UN_ParmData &&  )
UN_ParmData& UN_ParmData::operator= ( const UN_ParmData )
protecteddefault
OrderedIDRange UN_ParmData::orderedIDRange ( ) const
inline

Definition at line 151 of file UN_ParmData.h.

UN_ParmIDList UN_ParmData::parmIDs ( ) const
inline

Returns a list of all the valid parm IDs in the graph.

Definition at line 158 of file UN_ParmData.h.

UN_ParmIndex UN_ParmData::parmIndex ( UN_ParmID  id) const
inlineprotected

Returns the parm's data index into the data buffer arrays.

Definition at line 196 of file UN_ParmData.h.

void UN_ParmData::removeAllParms ( bool  reset_next_id)

Frees the data slots occupied by all the parameters.

Parameters
'reset_next_id'If true, the node ID generator is reset to zero.
bool UN_ParmData::removeParm ( UN_ParmID  parm_id)

Removes the parameter from this container and frees the data slot it occupied. After calling this method the container will have no knowledge of the parameter by this ID. Returns true on successs; false if the parameter was not found.

void UN_ParmData::setCapacityIfNeeded ( UN_DataSize  min_capacity)

Increases the capacity of the data buffer arrays to the given minimum, unless the capacity is already greater or equal to that minimum, in which case the capacity remains unchanged.

void UN_ParmData::setName ( UN_ParmID  parm_id,
const UT_StringRef name 
)

The name of the parameter.

void UN_ParmData::setTypeName ( UN_ParmID  parm_id,
const UT_StringRef type_name 
)

The name of the parameter.

void UN_ParmData::setValue ( UN_ParmID  parm_id,
const UT_OptionEntry opt 
)

The parameter value.

void UN_ParmData::setValue ( UN_ParmID  parm_id,
UT_OptionEntryPtr &&  opt 
)

The parameter value.

UN_ParmIDList UN_ParmData::sortedParmIDs ( ) const
inline

Returns a list of all the valid parm IDs in the graph.

Definition at line 165 of file UN_ParmData.h.

const UT_StringHolder& UN_ParmData::typeName ( UN_ParmID  parm_id) const

The name of the parameter.

const UT_OptionEntryPtr& UN_ParmData::value ( UN_ParmID  parm_id) const

The parameter value.

Member Data Documentation

friend UN_ParmData::UN_GraphData
protected

This container can have large data, so generally, forbid the costly copy operations to the public. Knowledgable friends and derived classes can still use them.

Definition at line 44 of file UN_ParmData.h.


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