- Main Page
- Related Pages
- Modules
- Classes
- Examples

- Class List
- Class Hierarchy
- Class Members

Public Types | Public Member Functions | Static Public Member Functions

# MPxCacheFormat Class Reference
OpenMaya - API module for common classes | Proxy classes

Search for all occurrences

## Detailed Description

CacheFormat definition.

The MPxCacheFormat class can be used to implement support for new cache file formats in Maya.

Examples:

  XmlGeometryCache.cpp.

`#include <MPxCacheFormat.h>`

List of all members.

## Public Types
enum | FileAccessMode { kRead, kWrite, kReadWrite }
| Cache file access modes. More...
## Public Member Functions
| MPxCacheFormat ()
| The default class constructor.
virtual | ~MPxCacheFormat ()
| Class destructor.
virtual MStatus | open (const MString &fileName, FileAccessMode mode)
| Attempt to open the specified cache format.
virtual void | close ()
| Close the current current cache file.
virtual MStatus | isValid ()
| Confirm whether the current cache file is valid.
virtual MStatus | rewind ()
| Rewind the current cache pointer to the start of the cache.
virtual MString | extension ()
| Returns the extension used by this format.
virtual MStatus | readHeader ()
| Read the header from the current cache file, and store any data that may be required.
virtual MStatus | writeHeader (const MString &version, MTime &startTime, MTime &endTime)
| Write the header for the current cache.
virtual void | beginWriteChunk ()
| Perform any actions required prior to writing a chunk's information. Search for all occurrences
virtual void | endWriteChunk ()
| Perform any actions required after writing a chunk's information.
virtual MStatus | beginReadChunk ()
| Start the read process for this chunk.
virtual void | endReadChunk ()
| End the read process for this chunk.
virtual MStatus | writeTime (MTime &time)
| Write the current time to the cache.
virtual MStatus | readTime (MTime &time)
| Read the current time from the cache.
virtual MStatus | findTime (MTime &time, MTime &foundTime)
| Find a specific time in the cache.
virtual MStatus | readNextTime (MTime &foundTime)
| Read the next time from the cache.
virtual unsigned | readArraySize ()
| Read the size of an array in the cache.
virtual MStatus | writeDoubleArray (const MDoubleArray &)
| Write an array of doubles to the cache.
virtual MStatus | writeFloatArray (const MFloatArray &)
| Write a array of floats to the cache.
virtual MStatus | writeIntArray (const MIntArray &)
| Write a array of int to the cache.
virtual MStatus | writeDoubleVectorArray (const MVectorArray &array)
| Write an array of double-precision vectors to the cache.
virtual MStatus | writeFloatVectorArray (const MFloatVectorArray &array)
| Write an array of single-precision vectors to the cache.
virtual MStatus | writeInt32 (int)
| Write an integer to the cache.
virtual MStatus | readDoubleArray (MDoubleArray &, unsigned size)
| Read an array of doubles from the cache.
virtual MStatus | readFloatArray (MFloatArray &, unsigned size)
| Read an array of floats from the cache.
virtual MStatus | readIntArray (MIntArray &, unsigned size)
| Read an array of ints from the cache.
virtual MStatus | readDoubleVectorArray (MVectorArray &, unsigned arraySize)
| Read an array of double-precision vectors from the cache.
virtual MStatus | readFloatVectorArray (MFloatVectorArray &array, unsigned arraySize)
| Read an array of single-precision vectors from the cache.
virtual int | readInt32 ()
| Read an integer from the cache.
virtual MStatus | writeChannelName (const MString &name)
| Write a channel to the cache.
virtual MStatus | findChannelName (const MString &name)
| Seek to a specific channel in the cache.
virtual MStatus | readChannelName (MString &name)
| Find the next channel name.
virtual bool | handlesDescription ()
| Report whether this format handles the format description itself (usually provided by the default xml description file).
virtual MStatus | readDescription (MCacheFormatDescription &description, const MString &descriptionFileLocation, const MString &baseFileName)
| Obtain the format description information.
virtual MStatus | writeDescription (const MCacheFormatDescription &description, const MString &descriptionFileLocation, const MString &baseFileName)
| Store the format description information.
## Static Public Member Functions
static const char * | className ()
| Returns the name of this class. Search for all occurrences

## Member Enumeration Documentation

enum FileAccessMode

Search for all occurrences

Cache file access modes.

Enumerator:

  kRead | read only Search for all occurrences
  kWrite | write only Search for all occurrences
  kReadWrite | read and write (e.g. append, edit, etc.) Search for all occurrences

## Constructor & Destructor Documentation

MPxCacheFormat | ( |  | ) |

The default class constructor.

Initialize the format.

~MPxCacheFormat | ( |  | ) | `[virtual]`

Class destructor.

Automatically releases the associated format.

## Member Function Documentation

MStatus open | ( | const MString & | fileName,
|  | FileAccessMode | mode
| ) |  | `[virtual]`

Search for all occurrences

Attempt to open the specified cache format.

It is important that this function only return success if the cache file is definitely supported by this implementation.

Parameters:

  [in] | fileName | Name of the cache file to open
  [in] | mode | Access mode for the cache file

Returns:
  - MS::kSuccess if the cache is supported by this implementation
  - MS::kFailure otherwise

MStatus isValid | ( |  | ) | `[virtual]`

Search for all occurrences

Confirm whether the current cache file is valid.

Returns:
  - MS::kSuccess if the currenct cache file is valid
  - MS::kFailure otherwise

MStatus rewind | ( |  | ) | `[virtual]`

Search for all occurrences

Rewind the current cache pointer to the start of the cache.

Returns:
  - MS::kSuccess if the pointer is rewound
  - MS::kFailure otherwise

MString extension | ( |  | ) | `[virtual]`

Search for all occurrences

Returns the extension used by this format.

This is not the same as the format's key, which is used by the plugin to identify itself.

Returns:
  The extension used by this format, with no leading period, e.g. "xcf" not ".xcf"

MStatus readHeader | ( |  | ) | `[virtual]`

Search for all occurrences

Read the header from the current cache file, and store any data that may be required.

Returns:
  - MS::kSuccess current header is valid and has been read
  - MS::kFailure otherwise

MStatus writeHeader | ( | const MString & | version,
|  | MTime & | startTime,
|  | MTime & | endTime
| ) |  | `[virtual]`

Search for all occurrences

Write the header for the current cache.

Parameters:

  [in] | version | Maya supplied cache version
  [in] | startTime | startTime for this cache, in ticks. There are 6000 ticks per second
  [in] | endTime | endTime for this cache, in ticks. There are 6000 ticks per second

Returns:
  - MS::kSuccess if the cache's header has been written successfully
  - MS::kFailure otherwise

void beginWriteChunk | ( |  | ) | `[virtual]`

Search for all occurrences

Perform any actions required prior to writing a chunk's information.

A chunk contains the cache information for a specific time, and may contain multiple channels.

MStatus beginReadChunk | ( |  | ) | `[virtual]`

Search for all occurrences

Start the read process for this chunk.

Anything written by beginWriteChunk() should be read and validated by this method.

A chunk contains the cache information for a specific time, and may contain multiple channels.

Returns:
  - MS::kSuccess if the cache's chunk information has been written successfully
  - MS::kFailure otherwise

void endReadChunk | ( |  | ) | `[virtual]`

Search for all occurrences

End the read process for this chunk.

Anything written by the endWriteChunk should be read and validated by this method.

Returns:
  - MS::kSuccess if the cache's chunk information has been read successfully
  - MS::kFailure otherwise

MStatus writeTime | ( | MTime & | time | ) | `[virtual]`

Search for all occurrences

Write the current time to the cache.

Parameters:

  [in] | time | Time to write.

Returns:
  - MS::kSuccess if the time is successfully written to the cache
  - MS::kFailure otherwise

MStatus readTime | ( | MTime & | time | ) | `[virtual]`

Search for all occurrences

Read the current time from the cache.

Parameters:

  [out] | time | Current time from the cache.

Returns:
  - MS::kSuccess if the time is successfully read from the cache
  - MS::kFailure otherwise

MStatus findTime | ( | MTime & | time,
|  | MTime & | foundTime
| ) |  | `[virtual]`

Search for all occurrences

