Cortex 6.0.0
Public Types | Public Member Functions | Static Protected Member Functions | Protected Attributes

IECore::AttributeCache Class Reference

#include <AttributeCache.h>

Inheritance diagram for IECore::AttributeCache:

List of all members.

Public Types

typedef std::string ObjectHandle
typedef std::string HeaderHandle
typedef std::string AttributeHandle

Public Member Functions

 AttributeCache (const std::string &filename, IndexedIO::OpenMode mode)
 Open the cache, using the specified open mode.
void write (const ObjectHandle &obj, const AttributeHandle &attr, const Object *data)
 Write a piece of data associated with the specified object and attribute to the cache.
void writeHeader (const HeaderHandle &hdr, const Object *data)
 Write data associated with the specified header to the cache.
ObjectPtr read (const ObjectHandle &obj, const AttributeHandle &attr)
CompoundObjectPtr read (const ObjectHandle &obj)
ObjectPtr readHeader (const HeaderHandle &hdr)
CompoundObjectPtr readHeader ()
void objects (std::vector< ObjectHandle > &objs)
 Retrieve the list of object handles from the cache.
void headers (std::vector< HeaderHandle > &hds)
 Retrieve the list of header handles from the cache.
void attributes (const ObjectHandle &obj, std::vector< AttributeHandle > &attrs)
void attributes (const ObjectHandle &obj, const std::string regex, std::vector< AttributeHandle > &attrs)
bool contains (const ObjectHandle &obj)
 Determines whether or not the cache contains the specified object.
bool contains (const ObjectHandle &obj, const AttributeHandle &attr)
 Determines whether or not the cache contains the specified object and attribute.
void remove (const ObjectHandle &obj)
 Removes an object from the cache file.
void remove (const ObjectHandle &obj, const AttributeHandle &attr)
 Removes an object's attribute from the cache file.
void removeHeader (const HeaderHandle &hdr)
 Removes a header from the cache file.

Static Protected Member Functions

static void checkName (const std::string &name)

Protected Attributes

IndexedIOInterfacePtr m_io

Detailed Description

A simple means of creating and reading caches of data values which are associated with notional "Objects" and "Attributes". Will throw an exception derived from IECore::Exception if any errors are encountered.

Threading:
It is not safe to use an instance of this class from multiple concurrent threads. See the InterpolatedCache class for a threadsafe means of reading the files with automatic interpolation.

Member Function Documentation

void IECore::AttributeCache::attributes ( const ObjectHandle &  obj,
std::vector< AttributeHandle > &  attrs 
)

Retrieve the list of attribute handles from the specified objects. Throws an exception if the object is not within the cache.

void IECore::AttributeCache::attributes ( const ObjectHandle &  obj,
const std::string  regex,
std::vector< AttributeHandle > &  attrs 
)

Retrieve the list of attribute handles that match the given regex from the specified objects. Throws an exception if the object is not within the cache.

CompoundObjectPtr IECore::AttributeCache::read ( const ObjectHandle &  obj)

Read a piece of data associated with the specified object from the cache. Returns a CompoundObject with attribute as keys. Throws an exception if the requested data is not present in the cache.

ObjectPtr IECore::AttributeCache::read ( const ObjectHandle &  obj,
const AttributeHandle &  attr 
)

Read a piece of data associated with the specified object and attribute from the cache. Throws an exception if the requested data is not present in the cache.

ObjectPtr IECore::AttributeCache::readHeader ( const HeaderHandle &  hdr)

Read data associated with the specified header from the cache. Throws an exception if the requested header is not present in the cache.

CompoundObjectPtr IECore::AttributeCache::readHeader ( )

Read all header data present in the cache. Creates a CompoundObject with the header names as keys.


The documentation for this class was generated from the following file:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends