HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
GA_AIFSharedDictArray Class Referenceabstract

A specialization of GA_AIFDictArray to access "shared strings". More...

#include <GA_AIFSharedDictArray.h>

Classes

class  iterator
 Class to iterate over all the strings in the shared string table. More...
 

Public Member Functions

 GA_AIFSharedDictArray ()
 
virtual ~GA_AIFSharedDictArray ()
 
virtual bool getStatistics (const GA_Attribute *attrib, GA_DictTableStatistics &stats) const =0
 Query information about the string storage. More...
 
virtual bool compactStorage (GA_Attribute *attrib) const =0
 Compact the string storage. More...
 
virtual bool extractDicts (const GA_Attribute *attrib, UT_Array< UT_OptionsHolder > &strings, UT_IntArray &handles) const =0
 
virtual bool extractHandles (const GA_Attribute *attrib, UT_IntArray &handles) const =0
 
GA_Size getTableEntries (const GA_Attribute *attrib) const
 Return the number of entries in the shared string table. More...
 
virtual GA_DictIndexType validateTableHandle (const GA_Attribute *attrib, GA_DictIndexType index) const =0
 
virtual UT_OptionsHolder getTableDict (const GA_Attribute *attrib, GA_DictIndexType handle) const =0
 Get a string from the string table (without going through an attribute) More...
 
virtual GA_DictIndexType getTableHandle (const GA_Attribute *attrib, const UT_OptionsRef &string) const =0
 
virtual UT_OptionsHolder getTableOrderedDict (const GA_Attribute *a, exint index) const =0
 
virtual bool replaceTableDict (GA_Attribute *attrib, GA_DictIndexType handle, const UT_OptionsHolder &string) const =0
 
iterator begin (const GA_Attribute *a) const
 
iterator end () const
 
virtual int getTupleSize (const GA_Attribute *attrib) const =0
 
virtual bool setTupleSize (GA_Attribute *attrib, int size) const =0
 
virtual GA_Storage getStorage (const GA_Attribute *attrib) const =0
 
virtual void getDict (const GA_Attribute *attribute, GA_Offset offset, UT_Array< UT_OptionsHolder > &strings) const =0
 Get a single string from the array for a single tuple of an element. More...
 
virtual void getDictIndex (const GA_Attribute *attribute, GA_Offset offset, UT_Array< GA_DictIndexType > &indices) const =0
 Get the handle from the array for a single tuple of an element. More...
 
virtual void setDict (GA_Attribute *attribute, GA_Offset offset, const UT_Array< UT_OptionsHolder > &strings) const =0
 Set a single component for a single element. More...
 
virtual void setDictIndex (GA_Attribute *attribute, GA_Offset offset, const UT_Array< GA_DictIndexType > &indices) const =0
 Set a single component for a range of elements. More...
 
virtual exint arraySize (const GA_Attribute *atr, GA_Offset off) const =0
 Return the size of the array for the GA_Offset. More...
 
bool get (const GA_Attribute *attrib, GA_Offset o, UT_Array< UT_OptionsHolder > &v) const
 
bool set (GA_Attribute *attrib, GA_Offset o, const UT_Array< UT_OptionsHolder > &v) const
 
virtual exint findMaximumArrayLength (const GA_Attribute *attrib) const =0
 

Protected Member Functions

virtual GA_DictIndexType addDictReference (GA_Attribute *attribute, const UT_OptionsHolder &string) const =0
 Add (or increment) reference to a string. More...
 
virtual void delHandleReference (GA_Attribute *attribute, GA_DictIndexType handle) const =0
 Decrement reference to a handle. More...
 

Detailed Description

A specialization of GA_AIFDictArray to access "shared strings".

This class provides the interface to access string table data. Each attribute type may provide this interface if it makes sense.

Definition at line 32 of file GA_AIFSharedDictArray.h.

Constructor & Destructor Documentation

GA_AIFSharedDictArray::GA_AIFSharedDictArray ( )
virtual GA_AIFSharedDictArray::~GA_AIFSharedDictArray ( )
virtual

Member Function Documentation

virtual GA_DictIndexType GA_AIFSharedDictArray::addDictReference ( GA_Attribute attribute,
const UT_OptionsHolder string 
) const
protectedpure virtual

Add (or increment) reference to a string.

virtual exint GA_AIFSharedDictArray::arraySize ( const GA_Attribute atr,
GA_Offset  off 
) const
pure virtual

Return the size of the array for the GA_Offset.

iterator GA_AIFSharedDictArray::begin ( const GA_Attribute a) const
inline

Definition at line 199 of file GA_AIFSharedDictArray.h.

virtual bool GA_AIFSharedDictArray::compactStorage ( GA_Attribute attrib) const
pure virtual

Compact the string storage.

virtual void GA_AIFSharedDictArray::delHandleReference ( GA_Attribute attribute,
GA_DictIndexType  handle 
) const
protectedpure virtual

Decrement reference to a handle.

iterator GA_AIFSharedDictArray::end ( void  ) const
inline

Definition at line 201 of file GA_AIFSharedDictArray.h.