Find a specific time in the cache.

Parameters:

  [in] | time | Time to look for.
  [out] | foundTime | Nearest time found.

Returns:
  - MS::kSuccess if the time is successfully read from the cache
  - MS::kFailure otherwise

MStatus readNextTime | ( | MTime & | foundTime | ) | `[virtual]`

Search for all occurrences

Read the next time from the cache.

Parameters:

  [out] | foundTime | the time found

Returns:
  - MS::kSuccess if the time is successfully read from the cache
  - MS::kFailure otherwise

unsigned readArraySize | ( |  | ) | `[virtual]`

Search for all occurrences

Read the size of an array in the cache.

Returns:
  - MS::kSuccess if the size is successfully read from the cache
  - MS::kFailure otherwise

MStatus writeDoubleArray | ( | const MDoubleArray & | array | ) | `[virtual]`

Search for all occurrences

Write an array of doubles to the cache.

Parameters:

  [in] | array | Array of values to be written.

Returns:
  - MS::kSuccess if the array is successfully written to the cache
  - MS::kFailure otherwise

MStatus writeFloatArray | ( | const MFloatArray & | array | ) | `[virtual]`

Search for all occurrences

Write a array of floats to the cache.

Parameters:

  [in] | array | Array of values to be written.

Returns:
  - MS::kSuccess if the array is successfully written to the cache
  - MS::kFailure otherwise

MStatus writeIntArray | ( | const MIntArray & | array | ) | `[virtual]`

Search for all occurrences

Write a array of int to the cache.

Parameters:

  [in] | array | Array of values to be written.

Returns:
  - MS::kSuccess if the array is successfully written to the cache
  - MS::kFailure otherwise

MStatus writeDoubleVectorArray | ( | const MVectorArray & | array | ) | `[virtual]`

Search for all occurrences

Write an array of double-precision vectors to the cache.

Parameters:

  [in] | array | Array of values to be written.

Returns:
  - MS::kSuccess if the array is successfully written to the cache
  - MS::kFailure otherwise

MStatus writeFloatVectorArray | ( | const MFloatVectorArray & | array | ) | `[virtual]`

Search for all occurrences

Write an array of single-precision vectors to the cache.

Parameters:

  [in] | array | Array of values to be written.

Returns:
  - MS::kSuccess if the array is successfully written to the cache
  - MS::kFailure otherwise

MStatus writeInt32 | ( | int | value | ) | `[virtual]`

Search for all occurrences

Write an integer to the cache.

Parameters:

  [in] | value | the value to be written

Returns:
  - MS::kSuccess if the value is successfully written to the cache
  - MS::kFailure otherwise

MStatus readDoubleArray | ( | MDoubleArray & | array,
|  | unsigned | size
| ) |  | `[virtual]`

Search for all occurrences

Read an array of doubles from the cache.

Parameters:

  [out] | array | Array of values read.
  [in] | size | Number of elements expected.

Returns:
  - MS::kSuccess if the array is successfully read from the cache
  - MS::kFailure otherwise

MStatus readFloatArray | ( | MFloatArray & | array,
|  | unsigned | size
| ) |  | `[virtual]`

Search for all occurrences

Read an array of floats from the cache.

Parameters:

  [out] | array | Array of values read.
  [in] | size | Number of elements expected.

Returns:
  - MS::kSuccess if the array is successfully read from the cache
  - MS::kFailure otherwise

MStatus readIntArray | ( | MIntArray & | array,
|  | unsigned | size
| ) |  | `[virtual]`

Search for all occurrences

Read an array of ints from the cache.

Parameters:

  [out] | array | Array of values read.
  [in] | size | Number of elements expected.

Returns:
  - MS::kSuccess if the array is successfully read from the cache
  - MS::kFailure otherwise

MStatus readDoubleVectorArray | ( | MVectorArray & | array,
|  | unsigned | arraySize
| ) |  | `[virtual]`

Search for all occurrences

Read an array of double-precision vectors from the cache.

Parameters:

  [out] | array | Array of values read.
  [in] | arraySize | Number of elements expected.

Returns:
  - MS::kSuccess if the array is successfully read from the cache
  - MS::kFailure otherwise

