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

#include <UN_SubnetData.h>

+ Inheritance diagram for UN_SubnetData:

Classes

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

Public Types

using IDRange = UT_IteratorRange< IDIterator >
 Returns a range for iterating valid subnet IDs. More...
 
using OrderedIDRange = UT_IteratorRange< OrderedIDIterator >
 Returns a range for iterating valid subnet 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_SubnetData (UN_CustomSubnetDataPtr custom_data=UN_CustomSubnetDataPtr())
 Constructors and destructors. More...
 
 ~UN_SubnetData ()=default
 
 UN_SubnetData (UN_SubnetData &&)
 
UN_SubnetDataoperator= (UN_SubnetData &&)
 
void setCapacityIfNeeded (UN_DataSize min_capacity)
 
UN_SubnetIDRemap merge (const UN_SubnetData &src_subnet_data)
 
UN_SubnetID addSubnet ()
 
UN_SubnetID findOrAddRootSubnet ()
 Adds a root subnet or returns one if it already exists. More...
 
void clearSubnet (UN_SubnetID subnet_id)
 Clears the data for the given subnet to the default state. More...
 
bool removeSubnet (UN_SubnetID subnet_id)
 
void removeAllSubnets (bool reset_next_id)
 
bool isValid (UN_SubnetID subnet_id) const
 
IDRange idRange () const
 
OrderedIDRange orderedIDRange () const
 
UN_SubnetIDList subnetIDs () const
 Returns a list of all the valid subnet IDs in the graph. More...
 
UN_SubnetIDList sortedSubnetIDs () const
 Returns a list of all the valid subnet IDs in the graph. More...
 
UN_CustomSubnetDatacustomSubnetData ()
 Returns subnet's custom data container, if one was provided to c-tor. More...
 
const UN_CustomSubnetDatacustomSubnetData () const
 Returns subnet's custom data container, if one was provided to c-tor. 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_SubnetData (const UN_SubnetData &)=default
 
UN_SubnetDataoperator= (const UN_SubnetData &)=default
 
UN_SubnetIndex subnetIndex (UN_SubnetID id) const
 Returns the subnet 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 subnetworks 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_SubnetData.h.

Member Typedef Documentation

Returns a range for iterating valid subnet IDs.

Definition at line 129 of file UN_SubnetData.h.

Returns a range for iterating valid subnet IDs.

Definition at line 137 of file UN_SubnetData.h.

Constructor & Destructor Documentation

UN_SubnetData::UN_SubnetData ( UN_CustomSubnetDataPtr  custom_data = UN_CustomSubnetDataPtr())

Constructors and destructors.

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

Member Function Documentation

UN_SubnetID UN_SubnetData::addSubnet ( )

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

void UN_SubnetData::clearSubnet ( UN_SubnetID  subnet_id)

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

UN_CustomSubnetData* UN_SubnetData::customSubnetData ( )
inline

Returns subnet's custom data container, if one was provided to c-tor.

Definition at line 56 of file UN_SubnetData.h.

const UN_CustomSubnetData* UN_SubnetData::customSubnetData ( ) const
inline

Returns subnet's custom data container, if one was provided to c-tor.

Definition at line 61 of file UN_SubnetData.h.

UN_SubnetID UN_SubnetData::findOrAddRootSubnet ( )

Adds a root subnet or returns one if it already exists.

IDRange UN_SubnetData::idRange ( ) const
inline

Definition at line 130 of file UN_SubnetData.h.

bool UN_SubnetData::isValid ( UN_SubnetID  subnet_id) const
inline

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

Definition at line 95 of file UN_SubnetData.h.

UN_SubnetIDRemap UN_SubnetData::merge ( const UN_SubnetData src_subnet_data)

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

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

Definition at line 138 of file UN_SubnetData.h.

void UN_SubnetData::removeAllSubnets ( bool  reset_next_id)

Frees the data slots occupied by all the subnets.

Parameters
'reset_next_id'If true, the node ID generator is reset to zero.
bool UN_SubnetData::removeSubnet ( UN_SubnetID  subnet_id)

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

void UN_SubnetData::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.

UN_SubnetIDList UN_SubnetData::sortedSubnetIDs ( ) const
inline

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

Definition at line 152 of file UN_SubnetData.h.

UN_SubnetIDList UN_SubnetData::subnetIDs ( ) const
inline

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

Definition at line 145 of file UN_SubnetData.h.

UN_SubnetIndex UN_SubnetData::subnetIndex ( UN_SubnetID  id) const
inlineprotected

Returns the subnet data index into the data buffer arrays.

Definition at line 161 of file UN_SubnetData.h.

Member Data Documentation

friend UN_SubnetData::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 45 of file UN_SubnetData.h.


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