IECore::InterpolatedCache Class Reference

#include <InterpolatedCache.h>

Inheritance diagram for IECore::InterpolatedCache:

IECore::RefCounted

List of all members.

Classes

class  Implementation

Public Types

enum  Interpolation { None = 0, Linear, Cubic }
typedef std::vector
< AttributeCachePtr > 
CacheVector
typedef
IECore::AttributeCache::ObjectHandle 
ObjectHandle
typedef
IECore::AttributeCache::HeaderHandle 
HeaderHandle
typedef
IECore::AttributeCache::AttributeHandle 
AttributeHandle

Public Member Functions

 IE_CORE_DECLAREMEMBERPTR (InterpolatedCache)
 InterpolatedCache (const std::string &pathTemplate="", Interpolation interpolation=None, const OversamplesCalculator &o=OversamplesCalculator(), size_t maxOpenFiles=10)
 InterpolatedCache (const std::string &pathTemplate="", float frame=0.0, Interpolation interpolation=None, const OversamplesCalculator &o=OversamplesCalculator())
 ~InterpolatedCache ()
void setPathTemplate (const std::string &pathTemplate)
const std::string & getPathTemplate () const
void setMaxOpenFiles (size_t maxOpenFiles)
size_t getMaxOpenFiles () const
void setFrame (float frame)
float getFrame () const
void setInterpolation (Interpolation interpolation)
Interpolation getInterpolation () const
void setOversamplesCalculator (const OversamplesCalculator &)
OversamplesCalculator getOversamplesCalculator () const
ObjectPtr read (const ObjectHandle &obj, const AttributeHandle &attr) const
ObjectPtr read (float frame, const ObjectHandle &obj, const AttributeHandle &attr) const
CompoundObjectPtr read (const ObjectHandle &obj) const
CompoundObjectPtr read (float frame, const ObjectHandle &obj) const
ObjectPtr readHeader (const HeaderHandle &hdr) const
ObjectPtr readHeader (float frame, const HeaderHandle &hdr) const
CompoundObjectPtr readHeader () const
CompoundObjectPtr readHeader (float frame) const
void objects (std::vector< ObjectHandle > &objs) const
void objects (float frame, std::vector< ObjectHandle > &objs) const
void headers (std::vector< HeaderHandle > &hds) const
void headers (float frame, std::vector< HeaderHandle > &hds) const
void attributes (const ObjectHandle &obj, std::vector< AttributeHandle > &attrs) const
void attributes (float frame, const ObjectHandle &obj, std::vector< AttributeHandle > &attrs) const
void attributes (const ObjectHandle &obj, const std::string regex, std::vector< AttributeHandle > &attrs) const
void attributes (float frame, const ObjectHandle &obj, const std::string regex, std::vector< AttributeHandle > &attrs) const
bool contains (const ObjectHandle &obj) const
bool contains (float frame, const ObjectHandle &obj) const
bool contains (const ObjectHandle &obj, const AttributeHandle &attr) const
bool contains (float frame, const ObjectHandle &obj, const AttributeHandle &attr) const


Detailed Description

Provides higher level access to cache files by automatically interpolating data from multiple files. Or returns the data from the nearest frame if the data cannot be interpolated. The interface looks like AttributeCache reader functions.
Threading:
This class provides limited thread safety. The methods which specify the caches to be read are not safe to call while other threads are operating on the object. However, once the caches have been specified it is safe to call the read methods from multiple concurrent threads and with multiple different frame arguments. See the documentation of the individual methods for more details.
Todo:
Remove the deprecated functions for cortex 6.

It might be great to pass interpolation and oversamples calculator to each read method rather than have them store as state. This would allow different interpolation and oversampling per call and per thread. If we did this I think we should look at replacing the OversamplesCalculator class with some more sensible Time or TimeSampler class, and passing everything in one argument.


Member Typedef Documentation

typedef std::vector< AttributeCachePtr > IECore::InterpolatedCache::CacheVector

Todo:
Remove for cortex 6


Member Enumeration Documentation

Enumerator:
None 
Linear 
Cubic 


Constructor & Destructor Documentation

InterpolatedCache::InterpolatedCache ( const std::string &  pathTemplate = "",
Interpolation  interpolation = None,
const OversamplesCalculator o = OversamplesCalculator(),
size_t  maxOpenFiles = 10 
)

Constructor pathTemplate must be a valid FileSequence filename specifier, e.g. "myCacheFile.####.cob"

References IECore::ClassData< ClassTypeT, DataTypeT, DataDeletePolicyT >::create(), and setFrame().

InterpolatedCache::InterpolatedCache ( const std::string &  pathTemplate = "",
float  frame = 0.0,
Interpolation  interpolation = None,
const OversamplesCalculator o = OversamplesCalculator() 
)

InterpolatedCache::~InterpolatedCache (  ) 


Member Function Documentation

void InterpolatedCache::attributes ( float  frame,
const ObjectHandle obj,
const std::string  regex,
std::vector< AttributeHandle > &  attrs 
) const

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 or the cache file is not found.

Threading:
It is safe to call this method while other threads are calling const methods of this class.

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

Deprecated:
Use the method which additionally specifies a frame.

References attributes().

void InterpolatedCache::attributes ( float  frame,
const ObjectHandle obj,
std::vector< AttributeHandle > &  attrs 
) const

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

Threading:
It is safe to call this method while other threads are calling const methods of this class.

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

Deprecated:
Use the method which additionally specifies a frame.

Referenced by attributes().

bool InterpolatedCache::contains ( float  frame,
const ObjectHandle obj,
const AttributeHandle attr 
) const