MStatus readFloatVectorArray | ( | MFloatVectorArray & | array,
|  | unsigned | size
| ) |  | `[virtual]`

Search for all occurrences

Read an array of single-precision vectors from the cache.

Parameters:

  [out] | array | Array of values read.
  [in] | size | Number of elements expected.

Returns:
  - MS::kSuccess if the array is successfully read from the cache
  - MS::kFailure otherwise

int readInt32 | ( |  | ) | `[virtual]`

Search for all occurrences

Read an integer from the cache.

Returns:
  The value read from the cache

MStatus writeChannelName | ( | const MString & | name | ) | `[virtual]`

Search for all occurrences

Write a channel to the cache.

Parameters:

  [in] | name | the channel to be written

Returns:
  - MS::kSuccess if the channel is successfully written to the cache
  - MS::kFailure otherwise

MStatus findChannelName | ( | const MString & | name | ) | `[virtual]`

Search for all occurrences

Seek to a specific channel in the cache.

Parameters:

  [in] | name | the channel to seek

Returns:
  - MS::kSuccess if the channel is found
  - MS::kFailure otherwise

MStatus readChannelName | ( | MString & | name | ) | `[virtual]`

Search for all occurrences

Find the next channel name.

Parameters:

  [in] | name | the name that is found

Returns:
  - MS::kSuccess if there is a channel
  - MS::kFailure otherwise

bool handlesDescription | ( |  | ) | `[virtual]`

Search for all occurrences

Report whether this format handles the format description itself (usually provided by the default xml description file).

If the format handles the description itself, it must provide implementations of readDescription() and writeDescription().

Returns:
  True if this format handles the description, else false.

MStatus readDescription | ( | MCacheFormatDescription & | description,
|  | const MString & | descriptionFileLocation,
|  | const MString & | baseFileName
| ) |  | `[virtual]`

Search for all occurrences

Obtain the format description information.

If the format returns true for handlesDescription(), then it must implement this method. The implementation should in turn call MCacheFormatDescription::setDistribution(), setTimePerFrame(), addDescriptionInfo() and addChannel() as appropriate using the supplied description object.

In the default implementation, the xml description file is stored at descriptionFileLocation + baseFileName + ".xml"

Parameters:

  [out] | description | the description object to be set up
  [in] | descriptionFileLocation | the default location of the description file
  [in] | baseFileName | the default file name (without extension) of the description file

Returns:
  - MS::kSuccess if the description was successfully read
  - MS::kFailure otherwise

MStatus writeDescription | ( | const MCacheFormatDescription & | description,
|  | const MString & | descriptionFileLocation,
|  | const MString & | baseFileName
| ) |  | `[virtual]`

Search for all occurrences

Store the format description information.

If the format returns true for handlesDescription(), then it must implement this method. The implementation should in turn call MCacheFormatDescription::getDistribution(), getTimePerFrame(), getStartAndEndTimes(), getDescriptionInfo(), getNumChannels() and the various getChannelXXX() methods using the supplied description object as appropriate and store this information in such a way that it can be retrieved by readDescription().

In the default implementation, the xml description file is stored at descriptionFileLocation + baseFileName + ".xml"

Note that the plug-in is not required to store the description in a file using descriptionFileLocation and baseFileName. However, it must be able to retrieve the same description using just these strings to identify the source of the data.

Parameters:

  [in] | description | the description object that describes the format
  [in] | descriptionFileLocation | the default location of the description file
  [in] | baseFileName | the default file name (without extension) of the description file

Returns:
  - MS::kSuccess if the description was successfully read
  - MS::kFailure otherwise

const char * className | ( |  | ) | `[static]`

Search for all occurrences

Returns the name of this class.

Returns:
  The name of this class.

MPxCacheFormat MPxCacheFormat MPxCacheFormat MPxCacheFormat MPxCacheFormat MPxCacheFormat MPxCacheFormat MPxCacheFormat MPxCacheFormat MPxCacheFormat
MPxCacheFormat MPxCacheFormat MPxCacheFormat MPxCacheFormat MPxCacheFormat MPxCacheFormat MPxCacheFormat MPxCacheFormat MPxCacheFormat MPxCacheFormat