Cortex
10.0.0-a4
|
The class provided to the save() method implemented by subclasses. More...
#include <Object.h>
Public Member Functions | |
SaveContext (IndexedIOPtr ioInterface) | |
IndexedIOPtr | container (const std::string &typeName, unsigned int ioVersion) |
void | save (const Object *toSave, IndexedIO *o, const IndexedIO::EntryID &name) |
IndexedIO * | rawContainer () |
The class provided to the save() method implemented by subclasses.
IndexedIOPtr IECore::Object::SaveContext::container | ( | const std::string & | typeName, |
unsigned int | ioVersion | ||
) |
Returns an interface to a container in which you can save your class data. You should save your data directly into the root of this container. The "filesystem" below the root is guaranteed to be empty and immune to writes from any badly behaved Object subclasses.
typeName | The typename of your class. |
ioVersion | The current file format version for your class. This should be incremented each time the format you save in changes, and is the same as the version retrieved in the LoadContext::ioInterface() method. It is recommended that you store your ioVersion as a private static const member of your class. |
IndexedIO* IECore::Object::SaveContext::rawContainer | ( | ) |
Returns an interface to an alternative container in which to save class data. This container is provided for optimisation reasons and should be used only in extreme cases. The container provides no protection from overwriting of your class data by base or derived classes, and provides no versioning. Furthermore you can only use raw IndexedIO methods for saving in it - SaveContext::save() may not be used and therefore child Objects may not be saved. This interface is provided primarily for the SimpleTypedData classes, which save very small amounts of unstructured data where the metadata associated with the standard container becomes relatively expensive in both disk space and time. Think carefully before using this container, it provides performance benefits only in extreme cases!
void IECore::Object::SaveContext::save | ( | const Object * | toSave, |
IndexedIO * | o, | ||
const IndexedIO::EntryID & | name | ||
) |
Saves an Object instance, saving only a reference in the case that the object has already been saved.