C++ API Reference
|
Class handling associations between internal and external data. More...
#include <adskDataAssociations.h>
Public Member Functions | |
~Associations () | |
Default destructor, release the implementation object. | |
Associations () | |
Default constructor, initializes the implementation object. | |
Associations (const Associations *) | |
Copy constructor with pointer, shares a ref to internal data with the copy Used as a convenience function for passing in a metadata pointer without caring if it's null or not. More... | |
Associations (const Associations &) | |
Copy constructor, shares a ref to internal data with the copy. More... | |
Associations & | operator= (const Associations &) |
Assignment operator, shares implementation with the rhs. More... | |
Channel | channel (const std::string &) |
Get the data channel with the given name, create if needed. More... | |
void | setChannel (Channel) |
Set the data channel into the Association. More... | |
const Channel * | findChannel (const std::string &) const |
Get the Channel with the given name, return NULL if it doesn't exist. More... | |
Channel * | findChannel (const std::string &) |
Get the Channel with the given name, return NULL if it doesn't exist. More... | |
bool | removeChannel (const std::string &) |
Remove the Channel with the given name from this metadata. More... | |
bool | renameChannel (const std::string &, const std::string &) |
Rename a Channel. More... | |
bool | makeUnique () |
Make the Association's data unique to this object. More... | |
Associations::iterator | begin () const |
Get an iterator pointed to the beginning of the Channel list. More... | |
Associations::iterator | end () const |
Get an iterator off the end of the Channel list. More... | |
Associations::const_iterator | cbegin () const |
Get a read-only iterator pointed to the beginning of the Channel list. More... | |
Associations::const_iterator | cend () const |
Get a read-only iterator off the end of the Channel list. More... | |
unsigned int | size () const |
Get the number of currently associated Channels. More... | |
bool | empty () const |
Check to see if the Channel list is empty. More... | |
unsigned int | channelCount () const |
Get the count of currently associated channels. More... | |
Channel | channelAt (unsigned int channelIndex) const |
Get one of the associated channels by index. More... | |
const Channel * | operator[] (unsigned int channelIndex) const |
Get a pointer to one of the associated channels by index. More... | |
Static Public Member Functions | |
static Associations * | create () |
Associations creator. More... | |
static bool | Debug (const Associations *me, Debug::Print &request) |
Answer a Print request for an Associations object. More... | |
static bool | Debug (const Associations *me, Debug::Footprint &request) |
Answer a footprint request for an Associations object. More... | |
Class handling associations between internal and external data.
You would use this data structure when creating something like per-component data; e.g. a piece of data you wish to attach to every vertex on a surface, every point in a cloud, every particle in a fluid simulation, etc.
It provides a generic interface to handle lists of data streams that can be associated with your own data.
Association types should be unique within the context of where this data is being stored. e.g. "mesh/vertex", "mesh/edge", and "mesh/face". There is no requirement of the naming convention. Associations are looked up by pointer first before string compares so using a const reference from the calling code is more efficient.
The classes are designed to each be simple to use at the expense of a little complexity in the hierarchy. Here's how the different levels break down using the namespace adsk::Data
Associations | | Associates type (e.g. per-vertex data) with channel | Channel | | Amalgamates all data streams (e.g. per-vertex data maintained | for an external simulation) into a single entity | Stream | | Keeps an efficient list of indexed data | (e.g. one set of simulation data per vertex) | Data The actual data with introspection capabilities so that you can find out what it is. At this level it's a single chunk of data, e.g. 3 floats for color, an int and a string as a version identifier, a collection of vectors and scalars for current simulation state, etc.
For example on a mesh with 8 vertices if a simulation engine wants to store the velocity and acceleration of every vertex the data would look like this:
adsk::Data::Associations { channelCount = 1 channel(0) = adsk::Data::Channel { name = "mesh/vertex" streamCount = 1 stream(0) = adsk::Data::Stream { indexCount = 8 streamData = adsk::Data::Handle[8] { "simulationData" : compoundType { "velocity" : compoundType { "velocityX" : float "velocityY" : float "velocityZ" : float } "acceleration" : compoundType { "accelerationX" : float "accelerationY" : float "accelerationZ" : float } } } } } }
Associations | ( | const Associations * | rhs | ) |
Copy constructor with pointer, shares a ref to internal data with the copy Used as a convenience function for passing in a metadata pointer without caring if it's null or not.
[in] | rhs | Associations data to be copied, NULL means just use the default construction. |
Associations | ( | const Associations & | rhs | ) |
Copy constructor, shares a ref to internal data with the copy.
[in] | rhs | Associations data to be copied |
Associations & operator= | ( | const Associations & | rhs | ) |
Assignment operator, shares implementation with the rhs.
[in] | rhs | Associations data to be copied |
Channel channel | ( | const std::string & | channelName | ) |
Get the data channel with the given name, create if needed.
If a Channel with the given name doesn't yet exist then a new Channel will be created for it and returned. Modifying the returned channel will modify the data in place. To modify a copy first use the method adsk::Data::Channel::makeUnique() to make it unique.
[in] | channelName | Name of channel to retrieve |
void setChannel | ( | Channel | newChannel | ) |
Set the data channel into the Association.
If a Channel with the same name existed it will be overwritten; retrieve and modify the existing channel if you don't want to lose old data.
[in] | newChannel | New Channel data to set |
const Channel * findChannel | ( | const std::string & | channelName | ) | const |
Get the Channel with the given name, return NULL if it doesn't exist.
If no Channel with that name exists NULL will be returned.
[in] | channelName | Name of Channel to retrieve |
Channel * findChannel | ( | const std::string & | channelName | ) |
bool removeChannel | ( | const std::string & | channelName | ) |
Remove the Channel with the given name from this metadata.
[in] | channelName | Name of the channel to remove |
bool renameChannel | ( | const std::string & | oldChannelName, |
const std::string & | newChannelName | ||
) |
bool makeUnique | ( | ) |
Make the Association's 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.
|
static |
Associations creator.
Used to force allocation of the Associations data into the main heap so that it controls deletion (which it must since the class is reference-counted).
Associations::iterator begin | ( | ) | const |
Associations::iterator end | ( | ) | const |
Associations::const_iterator cbegin | ( | ) | const |
Associations::const_iterator cend | ( | ) | const |
unsigned int size | ( | ) | const |
Get the number of currently associated Channels.
bool empty | ( | ) | const |
Check to see if the Channel list is empty.
unsigned int channelCount | ( | ) | const |
Get the count of currently associated channels.
Same as the size() method, which has a more standard naming.
Channel channelAt | ( | unsigned int | channelIndex | ) | const |
Get one of the associated channels by index.
Don't use this method, position isn't guaranteed. Use the iterator.
[in] | channelIndex | Index of the channel to retrieve |
const Channel * operator[] | ( | unsigned int | channelIndex | ) | const |
|
static |
Answer a Print request for an Associations object.
Use the request object to dump all information on the "me" Associations, or all static Associations information if "me" is NULL.
[in] | me | Pointer to object to debug, NULL means class static |
[out] | request | Print request object |
|
static |
Answer a footprint request for an Associations 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 Associations object pointed at by "me".
[in] | me | Pointer to object to footprint, NULL means class static |
[out] | request | Footprint object to populate |