Determines whether or not the cache contains the specified object and attribute Throws an exception if the cache file is not found.

Threading:
It is safe to call this method while other threads are calling const methods of this class.

bool InterpolatedCache::contains ( const ObjectHandle obj,
const AttributeHandle attr 
) const

Deprecated:
Use the method which additionally specifies a frame.

References contains().

bool InterpolatedCache::contains ( float  frame,
const ObjectHandle obj 
) const

Determines whether or not the cache contains the specified object Throws an exception if the cache file is not found.

Threading:
It is safe to call this method while other threads are calling const methods of this class.

bool InterpolatedCache::contains ( const ObjectHandle obj  )  const

Deprecated:
Use the method which additionally specifies a frame.

Referenced by contains().

float InterpolatedCache::getFrame (  )  const

InterpolatedCache::Interpolation InterpolatedCache::getInterpolation (  )  const

Returns the current interpolation method.

Threading:
It is safe to call this method while other threads are calling const methods of this class.

size_t InterpolatedCache::getMaxOpenFiles (  )  const

Returns the maximum number of caches this class will keep open at one time.

Threading:
It is safe to call this method while other threads are calling const methods of this class.

OversamplesCalculator InterpolatedCache::getOversamplesCalculator (  )  const

Returns the current OversamplesCalculator.

Threading:
It is safe to call this method while other threads are calling const methods of this class.
Todo:
Should be returning a const reference

const std::string & InterpolatedCache::getPathTemplate (  )  const

Returns the current path template used to open cache files.

Threading:
It is safe to call this method while other threads are calling const methods of this class.

void InterpolatedCache::headers ( float  frame,
std::vector< HeaderHandle > &  hds 
) const

Retrieve the list of header handles from the cache (from the nearest frame). Throws an exception if the cache file is not found.

Threading:
It is safe to call this method while other threads are calling const methods of this class.

void InterpolatedCache::headers ( std::vector< HeaderHandle > &  hds  )  const

Deprecated:
Use the method which additionally specifies a frame.

IECore::InterpolatedCache::IE_CORE_DECLAREMEMBERPTR ( InterpolatedCache   ) 

void InterpolatedCache::objects ( float  frame,
std::vector< ObjectHandle > &  objs 
) const

Retrieve the list of object handles from the cache Throws an exception if the cache file is not found.

Threading:
It is safe to call this method while other threads are calling const methods of this class.

void InterpolatedCache::objects ( std::vector< ObjectHandle > &  objs  )  const

Deprecated:
Use the method which additionally specifies a frame.

CompoundObjectPtr InterpolatedCache::read ( float  frame,
const ObjectHandle obj 
) const

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 or if the cache file is not found.

Threading:
It is safe to call this method while other threads are calling const methods of this class.

CompoundObjectPtr InterpolatedCache::read ( const ObjectHandle obj  )  const

Deprecated:
Use the method which additionally specifies a frame.

References read().

ObjectPtr InterpolatedCache::read ( float  frame,
const ObjectHandle obj,
const AttributeHandle attr 
) const

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 or if the cache file is not found.

Threading:
It is safe to call this method while other threads are calling const methods of this class.

ObjectPtr InterpolatedCache::read ( const ObjectHandle obj,
const AttributeHandle attr 
) const

Deprecated:
Use the method which additionally specifies a frame.

Referenced by read().

CompoundObjectPtr InterpolatedCache::readHeader ( float  frame  )  const

Creates a CompoundObject with the header names as keys. Read all header data present in the open cache files. The result will be interpolated whenever possible. Objects not existent in every opened file will not be interpolated and will be returned if they come from the nearest frame. Throws an exception if the cache file is not found.

Threading:
It is safe to call this method while other threads are calling const methods of this class.

CompoundObjectPtr InterpolatedCache::readHeader (  )  const

Deprecated:
Use the method which additionally specifies a frame.

Referenced by readHeader().

ObjectPtr InterpolatedCache::readHeader ( float  frame,
const HeaderHandle hdr 
) const

Read data associated with the specified header from the open cache files. The result will be interpolated whenever possible. Objects not existent in every opened file will not be interpolated and will be returned if they come from the nearest frame. Throws an exception if the requested header is not present in the cache or if the cache file is not found.

Threading:
It is safe to call this method while other threads are calling const methods of this class.

ObjectPtr InterpolatedCache::readHeader ( const HeaderHandle hdr  )  const

Deprecated:
Use the method which additionally specifies a frame.

References readHeader().

void InterpolatedCache::setFrame ( float  frame  ) 

Deprecated:
Use the method calls which take a frame argument explicitly instead.

Referenced by InterpolatedCache().

void InterpolatedCache::setInterpolation ( InterpolatedCache::Interpolation  interpolation  ) 

Sets the interpolation method.

Threading:
It is not safe to call this method while other threads are accessing this object.

void InterpolatedCache::setMaxOpenFiles ( size_t  maxOpenFiles  ) 

Sets the maximum number of caches this class will keep open at one time.

Threading:
It is not safe to call this method while other threads are accessing this object.

void InterpolatedCache::setOversamplesCalculator ( const OversamplesCalculator oc  ) 

Sets the OversamplesCalculator.

Threading:
It is not safe to call this method while other threads are accessing this object.

void InterpolatedCache::setPathTemplate ( const std::string &  pathTemplate  ) 

Changes the path template for cache files.

Threading:
It is not safe to call this method while other threads are accessing this object.


The documentation for this class was generated from the following files:

Generated on Mon Jan 24 11:13:25 2011 for Cortex by doxygen 1.5.8