HDK
|
A simple ATI to store aribtrary "blobs" of data in an attribute. More...
#include <GA_ATIBlob.h>
Public Types | |
typedef GA_PageArray< int32 > | HandleArrayType |
![]() | |
enum | WriteConcurrence { WRITE_CONCURRENCE_NONE, WRITE_CONCURRENCE_PAGE, WRITE_CONCURRENCE_ELEMENT } |
enum | AttribFlag { FLAG_TAIL_INITIALIZE = 1, FLAG_STREAM_ACTIVE = 2, FLAG_STREAM_NOPREEXIST = 4 } |
Static Public Member Functions | |
static void | registerType () |
static SYS_FORCE_INLINE const UT_StringHolder & | getTypeName () |
static SYS_FORCE_INLINE const GA_AttributeType & | getType () |
static SYS_FORCE_INLINE bool | isType (const GA_Attribute *attrib) |
static SYS_FORCE_INLINE GA_ATIBlob * | cast (GA_Attribute *attrib) |
static SYS_FORCE_INLINE const GA_ATIBlob * | cast (const GA_Attribute *attrib) |
static GA_Attribute * | create (const GA_IndexMap &index_map, GA_AttributeScope scope, const UT_StringHolder &name, int tuple_size, const GA_AttributeOptions *attribute_options=NULL) |
static GA_Attribute * | create (const GA_IndexMap &index_map, const UT_StringHolder &name, int tuple_size) |
![]() | |
static bool | jsonLoadDefinition (UT_JSONParser &p, GA_AttributeScope &scope, UT_WorkBuffer &type, UT_WorkBuffer &name, int64 &version, GA_AttributeOptions &options) |
Load the GA_Attribute-Definition section. More... | |
static GA_DataId | nextDataId () |
Protected Attributes | |
HandleArrayType | myHandles |
GA_BlobContainer | myBlobs |
Blob references. This is protected for convenience to sub-classes. More... | |
Additional Inherited Members | |
![]() | |
static bool | checkGlobalOverwrite (const GA_MergeMap &map, const GA_Attribute *attrib) |
A simple ATI to store aribtrary "blobs" of data in an attribute.
The blob attribute type stores arbitrary blobs (GA_Blob) of data for each element in the attribute array. The blobs are stored as reference counted shared objects, meaning the blobs may be shared between multiple elements of the array. Each blob is referenced by a unique integer handle.
It's also possible to get a list of all the blobs stored by the attribute
By default, the array is filled with NULL pointers.
This class is very simple and only provides a minimal interface. Blob attributes are not saved/loaded, and there is minimal access to the blobs.
Users may sub-class from this ATI to create more complicated classes which provide alternate interfaces.
This attribute looks for options (GA_Attribute::getOptions())
Definition at line 92 of file GA_ATIBlob.h.
typedef GA_PageArray<int32> GA_ATIBlob::HandleArrayType |
Definition at line 399 of file GA_ATIBlob.h.
GA_ATIBlob::GA_ATIBlob | ( | const GA_AttributeType & | type, |
const GA_IndexMap & | index_map, | ||
GA_AttributeScope | scope, | ||
const char * | name, | ||
int | tuple_size | ||
) |
|
override |
|
protected |
The addBlobBuffer()/delBlobBuffer() methods are added solely for the corresponding methods in GA_AIFBlob.
|
inline |
Return the capacity of the blob container.
Definition at line 177 of file GA_ATIBlob.h.
|
inlinestatic |
Definition at line 114 of file GA_ATIBlob.h.
|
inlinestatic |
Definition at line 121 of file GA_ATIBlob.h.
|
overridevirtual |
This method will "compact" the attribute container, possibly changing all the handles in the attribute data.
Reimplemented from GA_Attribute.
Copy attribute values for a single element.
Reimplemented from GA_Attribute.
Definition at line 334 of file GA_ATIBlob.h.
|
inlinefinaloverridevirtual |
Copy attribute values for a single element.
Reimplemented from GA_Attribute.
Definition at line 339 of file GA_ATIBlob.h.
|
inline |
Copy attribute values for a single element.
Definition at line 347 of file GA_ATIBlob.h.
|
inlinefinaloverridevirtual |
Copy attribute values for a range of elements.
Reimplemented from GA_Attribute.
Definition at line 356 of file GA_ATIBlob.h.
|
inlinefinaloverridevirtual |
Copy attribute values for a range of elements.
Reimplemented from GA_Attribute.
Definition at line 361 of file GA_ATIBlob.h.
|
inline |
Copy attribute values for a range of elements.
Definition at line 368 of file GA_ATIBlob.h.
|
protected |
Methods to implement copying of data for AIFCopyData
|
protected |
Methods to implement copying of data for AIFCopyData
|
overridevirtual |
Count memory usage using a UT_MemoryCounter in order to count shared memory correctly. If inclusive is true, the size of this object is counted, else only memory owned by this object is counted. If this is pointed to by the calling object, inclusive should be true. If this is contained in the calling object, inclusive should be false. (Its memory was already counted in the size of the calling object.)
NOTE: If you're implementing this in a direct subclass of GA_Attribute, call getBaseMemoryUsage() to get the amount of memory in the base class. If in a more distant descendant class, call Base::countMemory(counter, false) to count the memory in Base and above, excluding sizeof(Base).
Implements GA_Attribute.
|
static |
|
inlinestatic |
Definition at line 133 of file GA_ATIBlob.h.
|
overridevirtual |
Interface for defragmentation
Implements GA_Attribute.
|
protected |
The addBlobBuffer()/delBlobBuffer() methods are added solely for the corresponding methods in GA_AIFBlob.
Callback method to destruct an offset.
Reimplemented from GA_Attribute.
|
overrideprotectedvirtual |
Create a new ATIBlob attribute. Sub-classes must implement this.
Reimplemented from GA_Attribute.
Reimplemented in GA_ATIDict.
|
inline |
Return the entries in the blob container.
Definition at line 167 of file GA_ATIBlob.h.
|
inline |
Convenience function to extract all the blobs (and their handles) The string handles are guaranteed to be in ascending order, but may or may not be contiguous.
Definition at line 284 of file GA_ATIBlob.h.
|
inline |
Definition at line 289 of file GA_ATIBlob.h.
Assign all elements of a range from a single attribute value.
Reimplemented from GA_Attribute.
Definition at line 376 of file GA_ATIBlob.h.
|
inlinefinaloverridevirtual |
Assign all elements of a range from a single attribute value.
Reimplemented from GA_Attribute.
Definition at line 381 of file GA_ATIBlob.h.
|
inline |
Assign all elements of a range from a single attribute value.
Definition at line 389 of file GA_ATIBlob.h.
|
protected |
Methods to implement copying of data for AIFCopyData
|
inlineoverridevirtual |
Return the attribute's blob interface or NULL.
Reimplemented from GA_Attribute.
Definition at line 249 of file GA_ATIBlob.h.
|
inlineoverridevirtual |
Return the attribute's comparison interface or NULL.
Reimplemented from GA_Attribute.
Definition at line 251 of file GA_ATIBlob.h.
|
inlineoverridevirtual |
Return the attribute's copy interface or NULL.
Reimplemented from GA_Attribute.
Definition at line 252 of file GA_ATIBlob.h.
|
inlineoverridevirtual |
Return the attribute's interpolation interface or NULL.
Reimplemented from GA_Attribute.
Definition at line 253 of file GA_ATIBlob.h.
|
inlineoverridevirtual |
Return the attribute's merge interface or NULL.
Reimplemented from GA_Attribute.
Definition at line 250 of file GA_ATIBlob.h.
|
inline |
Get the blob associated with a given offset into the array
Definition at line 201 of file GA_ATIBlob.h.
|
inline |
Look up a blob handle by offset.
Definition at line 182 of file GA_ATIBlob.h.
|
inline |
Return the maximum index of any blob in the container. This may be more than the number of blobs in the container. If the maximum index is less than 0, there are no blobs in the container.
Definition at line 173 of file GA_ATIBlob.h.
|
overridevirtual |
Report approximate memory usage.
Implements GA_Attribute.
|
inline |
Lookup a blob given an ordered index.
Definition at line 233 of file GA_ATIBlob.h.
|
inline |
Get the blob associated with a given offset into the array
Definition at line 206 of file GA_ATIBlob.h.
|
inline |
Get a measure of the vacancy entropy of the storage container. This.
Definition at line 241 of file GA_ATIBlob.h.
|
inlineoverridevirtual |
Adding blobs is thread-safe, so we're only subject to GA_PageArray limitations.
Implements GA_Attribute.
Definition at line 246 of file GA_ATIBlob.h.
|
inline |
Get the tuple size.
Definition at line 163 of file GA_ATIBlob.h.
|
inlinestatic |
Definition at line 100 of file GA_ATIBlob.h.
|
inlinestatic |
Definition at line 97 of file GA_ATIBlob.h.
|
overridevirtual |
Harden data pages.
Implements GA_Attribute.
|
protectedvirtual |
Interface used by AIFCompare. By default, this will use the blob key comparison to determine equality.
|
protectedvirtual |
Interface used by AIFCompare. By default, this will use the blob key comparison to determine equality.
|
inlinestatic |
Definition at line 103 of file GA_ATIBlob.h.
bool GA_ATIBlob::jsonLoad | ( | UT_JSONParser & | p, |
const GA_BlobDataLoader & | blobloader, | ||
const GA_LoadMap & | load, | ||
const char * | blobtoken = "data" |
||
) |
Load blobs from a JSON stream. This method can be called by sub-classes to load their data from a JSON stream. The class must provide a GA_BlobDataLoader class which is used to create and load new blob data.
p | The JSON parser |
blobloader | A class to create and load blobs |
load | Load options |
blobtoken | The token used to identify the blob data |
bool GA_ATIBlob::jsonSave | ( | UT_JSONWriter & | w, |
const GA_SaveMap & | s, | ||
const char * | blobtoken = "data" |
||
) | const |
Save blobs to a JSON stream. This method can be called by sub-classes to save blob data to a JSON stream. Since the GA_ATIBlob class doesn't provide an GA_AIFJSON interface, data is not saved/loaded by default.
w | The JSON writer |
s | The save map options |
blobtoken | The token used to identify the blob data |
|
inline |
Look up a blob given its handle
Definition at line 224 of file GA_ATIBlob.h.
|
inline |
Look up a blob given its handle
Definition at line 228 of file GA_ATIBlob.h.
|
inlineoverridevirtual |
Returns true iff that is an attribute whose content can be copied from this without any type conversions. This is important to avoid reallocation of an attribute if its storage type, including tuple size, matches the source attribute exactly.
Reimplemented from GA_Attribute.
Definition at line 311 of file GA_ATIBlob.h.
|
protected |
Base class implementation of GA_AIFMerge::addDestination()
|
protected |
Base class implementation of GA_AIFMerge::copyArray()
|
protected |
GA_AIFMerge Base class implementation of GA_AIFMerge::destroyDestination()
|
protected |
Base class implementation of GA_AIFMerge::growArray()
|
overrideprotectedvirtual |
Blob attributes need each element to properly destruct for accurate reference counting.
Reimplemented from GA_Attribute.
When the array size is grown, attributes should initialize the value appropriately. When elements are reused, however, reconstructElementBlock is called. This happens if an element is deleted and then a new element is allocated (using the existing slot)
Implements GA_Attribute.
|
static |
|
overridevirtual |
This replaces the entirety of this attribute's content and non- storage metadata (except the name) with that of the src attribute. matchesStorage(src) should already return true. This is primarily for use by GA_AttributeSet::replace(). NOTE: The internal content sizes may not match exactly if the attribute type may overallocate, but the sizes should be such that any real data will fit in the destination, so be careful and deal with the myTailInitialize flag appropriately if any extra elements aren't equal to the default.
Implements GA_Attribute.
bool GA_ATIBlob::replaceBlob | ( | GA_BlobIndex | handle, |
const GA_BlobRef & | blob | ||
) |
Replace a blob in the blob container with a new blob value.
|
overridevirtual |
Grow or shrink the array size.
Implements GA_Attribute.
bool GA_ATIBlob::setBlob | ( | const GA_BlobRef & | blob, |
GA_Offset | offset, | ||
int | tuple_index = 0 |
||
) |
Store a new blob at the given offset.
bool GA_ATIBlob::setBlobIndex | ( | GA_BlobIndex | blob_index, |
GA_Offset | offset, | ||
int | tuple_idx = 0 |
||
) |
Store a new blob_index at the given offset.
bool GA_ATIBlob::setBlobIndex | ( | GA_BlobIndex | blob_i, |
const GA_Range & | di, | ||
int | tuple_index = 0 |
||
) |
Store a new blob_index at the given range of offsets.
|
protectedvirtual |
Grow or shrink the tuple size.
|
overridevirtual |
Try to compress data pages.
Implements GA_Attribute.
bool GA_ATIBlob::validate | ( | ) | const |
Validates the internal structure for debugging purposes.
|
protected |
Blob references. This is protected for convenience to sub-classes.
Definition at line 466 of file GA_ATIBlob.h.
|
protected |
Array of handles. The default value is -1. This is protected for convenience to sub-classes.
Definition at line 463 of file GA_ATIBlob.h.