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

#include <UN_WireData.h>

+ Inheritance diagram for UN_WireData:

Classes

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

Public Types

using IDRange = UT_IteratorRange< IDIterator >
 Returns a range for iterating valid wire IDs. More...
 
using OrderedIDRange = UT_IteratorRange< OrderedIDIterator >
 Returns a range for iterating valid wire 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_WireData (UN_CustomWireDataPtr custom_data=UN_CustomWireDataPtr())
 Constructors and destructors. More...
 
 ~UN_WireData ()=default
 
 UN_WireData (UN_WireData &&)
 
UN_WireDataoperator= (UN_WireData &&)
 
void setCapacityIfNeeded (UN_DataSize min_capacity)
 
UN_WireIDRemap merge (const UN_WireData &src_wire_data)
 
UN_WireID addWire ()
 
void clearWire (UN_WireID wire_id)
 Clears the data for the given wire to the default state. More...
 
bool removeWire (UN_WireID wire_id)
 
void removeAllWires (bool reset_next_id)
 
bool isValid (UN_WireID wire_id) const
 
IDRange idRange () const
 
OrderedIDRange orderedIDRange () const
 
UN_WireIDList wireIDs () const
 Returns a list of all the valid wire IDs in the graph. More...
 
UN_WireIDList sortedWireIDs () const
 Returns a list of all the valid wire IDs in the graph. More...
 
template<typename T >
void setGenericData (UN_GenericBufferID buf_id, UN_WireID wire_id, const T &value)
 Sets the data value in a generic buffer for a given wire. More...
 
template<typename T >
void setGenericData (UN_GenericBufferID buf_id, UN_WireID wire_id, T &&value)
 Sets the data value in a generic buffer via move. More...
 
template<typename T >
const TgenericDataRef (UN_GenericBufferID buf_id, UN_WireID wire_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_WireID wire_id) const
 Returns a copy of a data value from a generic buffer. More...
 
template<typename T >
T stealGenericData (UN_GenericBufferID buf_id, UN_WireID wire_id)
 Moves the data value out of a generic buffer. More...
 
template<typename T , typename OP >
void updateGenericData (UN_GenericBufferID buf_id, UN_WireID wire_id, const OP &op)
 Updates the data value in a generic buffer in-place via a callable. More...
 
UN_CustomWireDatacustomWireData ()
 Returns wire's custom data container, if one was provided to c-tor. More...
 
const UN_CustomWireDatacustomWireData () const
 Returns wire'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_WireData (const UN_WireData &)=default
 
UN_WireDataoperator= (const UN_WireData &)=default
 
UN_WireIndex wireIndex (UN_WireID id) const
 Returns the wire'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 wires 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_WireData.h.

Member Typedef Documentation

Returns a range for iterating valid wire IDs.

Definition at line 125 of file UN_WireData.h.

Returns a range for iterating valid wire IDs.

Definition at line 133 of file UN_WireData.h.

Constructor & Destructor Documentation

UN_WireData::UN_WireData ( UN_CustomWireDataPtr  custom_data = UN_CustomWireDataPtr())

Constructors and destructors.

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

Member Function Documentation

UN_WireID UN_WireData::addWire ( )

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

void UN_WireData::clearWire ( UN_WireID  wire_id)

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

UN_CustomWireData* UN_WireData::customWireData ( )
inline

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

Definition at line 55 of file UN_WireData.h.

const UN_CustomWireData* UN_WireData::customWireData ( ) const
inline

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

Definition at line 60 of file UN_WireData.h.

template<typename T >
const T& UN_WireData::genericDataRef ( UN_GenericBufferID  buf_id,
UN_WireID  wire_id 
) const
inline

Returns a const ref to the data value in a generic buffer.

Definition at line 170 of file UN_WireData.h.

template<typename T >
T UN_WireData::genericDataVal ( UN_GenericBufferID  buf_id,
UN_WireID  wire_id 
) const
inline

Returns a copy of a data value from a generic buffer.

Definition at line 176 of file UN_WireData.h.

IDRange UN_WireData::idRange ( ) const
inline

Definition at line 126 of file UN_WireData.h.

bool UN_WireData::isValid ( UN_WireID  wire_id) const
inline

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

Definition at line 91 of file UN_WireData.h.

UN_WireIDRemap UN_WireData::merge ( const UN_WireData src_wire_data)

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

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

Definition at line 134 of file UN_WireData.h.

void UN_WireData::removeAllWires ( bool  reset_next_id)

Frees the data slots occupied by all the wires.

Parameters
'reset_next_id'If true, the wire ID generator is reset to zero.
bool UN_WireData::removeWire ( UN_WireID  wire_id)

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

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

template<typename T >
void UN_WireData::setGenericData ( UN_GenericBufferID  buf_id,
UN_WireID  wire_id,
const T value 
)
inline

Sets the data value in a generic buffer for a given wire.

Definition at line 158 of file UN_WireData.h.

template<typename T >
void UN_WireData::setGenericData ( UN_GenericBufferID  buf_id,
UN_WireID  wire_id,
T &&  value 
)
inline

Sets the data value in a generic buffer via move.

Definition at line 164 of file UN_WireData.h.

UN_WireIDList UN_WireData::sortedWireIDs ( ) const
inline

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

Definition at line 148 of file UN_WireData.h.

template<typename T >
T UN_WireData::stealGenericData ( UN_GenericBufferID  buf_id,
UN_WireID  wire_id 
)
inline

Moves the data value out of a generic buffer.

Definition at line 182 of file UN_WireData.h.

template<typename T , typename OP >
void UN_WireData::updateGenericData ( UN_GenericBufferID  buf_id,
UN_WireID  wire_id,
const OP &  op 
)
inline

Updates the data value in a generic buffer in-place via a callable.

Definition at line 187 of file UN_WireData.h.

UN_WireIDList UN_WireData::wireIDs ( ) const
inline

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

Definition at line 141 of file UN_WireData.h.

UN_WireIndex UN_WireData::wireIndex ( UN_WireID  id) const
inlineprotected

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

Definition at line 194 of file UN_WireData.h.

Member Data Documentation

friend UN_WireData::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_WireData.h.


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