Cortex
10.0.0-a4
|
#include <StreamIndexedIO.h>
Classes | |
class | StreamFile |
Class that provides access to the stream file. More... | |
Public Member Functions | |
IE_CORE_DECLARERUNTIMETYPED (StreamIndexedIO, IndexedIO) | |
IndexedIO::OpenMode | openMode () const override |
Returns the mode with which the interface was created. | |
void | path (IndexedIO::EntryIDList &result) const override |
Retrieve the current directory. Returns empty list at the root location. | |
bool | hasEntry (const IndexedIO::EntryID &name) const override |
Returns whether the given entry exists in the file. | |
const IndexedIO::EntryID & | currentEntryId () const override |
Returns the EntryID for the current directory in the file. The root location has a special name "/". | |
void | entryIds (IndexedIO::EntryIDList &names) const override |
Stores in the given array all the ids of all files and directories. | |
void | entryIds (IndexedIO::EntryIDList &names, IndexedIO::EntryType type) const override |
IndexedIOPtr | subdirectory (const IndexedIO::EntryID &name, IndexedIO::MissingBehaviour missingBehaviour=IndexedIO::ThrowIfMissing) override |
Returns a new interface for the child or if missing then consults missingBehaviour and throws exception if ThrowIfMissing,. | |
ConstIndexedIOPtr | subdirectory (const IndexedIO::EntryID &name, IndexedIO::MissingBehaviour missingBehaviour=IndexedIO::ThrowIfMissing) const override |
Returns read-only interface for the child directory or if missing then consults missingBehaviour and throws exception if. | |
IndexedIO::Entry | entry (const IndexedIO::EntryID &name) const override |
Return details of a specific child entry or raises an exception if it doesn't exist. | |
IndexedIOPtr | createSubdirectory (const IndexedIO::EntryID &name) override |
Creates a subdirectory and returns a writable interface for it or Throws an exception if the subdirectory already exists. | |
void | remove (const IndexedIO::EntryID &name) override |
void | removeAll () override |
IndexedIOPtr | parentDirectory () override |
Returns a new interface for the parent of this node in the file or a NULL pointer if it's the root. | |
ConstIndexedIOPtr | parentDirectory () const override |
Returns a read-only interface for the parent of this node in the file or a NULL pointer if it's the root. | |
IndexedIOPtr | directory (const IndexedIO::EntryIDList &path, IndexedIO::MissingBehaviour missingBehaviour=IndexedIO::ThrowIfMissing) override |
Returns a new interface for the given path in the file. | |
ConstIndexedIOPtr | directory (const IndexedIO::EntryIDList &path, IndexedIO::MissingBehaviour missingBehaviour=IndexedIO::ThrowIfMissing) const override |
Returns a read-only interface for the given path in the file. | |
void | commit () override |
void | write (const IndexedIO::EntryID &name, const float *x, unsigned long arrayLength) override |
void | write (const IndexedIO::EntryID &name, const double *x, unsigned long arrayLength) override |
void | write (const IndexedIO::EntryID &name, const half *x, unsigned long arrayLength) override |
void | write (const IndexedIO::EntryID &name, const int *x, unsigned long arrayLength) override |
void | write (const IndexedIO::EntryID &name, const int64_t *x, unsigned long arrayLength) override |
void | write (const IndexedIO::EntryID &name, const uint64_t *x, unsigned long arrayLength) override |
void | write (const IndexedIO::EntryID &name, const unsigned int *x, unsigned long arrayLength) override |
void | write (const IndexedIO::EntryID &name, const char *x, unsigned long arrayLength) override |
void | write (const IndexedIO::EntryID &name, const unsigned char *x, unsigned long arrayLength) override |
void | write (const IndexedIO::EntryID &name, const std::string *x, unsigned long arrayLength) override |
void | write (const IndexedIO::EntryID &name, const short *x, unsigned long arrayLength) override |
void | write (const IndexedIO::EntryID &name, const unsigned short *x, unsigned long arrayLength) override |
void | write (const IndexedIO::EntryID &name, const InternedString *x, unsigned long arrayLength) override |
void | write (const IndexedIO::EntryID &name, const float &x) override |
void | write (const IndexedIO::EntryID &name, const double &x) override |
void | write (const IndexedIO::EntryID &name, const half &x) override |
void | write (const IndexedIO::EntryID &name, const int &x) override |
void | write (const IndexedIO::EntryID &name, const int64_t &x) override |
void | write (const IndexedIO::EntryID &name, const uint64_t &x) override |
void | write (const IndexedIO::EntryID &name, const std::string &x) override |
void | write (const IndexedIO::EntryID &name, const unsigned int &x) override |
void | write (const IndexedIO::EntryID &name, const char &x) override |
void | write (const IndexedIO::EntryID &name, const unsigned char &x) override |
void | write (const IndexedIO::EntryID &name, const short &x) override |
void | write (const IndexedIO::EntryID &name, const unsigned short &x) override |
void | read (const IndexedIO::EntryID &name, float *&x, unsigned long arrayLength) const override |
void | read (const IndexedIO::EntryID &name, double *&x, unsigned long arrayLength) const override |
void | read (const IndexedIO::EntryID &name, half *&x, unsigned long arrayLength) const override |
void | read (const IndexedIO::EntryID &name, int *&x, unsigned long arrayLength) const override |
void | read (const IndexedIO::EntryID &name, int64_t *&x, unsigned long arrayLength) const override |
void | read (const IndexedIO::EntryID &name, uint64_t *&x, unsigned long arrayLength) const override |
void | read (const IndexedIO::EntryID &name, unsigned int *&x, unsigned long arrayLength) const override |
void | read (const IndexedIO::EntryID &name, char *&x, unsigned long arrayLength) const override |
void | read (const IndexedIO::EntryID &name, unsigned char *&x, unsigned long arrayLength) const override |
void | read (const IndexedIO::EntryID &name, std::string *&x, unsigned long arrayLength) const override |
void | read (const IndexedIO::EntryID &name, short *&x, unsigned long arrayLength) const override |
void | read (const IndexedIO::EntryID &name, unsigned short *&x, unsigned long arrayLength) const override |
void | read (const IndexedIO::EntryID &name, InternedString *&x, unsigned long arrayLength) const override |
void | read (const IndexedIO::EntryID &name, float &x) const override |
void | read (const IndexedIO::EntryID &name, double &x) const override |
void | read (const IndexedIO::EntryID &name, half &x) const override |
void | read (const IndexedIO::EntryID &name, int &x) const override |
void | read (const IndexedIO::EntryID &name, int64_t &x) const override |
void | read (const IndexedIO::EntryID &name, uint64_t &x) const override |
void | read (const IndexedIO::EntryID &name, std::string &x) const override |
void | read (const IndexedIO::EntryID &name, unsigned int &x) const override |
void | read (const IndexedIO::EntryID &name, char &x) const override |
void | read (const IndexedIO::EntryID &name, unsigned char &x) const override |
void | read (const IndexedIO::EntryID &name, short &x) const override |
void | read (const IndexedIO::EntryID &name, unsigned short &x) const override |
![]() | |
IE_CORE_DECLARERUNTIMETYPED (IndexedIO, RunTimeTyped) | |
![]() | |
IE_CORE_DECLAREMEMBERPTR (RunTimeTyped) | |
virtual TypeId | typeId () const |
virtual const char * | typeName () const |
virtual bool | isInstanceOf (TypeId typeId) const |
virtual bool | isInstanceOf (const char *typeName) const |
![]() | |
IE_CORE_DECLAREMEMBERPTR (RefCounted) | |
void | addRef () const |
Add a reference to the current object. | |
void | removeRef () const |
Remove a reference from the current object. | |
RefCount | refCount () const |
Returns the current reference count. | |
Protected Member Functions | |
IE_CORE_DECLAREPTR (Index) | |
IE_CORE_DECLAREPTR (Node) | |
IE_CORE_DECLAREPTR (StreamFile) | |
StreamIndexedIO () | |
Create an instance with unnitialized state. Must call open() method. | |
StreamIndexedIO (Node &node) | |
Constructor based on the node. | |
void | open (StreamFilePtr file, const IndexedIO::EntryIDList &root) |
Opens a file using the given IndexedFile accessor. | |
void | remove (const IndexedIO::EntryID &name, bool throwIfNonExistent) |
template<typename T > | |
void | write (const IndexedIO::EntryID &name, const T *x, unsigned long arrayLength) |
template<typename T > | |
void | rawWrite (const IndexedIO::EntryID &name, const T *x, unsigned long arrayLength) |
template<typename T > | |
void | read (const IndexedIO::EntryID &name, T *&x, unsigned long arrayLength) const |
template<typename T > | |
void | rawRead (const IndexedIO::EntryID &name, T *&x, unsigned long arrayLength) const |
template<typename T > | |
void | write (const IndexedIO::EntryID &name, const T &x) |
template<typename T > | |
void | rawWrite (const IndexedIO::EntryID &name, const T &x) |
template<typename T > | |
void | read (const IndexedIO::EntryID &name, T &x) const |
template<typename T > | |
void | rawRead (const IndexedIO::EntryID &name, T &x) const |
virtual IndexedIO * | duplicate (Node &rootNode) const =0 |
void | flush () |
StreamFile & | streamFile () const |
![]() | |
virtual void | readable (const IndexedIO::EntryID &name) const |
virtual void | writable (const IndexedIO::EntryID &name) const |
Additional Inherited Members | |
![]() | |
enum | OpenModeFlags { Read = 1L << 0, Write = 1L << 1, Append = 1L << 2, Shared = 1L << 3, Exclusive = 1L << 4 } |
General enums and low level structures. | |
enum | EntryType { Directory =0, File } |
enum | DataType { Invalid =0, Float, FloatArray, Double, DoubleArray, Int, IntArray, Long, LongArray, String, StringArray, UInt, UIntArray, Char, CharArray, UChar, UCharArray, Half, HalfArray, Short, ShortArray, UShort, UShortArray, Int64, Int64Array, UInt64, UInt64Array, InternedStringArray } |
enum | MissingBehaviour { ThrowIfMissing = 0, NullIfMissing, CreateIfMissing } |
Enum used to specify behavior when querying child directories. | |
typedef unsigned | OpenMode |
typedef InternedString | EntryID |
typedef std::vector< EntryID > | EntryIDList |
typedef IndexedIOPtr(* | CreatorFn) (const std::string &, const EntryIDList &, IndexedIO::OpenMode) |
![]() | |
typedef RefCounted | BaseClass |
A typedef for the class this class derives from. All RunTimeTyped classes define this typedef. | |
![]() | |
typedef size_t | RefCount |
![]() | |
static IndexedIOPtr | create (const std::string &path, const EntryIDList &root, IndexedIO::OpenMode mode) |
static void | supportedExtensions (std::vector< std::string > &extensions) |
![]() | |
static TypeId | staticTypeId () |
Returns the TypeId for this class, without needing an instance. | |
static const char * | staticTypeName () |
Returns the type name for this class, without needing an instance. | |
static TypeId | baseTypeId () |
static const char * | baseTypeName () |
static bool | inheritsFrom (TypeId typeId) |
Returns true if this class inherits from the specified type. | |
static bool | inheritsFrom (const char *typeName) |
Returns true if this class inherits from the specified type. | |
static bool | inheritsFrom (TypeId type, TypeId baseType) |
Returns true if type inherits from baseType. | |
static bool | inheritsFrom (const char *typeName, const char *baseTypeName) |
Returns true if typeName inherits from baseTypeName. | |
static TypeId | baseTypeId (TypeId typeId) |
Returns the base type of the given type, or InvalidTypeId if no such base exists. | |
static const std::vector< TypeId > & | baseTypeIds (TypeId typeId) |
static const std::set< TypeId > & | derivedTypeIds (TypeId typeId) |
static TypeId | typeIdFromTypeName (const char *typeName) |
static const char * | typeNameFromTypeId (TypeId typeId) |
static void | registerType (TypeId derivedTypeId, const char *derivedTypeName, TypeId baseTypeId) |
Allows external modules to register their own type ids. | |
![]() | |
static const EntryID | rootName |
static const EntryIDList | rootPath |
![]() | |
typedef std::map< TypeId, TypeId > | BaseTypeRegistryMap |
typedef std::map< TypeId, std::vector< TypeId > > | BaseTypesRegistryMap |
typedef std::map< TypeId, std::set< TypeId > > | DerivedTypesRegistryMap |
typedef tbb::spin_rw_mutex | Mutex |
typedef std::map< TypeId, std::string > | TypeIdsToTypeNamesMap |
typedef std::map< std::string, TypeId > | TypeNamesToTypeIdsMap |
![]() | |
static void | validateOpenMode (IndexedIO::OpenMode &mode) |
![]() | |
static BaseTypeRegistryMap & | baseTypeRegistry () |
static DerivedTypesRegistryMap & | derivedTypesRegistry () |
static BaseTypesRegistryMap & | completeBaseTypesRegistry () |
static DerivedTypesRegistryMap & | completeDerivedTypesRegistry () |
static void | derivedTypeIdsWalk (TypeId typeId, std::set< TypeId > &) |
static TypeIdsToTypeNamesMap & | typeIdsToTypeNames () |
static TypeNamesToTypeIdsMap & | typeNamesToTypeIds () |
![]() | |
static Mutex | g_baseTypeIdsMutex |
static Mutex | g_derivedTypeIdsMutex |
Abstract base class implementation of IndexedIO which operates with a stream file handle. It handles data instancing transparently for compact file sizes. Read operations are thread safe on read-only opened files.
|
overridevirtual |
Commit the contents of the current directory to the file, further changes on this directory or it's subdirectories are not allowed. This helps freeing memory and also gives hints to the implementation classes to structure the file format in a sensible way. The commit() method is called by Object::save function. Any IndexedIO instances to child directories will be in a invalid state and should not be used after commit is called.
Implements IECore::IndexedIO.
|
protected |
forces writing the index to the file and preventing any further changes. this function can be called by derived classes (MemoryIndexedIO).
|
overridevirtual |
Read a float array from an existing file.
name | The name of the file to be read |
x | The buffer to fill. If 0 is passed, then memory is allocated and should be freed by the caller. |
arrayLength | The number of elements in the array |
Implements IECore::IndexedIO.
|
overridevirtual |
Read a double array from an existing file.
name | The name of the file to be read |
x | The buffer to fill. If 0 is passed, then memory is allocated and should be freed by the caller. |
arrayLength | The number of elements in the array |
Implements IECore::IndexedIO.
|
overridevirtual |
Read a half array from an existing file.
name | The name of the file to be read |
x | The buffer to fill. If 0 is passed, then memory is allocated and should be freed by the caller. |
arrayLength | The number of elements in the array |
Implements IECore::IndexedIO.
|
overridevirtual |
Read an int array from an existing file.
name | The name of the file to be read |
x | The buffer to fill. If 0 is passed, then memory is allocated and should be freed by the caller. |
arrayLength | The number of elements in the array |
Implements IECore::IndexedIO.
|
overridevirtual |
Read a long array from an existing file.
name | The name of the file to be read |
x | The buffer to fill. If 0 is passed, then memory is allocated and should be freed by the caller. |
arrayLength | The number of elements in the array |
Implements IECore::IndexedIO.
|
overridevirtual |
Read a long array from an existing file.
name | The name of the file to be read |
x | The buffer to fill. If 0 is passed, then memory is allocated and should be freed by the caller. |
arrayLength | The number of elements in the array |
Implements IECore::IndexedIO.
|
overridevirtual |
Read an unsigned int array from an existing file.
name | The name of the file to be read |
x | The buffer to fill. If 0 is passed, then memory is allocated and should be freed by the caller. |
arrayLength | The number of elements in the array |
Implements IECore::IndexedIO.
|
overridevirtual |
Read a char array from an existing file.
name | The name of the file to be read |
x | The buffer to fill. If 0 is passed, then memory is allocated and should be freed by the caller. |
arrayLength | The number of elements in the array |
Implements IECore::IndexedIO.
|
overridevirtual |
Read an unsigned char array from an existing file.
name | The name of the file to be read |
x | The buffer to fill. If 0 is passed, then memory is allocated and should be freed by the caller. |
arrayLength | The number of elements in the array |
Implements IECore::IndexedIO.
|
overridevirtual |
Read a string array from an existing file.
name | The name of the file to be read |
x | The buffer to fill. If 0 is passed, then memory is allocated and should be freed by the caller. |
arrayLength | The number of elements in the array |
Implements IECore::IndexedIO.
|
overridevirtual |
Read a short array from an existing file.
name | The name of the file to be read |
x | The buffer to fill. If 0 is passed, then memory is allocated and should be freed by the caller. |
arrayLength | The number of elements in the array |
Implements IECore::IndexedIO.
|
overridevirtual |
Read an unsigned short array from an existing file.
name | The name of the file to be read |
x | The buffer to fill. If 0 is passed, then memory is allocated and should be freed by the caller. |
arrayLength | The number of elements in the array |
Implements IECore::IndexedIO.
|
overridevirtual |
Read an InternedString array from an existing file
name | The name of the file to be read |
x | The buffer to fill. If 0 is passed, then memory is allocated and should be freed by the caller. |
arrayLength | The number of elements in the array |
Implements IECore::IndexedIO.
|
overridevirtual |
Read a float from an existing file.
name | The name of the file to be read |
x | Returns the data read. |
Implements IECore::IndexedIO.
|
overridevirtual |
Read a double from an existing file
name | The name of the file to be read |
x | Returns the data read. |
Implements IECore::IndexedIO.
|
overridevirtual |
Read a half from an existing file
name | The name of the file to be read |
x | Returns the data read. |
Implements IECore::IndexedIO.
|
overridevirtual |
Read an int from an existing file
name | The name of the file to be read |
x | Returns the data read. |
Implements IECore::IndexedIO.
|
overridevirtual |
Read a long from an existing file
name | The name of the file to be read |
x | Returns the data read. |
Implements IECore::IndexedIO.
|
overridevirtual |
Read a long from an existing file
name | The name of the file to be read |
x | Returns the data read. |
Implements IECore::IndexedIO.
|
overridevirtual |
Read a string from an existing file
name | The name of the file to be read |
x | Returns the data read. |
Implements IECore::IndexedIO.
|
overridevirtual |
Read an unsigned int from an existing file
name | The name of the file to be read |
x | Returns the data read. |
Implements IECore::IndexedIO.
|
overridevirtual |
Read a char from an existing file
name | The name of the file to be read |
x | Returns the data read. |
Implements IECore::IndexedIO.
|
overridevirtual |
Read an unsigned char from an existing file
name | The name of the file to be read |
x | Returns the data read. |
Implements IECore::IndexedIO.
|
overridevirtual |
Read a short from an existing file
name | The name of the file to be read |
x | Returns the data read. |
Implements IECore::IndexedIO.
|
overridevirtual |
Read an unsigned char from an existing file
name | The name of the file to be read |
x | Returns the data read. |
Implements IECore::IndexedIO.
|
overridevirtual |
Remove a specified child file or directory. Any IndexedIO instances to child directories will be in a invalid state and should not be used after remove is called.
Implements IECore::IndexedIO.
Referenced by IECore.MenuDefinition::append(), IECore.MenuDefinition::insertAfter(), IECore.MenuDefinition::insertBefore(), and IECore.MenuDefinition::prepend().
|
protected |
Variant of "removeChild" which allows exceptions to be optionally thrown if the entry to remove does not exist.
Referenced by IECore.MenuDefinition::append(), IECore.MenuDefinition::insertAfter(), IECore.MenuDefinition::insertBefore(), and IECore.MenuDefinition::prepend().
|
overridevirtual |
Remove all entries. Any IndexedIO instances to child directories will be in a invalid state and should not be used after remove is called.
Implements IECore::IndexedIO.
|
overridevirtual |
Create a new file containing the specified float array contents
name | The name of the file to be written |
x | The data to write |
arrayLength | The number of elements in the array |
Implements IECore::IndexedIO.
|
overridevirtual |
Create a new file containing the specified double array contents
name | The name of the file to be written |
x | The data to write |
arrayLength | The number of elements in the array |
Implements IECore::IndexedIO.
|
overridevirtual |
Create a new file containing the specified half array contents
name | The name of the file to be written |
x | The data to write |
arrayLength | The number of elements in the array |
Implements IECore::IndexedIO.
|
overridevirtual |
Create a new file containing the specified unsigned int array contents
name | The name of the file to be written |
x | The data to write |
arrayLength | The number of elements in the array |
Implements IECore::IndexedIO.
|
overridevirtual |
Create a new file containing the specified unsigned long array contents
name | The name of the file to be written |
x | The data to write |
arrayLength | The number of elements in the array |
Implements IECore::IndexedIO.
|
overridevirtual |
Create a new file containing the specified unsigned long array contents
name | The name of the file to be written |
x | The data to write |
arrayLength | The number of elements in the array |
Implements IECore::IndexedIO.
|
overridevirtual |
Create a new file containing the specified unsigned int array contents
name | The name of the file to be written |
x | The data to write |
arrayLength | The number of elements in the array |
Implements IECore::IndexedIO.
|
overridevirtual |
Create a new file containing the specified char array contents
name | The name of the file to be written |
x | The data to write |
arrayLength | The number of elements in the array |
Implements IECore::IndexedIO.
|
overridevirtual |
Create a new file containing the specified unsigned char array contents
name | The name of the file to be written |
x | The data to write |
arrayLength | The number of elements in the array |
Implements IECore::IndexedIO.
|
overridevirtual |
Create a new file containing the specified string array contents
name | The name of the file to be written |
x | The data to write |
arrayLength | The number of elements in the array |
Implements IECore::IndexedIO.
|
overridevirtual |
Create a new file containing the specified short array contents
name | The name of the file to be written |
x | The data to write |
arrayLength | The number of elements in the array |
Implements IECore::IndexedIO.
|
overridevirtual |
Create a new file containing the specified unsigned short array contents
name | The name of the file to be written |
x | The data to write |
arrayLength | The number of elements in the array |
Implements IECore::IndexedIO.
|
overridevirtual |
Create a new file containing the specified InternedString array contents
name | The name of the file to be written |
x | The data to write |
arrayLength | The number of elements in the array |
Implements IECore::IndexedIO.
|
overridevirtual |
Create a new file containing the specified float
name | The name of the file to be written |
x | The data to write |
Implements IECore::IndexedIO.
|
overridevirtual |
Create a new file containing the specified double
name | The name of the file to be written |
x | The data to write |
Implements IECore::IndexedIO.
|
overridevirtual |
Create a new file containing the specified half
name | The name of the file to be written |
x | The data to write |
Implements IECore::IndexedIO.
|
overridevirtual |
Create a new file containing the specified int
name | The name of the file to be written |
x | The data to write |
Implements IECore::IndexedIO.
|
overridevirtual |
Create a new file containing the specified long
name | The name of the file to be written |
x | The data to write |
Implements IECore::IndexedIO.
|
overridevirtual |
Create a new file containing the specified long
name | The name of the file to be written |
x | The data to write |
Implements IECore::IndexedIO.
|
overridevirtual |
Create a new file containing the specified string
name | The name of the file to be written |
x | The data to write |
Implements IECore::IndexedIO.
|
overridevirtual |
Create a new file containing the specified unsigned int
name | The name of the file to be written |
x | The data to write |
Implements IECore::IndexedIO.
|
overridevirtual |
Create a new file containing the specified char
name | The name of the file to be written |
x | The data to write |
Implements IECore::IndexedIO.
|
overridevirtual |
Create a new file containing the specified unsigned char
name | The name of the file to be written |
x | The data to write |
Implements IECore::IndexedIO.
|
overridevirtual |
Create a new file containing the specified short
name | The name of the file to be written |
x | The data to write |
Implements IECore::IndexedIO.
|
overridevirtual |
Create a new file containing the specified unsigned short
name | The name of the file to be written |
x | The data to write |
Implements IECore::IndexedIO.