virtual bool GA_AIFSharedDictArray::extractDicts ( const GA_Attribute attrib,
UT_Array< UT_OptionsHolder > &  strings,
UT_IntArray handles 
) const
pure virtual

Extract data from the string table. This will extract all the unique strings which are referenced by the attribute. The string handles are guaranteed to be in ascending order, but may or may not be contiguous.

virtual bool GA_AIFSharedDictArray::extractHandles ( const GA_Attribute attrib,
UT_IntArray handles 
) const
pure virtual

Extract all of the unique string handles of the attribute. The string handles are guaranteed to be in ascending order, but may or may not be contiguous.

virtual exint GA_AIFSharedDictArray::findMaximumArrayLength ( const GA_Attribute attrib) const
pure virtual

Return the length of longest array

bool GA_AIFSharedDictArray::get ( const GA_Attribute attrib,
GA_Offset  o,
UT_Array< UT_OptionsHolder > &  v 
) const
inline

Get a UT_Array<UT_OptionsHolder> at specific GA_Offset. This is an alias for getDict() so that we can treat this AIF similar to GA_AIFNumericArray.

Definition at line 239 of file GA_AIFSharedDictArray.h.

virtual void GA_AIFSharedDictArray::getDict ( const GA_Attribute attribute,
GA_Offset  offset,
UT_Array< UT_OptionsHolder > &  strings 
) const
pure virtual

Get a single string from the array for a single tuple of an element.

virtual void GA_AIFSharedDictArray::getDictIndex ( const GA_Attribute attribute,
GA_Offset  offset,
UT_Array< GA_DictIndexType > &  indices 
) const
pure virtual

Get the handle from the array for a single tuple of an element.

virtual bool GA_AIFSharedDictArray::getStatistics ( const GA_Attribute attrib,
GA_DictTableStatistics stats 
) const
pure virtual

Query information about the string storage.

virtual GA_Storage GA_AIFSharedDictArray::getStorage ( const GA_Attribute attrib) const
pure virtual
virtual UT_OptionsHolder GA_AIFSharedDictArray::getTableDict ( const GA_Attribute attrib,
GA_DictIndexType  handle 
) const
pure virtual

Get a string from the string table (without going through an attribute)

GA_Size GA_AIFSharedDictArray::getTableEntries ( const GA_Attribute attrib) const
inline

Return the number of entries in the shared string table.

Definition at line 70 of file GA_AIFSharedDictArray.h.

virtual GA_DictIndexType GA_AIFSharedDictArray::getTableHandle ( const GA_Attribute attrib,
const UT_OptionsRef string 
) const
pure virtual

Get the handle (index) corresponding to the given string, returning -1 if none.

virtual UT_OptionsHolder GA_AIFSharedDictArray::getTableOrderedDict ( const GA_Attribute a,
exint  index 
) const
pure virtual

GA_DictIndexType indices may not be contiguous, this method allows you to get a string given an ordered index. Dicts will be defined for all contiguous strings. This may be an expensive operation, it's better to access strings by their index if possible.

This method will return a NULL pointer past the end of the string table

virtual int GA_AIFSharedDictArray::getTupleSize ( const GA_Attribute attrib) const
pure virtual
virtual bool GA_AIFSharedDictArray::replaceTableDict ( GA_Attribute attrib,
GA_DictIndexType  handle,
const UT_OptionsHolder string 
) const
pure virtual

Replace a string in the shared string table with a new value. Warning, it's possible that the table will "collapse" after the replacement. For example:

table := [ "foo", "bar" ]
table.replaceDict(1, "foo") # Replace "bar" with "foo"
table := [ "foo" ]

In the above example, all elements which originally referenced "bar" will now reference "foo". This means that trying to swap two values will not work as expected.

bool GA_AIFSharedDictArray::set ( GA_Attribute attrib,
GA_Offset  o,
const UT_Array< UT_OptionsHolder > &  v 
) const
inline

Set a UT_DictArray at specific GA_Offset. This is an alias for setDict() so that we can treat this AIF similar to GA_AIFNumericArray.

Definition at line 248 of file GA_AIFSharedDictArray.h.

virtual void GA_AIFSharedDictArray::setDict ( GA_Attribute attribute,
GA_Offset  offset,
const UT_Array< UT_OptionsHolder > &  strings 
) const
pure virtual

Set a single component for a single element.

virtual void GA_AIFSharedDictArray::setDictIndex ( GA_Attribute attribute,
GA_Offset  offset,
const UT_Array< GA_DictIndexType > &  indices 
) const
pure virtual

Set a single component for a range of elements.

virtual bool GA_AIFSharedDictArray::setTupleSize ( GA_Attribute attrib,
int  size 
) const
pure virtual
virtual GA_DictIndexType GA_AIFSharedDictArray::validateTableHandle ( const GA_Attribute attrib,
GA_DictIndexType  index 
) const
pure virtual

It's possible that there are invalid handle indexes mixed with the valid handles. When iterating over all the handles, you can call validateTableHandle() which will ensure that there's a string associated with the given handle.


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