448 return this->
columns[colIndex].attrId;
457 return this->
columns[colIndex].attrId.GetName();
466 return this->
columns[colIndex].attrId.GetFourCC();
475 return this->
columns[colIndex].attrId.GetAccessMode();
484 return this->
columns[colIndex].attrId.GetValueType();
505 return (
void*)((
char*)this->
valueBuffer + bufferOffset);
516 int* valuePtr = (
int*) this->
GetValuePtr(colIndex, rowIndex);
517 *valuePtr = val ? 1 : 0;
529 int* valuePtr = (
int*) this->
GetValuePtr(colIndex, rowIndex);
530 return (*valuePtr != 0);
541 float* valuePtr = (
float*) this->
GetValuePtr(colIndex, rowIndex);
554 float* valuePtr = (
float*) this->
GetValuePtr(colIndex, rowIndex);
566 int* valuePtr = (
int*) this->
GetValuePtr(colIndex, rowIndex);
579 int* valuePtr = (
int*) this->
GetValuePtr(colIndex, rowIndex);
706 this->
CopyGuid(colIndex, rowIndex, val);
734 this->
CopyBlob(colIndex, rowIndex, val);
An attribute ID is used to carry attribute types (no values) around.
Definition attrid.h:20
A compiletime-typesafe key/value pair.
Definition attribute.h:32
A table of attributes with a compact memory footprint and fast random access.
Definition attributetable.h:34
void ReserveRows(SizeT numRows)
reserve rows to reduce re-allocation overhead
Definition attributetable.cc:704
void SetRowToDefaultValues(IndexT rowIndex)
set a row to its default values
Definition attributetable.cc:1078
IndexT CopyRow(IndexT rowIndex)
create a new row as copy of another row
Definition attributetable.cc:572
SizeT allocatedRows
Definition attributetable.h:282
SizeT GetNumRows() const
get number of rows in table
Definition attributetable.h:491
void BeginAddColumns(bool recordNewColumns=true)
optional: call before adding columns, speeds up adding many columns at once
Definition attributetable.cc:412
ValueType GetColumnValueType(IndexT colIndex) const
get a column's value type
Definition attributetable.h:482
IndexT FindRowIndexByAttr(const Attribute &attr) const
find all matching row indices by attribute value
Definition attributetable.cc:1023
bool HasDeletedRows() const
return true if table has deleted rows
Definition attributetable.h:330
AttributeTable()
constructor
Definition attributetable.cc:19
IndexT GetColumnIndex(const AttrId &id) const
return index of column by id
Definition attributetable.h:428
bool HasNewRows() const
return true if table has new rows
Definition attributetable.h:320
Util::Array< IndexT > GetModifiedRowsExcludeNewAndDeletedRows() const
return array of modified rows, exclude rows marked as rows
Definition attributetable.cc:1265
bool addColumnsRecordAsNewColumns
Definition attributetable.h:291
void InternalAddColumnHelper(const AttrId &id, bool recordAsNewColumn)
internal helper method for adding a column
Definition attributetable.cc:426
uchar * rowDeletedBuffer
Definition attributetable.h:285
void SetBlob(const BlobAttrId &colAttrId, IndexT rowIndex, const Util::Blob &blob)
set blob value
Definition attributetable.h:884
void DeleteAllRows()
mark all rows as deleted
Definition attributetable.cc:556
void SetBool(const BoolAttrId &colAttrId, IndexT rowIndex, bool val)
set bool value
Definition attributetable.h:758
void SetColumnVec4(const Vec4AttrId &attrId, const Math::vec4 &val)
set entire column vec4 value
void SetModifiedTracking(bool b)
enable/disable modified tracking (default is on)
Definition attributetable.h:300
Math::mat4 GetMat4(const Mat4AttrId &colAttrId, IndexT rowIndex) const
get mat4 value
Definition attributetable.h:839
void DeleteString(IndexT colIndex, IndexT rowIndex)
delete a string from the table
Definition attributetable.cc:116
bool trackModifications
Definition attributetable.h:287
const Util::Array< IndexT > & GetReadWriteColumnIndices() const
return indices of all ReadWrite columns
Definition attributetable.h:350
void * GetRowUserData(IndexT rowIndex) const
get optional row user data pointer
Definition attributetable.cc:1068
Attr::Attribute GetAttr(IndexT rowIndex, IndexT colIndex) const
get a generic attribute
Definition attributetable.cc:1239
void SetColumnToDefaultValues(IndexT colIndex)
set entire column to its default values
Definition attributetable.cc:1107
SizeT UpdateColumnOffsets()
update the column byte offset and return new pitch
Definition attributetable.cc:389
void CopyBlob(IndexT colIndex, IndexT rowIndex, const Util::Blob &val)
copy a blob into the table
Definition attributetable.cc:166
__DeclareClass(AttributeTable)
bool inBeginAddColumns
Definition attributetable.h:290
SizeT GetValueTypeSize(ValueType type) const
returns the byte size of the given value type
Definition attributetable.cc:362
IndexT CopyExtRow(AttributeTable *other, IndexT otherRowIndex, bool createMissingRows=false)
create a new row as copy of a row from another value table
Definition attributetable.cc:638
uchar * rowModifiedBuffer
Definition attributetable.h:284
SizeT rowPitch
Definition attributetable.h:280
void SetColumnBool(const BoolAttrId &attrId, bool val)
set entire column float value
void SetVec4(const Vec4AttrId &colAttrId, IndexT rowIndex, const Math::vec4 &val)
set float4 value
Definition attributetable.h:812
void CopyGuid(IndexT colIndex, IndexT rowIndex, const Util::Guid &val)
copy a guid into the table
Definition attributetable.cc:131
void ClearNewRowFlags()
clear the new row flags, so that new rows are treated like updated rows
Definition attributetable.cc:770
Util::Dictionary< AttrId, IndexT > indexMap
Definition attributetable.h:274
virtual ~AttributeTable()
destructor
Definition attributetable.cc:59
IndexT AddRow()
add a row to the table, returns index of new row
Definition attributetable.cc:721
const Util::Blob & GetBlob(const BlobAttrId &colAttrId, IndexT rowIndex) const
get blob value
Definition attributetable.h:893
bool HasModifiedRows() const
return true if table has modified rows
Definition attributetable.h:340
uint GetUInt(IndexT colIndex, IndexT rowIndex) const
get uint value by column index
Definition attributetable.h:601
bool HasColumn(const AttrId &id) const
return true if a column exists
Definition attributetable.h:419
void CopyString(IndexT colIndex, IndexT rowIndex, const Util::String &val)
copy a string into the table
Definition attributetable.cc:96
bool IsRowModified(IndexT rowIndex) const
return true if a row has been modified since the last ResetModifiedState()
Definition attributetable.h:360
IndexT firstNewColumnIndex
Definition attributetable.h:292
const Util::Array< IndexT > & GetDeletedRowIndices() const
return indices of rows deleted since the last ResetModifiedState()
Definition attributetable.h:401
IndexT FindRowIndexByAttrs(const Util::Array< Attribute > &attrs) const
find all matching row indices by multiple attribute values
Definition attributetable.cc:1042
bool GetBool(const BoolAttrId &colAttrId, IndexT rowIndex) const
get bool value
Definition attributetable.h:767
Util::Array< IndexT > deletedRowIndices
Definition attributetable.h:278
Util::Array< IndexT > FindRowIndicesByAttr(const Attribute &attr, bool firstMatchOnly) const
find all matching row indices by attribute value
Definition attributetable.cc:1001
const AttrId & GetColumnId(IndexT colIndex) const
get column definition at index
Definition attributetable.h:446
void DeleteRow(IndexT rowIndex)
mark a row as deleted from the table
Definition attributetable.cc:533
Math::vec4 GetVec4(const Vec4AttrId &colAttrId, IndexT rowIndex) const
get float4 value
Definition attributetable.h:821
Util::Array< IndexT > InternalFindRowIndicesByAttrs(const Util::Array< Attr::Attribute > &attr, bool firstMatchOnly) const
internal row-indices-by-multiple-attrs find method
Definition attributetable.cc:795
const Util::Guid & GetGuid(const GuidAttrId &colAttrId, IndexT rowIndex) const
get guid value
Definition attributetable.h:875
void SetInt(const IntAttrId &colAttrId, IndexT rowIndex, int val)
set int value
Definition attributetable.h:794
Util::Array< IndexT > newColumnIndices
Definition attributetable.h:276
void PrintDebug()
print the contents of the table for debugging reasons
Definition attributetable.cc:1286
void SetMat4(const Mat4AttrId &colAttrId, IndexT rowIndex, const Math::mat4 &val)
set mat4 value
Definition attributetable.h:830
void SetVariant(const Attr::AttrId &attrId, IndexT rowIndex, const Util::Variant &val)
set variant value
Definition attributetable.cc:1329
void SetGuid(const GuidAttrId &colAttrId, IndexT rowIndex, const Util::Guid &guid)
set guid value
Definition attributetable.h:866
void SetString(const StringAttrId &colAttrId, IndexT rowIndex, const Util::String &val)
set string value
Definition attributetable.h:848
const Util::Array< IndexT > & GetNewColumnIndices() const
return indices of columns added since the last ResetModifiedState()
Definition attributetable.h:410
void * GetValuePtr(IndexT colIndex, IndexT rowIndex) const
returns pointer to a value's memory location
Definition attributetable.h:501
void DeleteGuid(IndexT colIndex, IndexT rowIndex)
delete a guid from the table
Definition attributetable.cc:151
void SetColumnString(const StringAttrId &attrId, const Util::String &val)
set entire column to string value
void EndAddColumns()
optional: call after adding columns, speeds up adding many columns at once
Definition attributetable.cc:460
void SetColumnInt(const IntAttrId &attrId, int val)
set entire column to int value
bool rowsModified
Definition attributetable.h:289
void SetFloat(const FloatAttrId &colAttrId, IndexT rowIndex, float val)
set float value
Definition attributetable.h:776
bool isModified
Definition attributetable.h:288
void ResetModifiedState()
reset all the modified bits in the table
Definition attributetable.cc:71
const Util::FourCC & GetColumnFourCC(IndexT colIndex) const
get column FourCC
Definition attributetable.h:464
void SetColumnMat4(const Mat4AttrId &attrId, const Math::mat4 &val)
set entire column to mat4 value
bool IsModified() const
return true if the object has been modified since the last ResetModifiedState()
Definition attributetable.h:383
void DeleteRowData(IndexT rowIndex)
delete row data, frees all memory used in one row
Definition attributetable.cc:1386
void SetUInt(IndexT colIndex, IndexT rowIndex, uint val)
set uint value by column index
Definition attributetable.h:587
const Util::Array< IndexT > & GetNewRowIndices() const
return indices of rows added since the last ResetModfiedState()
Definition attributetable.h:392
bool GetModifiedTracking() const
get modified tracking flag
Definition attributetable.h:310
void * valueBuffer
Definition attributetable.h:283
Util::Array< IndexT > readWriteColumnIndices
Definition attributetable.h:275
void SetColumnGuid(const GuidAttrId &attrId, const Util::Guid &guid)
set entire column to guid value
void Clear()
clear the table object
Definition attributetable.cc:268
Util::Array< void * > userData
Definition attributetable.h:279
AccessMode GetColumnAccessMode(IndexT colIndex) const
get a column's access mode
Definition attributetable.h:473
void Realloc(SizeT newPitch, SizeT newAllocRows)
(re-)allocate the current buffer
Definition attributetable.cc:279
int GetInt(const IntAttrId &colAttrId, IndexT rowIndex) const
get int value
Definition attributetable.h:803
void DeleteBlob(IndexT colIndex, IndexT rowIndex)
delete a blob from the table
Definition attributetable.cc:186
Util::Array< IndexT > InternalFindRowIndicesByAttr(const Attr::Attribute &attr, bool firstMatchOnly) const
internal row-indices-by-attr find method
Definition attributetable.cc:903
void AddColumn(const AttrId &id, bool recordNewColumn=true)
add a column
Definition attributetable.cc:498
void ClearDeletedRowsFlags()
clear deleted rows flags
Definition attributetable.cc:781
void SetAttr(const Attr::Attribute &attr, IndexT rowIndex)
set a generic attribute (slow!)
Definition attributetable.cc:1214
void SetRowUserData(IndexT rowIndex, void *p)
set an optional row user data pointer
Definition attributetable.cc:1059
bool IsRowDeleted(IndexT rowIndex) const
return true if row has been marked as deleted
Definition attributetable.h:372
void Delete()
delete all externally allocated data of this object
Definition attributetable.cc:202
const Util::String & GetString(const StringAttrId &colAttrId, IndexT rowIndex) const
get string value
Definition attributetable.h:857
SizeT GetNumColumns() const
get number of columns
Definition attributetable.h:437
void SetColumnBlob(const BlobAttrId &attrId, const Util::Blob &blob)
set entire column to blob value
uchar * rowNewBuffer
Definition attributetable.h:286
SizeT numRows
Definition attributetable.h:281
Util::Array< IndexT > FindRowIndicesByAttrs(const Util::Array< Attribute > &attrs, bool firstMatchOnly) const
find all matching row indices by multiple attribute values
Definition attributetable.cc:1012
void SetColumnFloat(const FloatAttrId &attrId, float val)
set entire column float value
Util::Array< ColumnInfo > columns
Definition attributetable.h:273
Util::Array< IndexT > newRowIndices
Definition attributetable.h:277
float GetFloat(const FloatAttrId &colAttrId, IndexT rowIndex) const
get float value
Definition attributetable.h:785
const Util::String & GetColumnName(IndexT colIndex) const
get a column's name
Definition attributetable.h:455
bool LoadXmlTable(const Util::String &fileName)
load xml table
Typed attribute id for blob type.
Definition blobattrid.h:18
Typed attribute id for bool type.
Definition boolattrid.h:18
Typed attribute id for float type.
Definition floatattrid.h:18
Typed attribute id for guid type.
Definition guidattrid.h:18
Typed attribute id for integer type.
Definition intattrid.h:18
Typed attribute id for mat4 type.
Definition mat4attrid.h:18
Typed attribute id for string type.
Definition stringattrid.h:18
Typed attribute id for vec4 type.
Definition vec4attrid.h:18
The common base class of Nebula.
Definition refcounted.h:38
Nebula's dynamic array class.
Definition array.h:60
const SizeT Size() const
get number of elements in array
Definition array.h:880
The Util::Blob class encapsulates a chunk of raw memory into a C++ object which can be copied,...
Definition blob.h:22
A collection of key/value pairs with quick value retrieval by key at roughly O(log n).
Definition dictionary.h:34
A four-character-code is a quasi-human-readable 32-bit-id.
Definition fourcc.h:19
An "any type" variable.
Definition variant.h:31
#define n_assert(exp)
Definition debug.h:50
Definition accessmode.h:13
ValueType
Definition valuetype.h:20
@ Vec4Type
Definition valuetype.h:33
@ IntType
Definition valuetype.h:25
@ FloatType
Definition valuetype.h:29
@ Mat4Type
Definition valuetype.h:36
@ BoolType
Definition valuetype.h:31
@ StringType
Definition valuetype.h:35
@ BlobType
Definition valuetype.h:38
@ UIntType
Definition valuetype.h:26
@ GuidType
Definition valuetype.h:39
AccessMode
Definition accessmode.h:15
float scalar
Definition scalar.h:45
Definition attributetable.h:269
IndexT byteOffset
Definition attributetable.h:271
AttrId attrId
Definition attributetable.h:270
A 4x4 single point precision float matrix.
Definition mat4.h:49
void loadu(const scalar *ptr)
load content from unaligned memory
Definition mat4.h:215
void storeu(scalar *ptr) const
write content to unaligned memory through the write cache
Definition mat4.h:250
A 4D vector.
Definition vec4.h:24
void loadu(const scalar *ptr)
load content from unaligned memory
Definition vec4.h:181
void storeu(scalar *ptr) const
write content to unaligned memory through the write cache
Definition vec4.h:201
Nebula's universal string class.
Definition string.h:50
unsigned char uchar
Definition types.h:33
int SizeT
Definition types.h:49
unsigned int uint
Definition types.h:31
int IndexT
Definition types.h:48