This reference page is linked to from the following overview topics: Extension for Autodesk Maya 2013, Meta Data.
Class handling a named association of a data array with other data.
This class is used in conjunction with adsk::Data::Associations. See the documentation for adsk::Data::Associations for the bigger picture in how the classes work together.
adsk::Data::Channel is responsible for maintaining a list of named data streams, where a "stream" can be thought of as equivalent to a named array of data.
The main reason for this class to exist is to allow attachment of multiple unrelated data streams. For instance a simulator can attach an arbitrary data structure to every vertex of a mesh (that's one stream) and a shader can attach a different color-based data structure to every vertex of a mesh (that's a different stream).
Having separate streams makes it easier to find and handle the stream of data in which a particular user is interested. Having this channel class manage the streams as a unit makes it easier for changes in the indexing to do the proper thing to the data in the streams all in one place (e.g. deleting one of the associated indexes will cause the matching indexed data in each of the streams to be deleted)
#include <adskDataChannel.h>
Public Member Functions | |
| ~Channel () | |
| Default destructor, disowns the implementation object. | |
| Channel () | |
| Default constructor, creates an implementation object. | |
| Channel (const std::string &) | |
| Named constructor, creates an implementation object with a specific name. | |
| Channel (const Channel &) | |
| Copy constructor, shares implementation with the rhs. | |
| Channel & | operator= (const Channel &) |
| Assignment operator, shares implementation with the rhs. | |
| bool | operator== (const Channel &) const |
| Comparison operator, checks if this channel is the same as another. | |
| Stream * | setDataStream (const Stream &newStream) |
| Set a new named data stream. | |
| const Stream * | findDataStream (const std::string &) const |
| Get the Stream with the given name, return NULL if it doesn't exist. | |
| Stream * | findDataStream (const std::string &) |
| Get the Stream with the given name, return NULL if it doesn't exist. | |
| bool | removeDataStream (const std::string &) |
| Destroy the data stream with the given name. | |
| bool | renameDataStream (const std::string &, const std::string &) |
| Rename a Stream. | |
| bool | makeUnique () |
| Make the channel data unique to this object. | |
| const std::string & | name () const |
| Get the name of this Channel, const-version. | |
| Channel::iterator | begin () const |
| Get an iterator pointed to the beginning of the Stream list. | |
| Channel::iterator | end () const |
| Get an iterator off the end of the Stream list. | |
| Channel::const_iterator | cbegin () const |
| Get a read-only iterator pointed to the beginning of the Stream list. | |
| Channel::const_iterator | cend () const |
| Get a read-only iterator off the end of the Stream list. | |
| unsigned int | size () const |
| Get the number of Streams on this Channel. | |
| bool | empty () const |
| Check to see if the Stream list is empty. | |
| bool | removeElement (const Index &elementIndex) |
| Remove a single element from this data channel. | |
| bool | addElement (const Index &elementIndex) |
| Add a new data element to the channel. | |
| unsigned int | dataStreamCount () const |
| Get the number of data streams in this channel. | |
| Stream * | dataStream (unsigned int streamIndex) |
| Get the named data stream, either const or non-const. | |
| Stream * | dataStream (const std::string &streamName) |
| Get the data stream of the given name. | |
Static Public Member Functions | |
| static bool | Debug (const Channel *me, Debug::Print &request) |
| Answer a Print request for a Channel object. | |
| static bool | Debug (const Channel *me, Debug::Footprint &request) |
| Answer a footprint request for a Channel object. | |
| Channel | ( | const std::string & | name | ) | [explicit] |
Named constructor, creates an implementation object with a specific name.
| [in] | name | Name of the Channel to construct |
Copy constructor, shares implementation with the rhs.
| [in] | rhs | Channel data to be copied |
Assignment operator, shares implementation with the rhs.
| [in] | rhs | Channel data to be copied |
| bool operator== | ( | const Channel & | rhs | ) | const |
Comparison operator, checks if this channel is the same as another.
| [in] | rhs | Channel data to be compared |
Set a new named data stream.
Does not insist that the stream name is unique; asking for it by name when there are duplicates will return the first one found. If you are creating duplicates you have to iterate to find all streams with the same name.
This method creates a copy of the stream to be owned by the channel. This will not duplicate the data in the stream, just the stream information.
| [in] | newStream | New stream to be added to the channel |
| const Stream * findDataStream | ( | const std::string & | streamName | ) | const |
| Stream * findDataStream | ( | const std::string & | streamName | ) |
| bool removeDataStream | ( | const std::string & | streamName | ) |
Destroy the data stream with the given name.
| [in] | streamName | Name of the Stream to remove |
| bool renameDataStream | ( | const std::string & | oldStreamName, |
| const std::string & | newStreamName | ||
| ) |
| bool makeUnique | ( | ) |
Make the channel data unique to this object.
Makes a copy of the data if it's currently being shared, otherwise leaves it as-is. Note that it can still be shared afterwards by some other object, i.e. this is not a persistent state, just an operation to perform before making changes you don't want any other copies of the associations to share.
| const std::string & name | ( | ) | const |
Get the name of this Channel, const-version.
| Channel::iterator begin | ( | ) | const |
| Channel::iterator end | ( | ) | const |
| Channel::iterator cbegin | ( | ) | const |
| Channel::iterator cend | ( | ) | const |
| unsigned int size | ( | ) | const |
| bool empty | ( | ) | const |
| bool removeElement | ( | const Index & | elementIndex | ) |
Remove a single element from this data channel.
| [in] | elementIndex | Index of the data to be removed |
| bool addElement | ( | const Index & | elementIndex | ) |
Add a new data element to the channel.
The data element at the new index will be filled in based on the rules/callbacks on the data stream data.
| [in] | elementIndex | Index of the data to be added |
| unsigned int dataStreamCount | ( | ) | const |
Get the number of data streams in this channel.
Same as the size() method, which has a more standard naming.
| Stream * dataStream | ( | unsigned int | streamIndex | ) |
Get the named data stream, either const or non-const.
Obsolete, use the iterator. Positioning is not guaranteed.
| [in] | streamIndex | Index of the stream to retrieve |
| Stream * dataStream | ( | const std::string & | streamName | ) |
Get the data stream of the given name.
Note that the Stream is a reference to the original so any changes. you make to it will be reflected in the channel.
| [in] | streamName | Name of the stream to retrieve |
| bool Debug | ( | const Channel * | me, |
| Debug::Print & | request | ||
| ) | [static] |
Answer a Print request for a Channel object.
Use the request object to dump all information on the "me" Channel, or all static Channel information if "me" is NULL.
| [in] | me | Pointer to object to debug, NULL means class static |
| [out] | request | Print request object |
| bool Debug | ( | const Channel * | me, |
| Debug::Footprint & | request | ||
| ) | [static] |
Answer a footprint request for a Channel object.
Populate the Footprint request with the information on all data stored within this class if "me" is NULL, otherwise the information stored in the Channel object pointed at by "me".
| [in] | me | Pointer to object to footprint, NULL means class static |
| [out] | request | Footprint object to populate |