456 return this->
columns[colIndex].attrId;
465 return this->
columns[colIndex].attrId.GetName();
474 return this->
columns[colIndex].attrId.GetFourCC();
483 return this->
columns[colIndex].attrId.GetAccessMode();
492 return this->
columns[colIndex].attrId.GetValueType();
513 return (
void*)((
char*)this->
valueBuffer + bufferOffset);
524 int* valuePtr = (
int*) this->
GetValuePtr(colIndex, rowIndex);
525 *valuePtr = val ? 1 : 0;
537 int* valuePtr = (
int*) this->
GetValuePtr(colIndex, rowIndex);
538 return (*valuePtr != 0);
549 float* valuePtr = (
float*) this->
GetValuePtr(colIndex, rowIndex);
562 float* valuePtr = (
float*) this->
GetValuePtr(colIndex, rowIndex);
574 int* valuePtr = (
int*) this->
GetValuePtr(colIndex, rowIndex);
587 int* valuePtr = (
int*) this->
GetValuePtr(colIndex, rowIndex);
599 int64_t* valuePtr = (int64_t*) this->
GetValuePtr(colIndex, rowIndex);
612 int64_t* valuePtr = (int64_t*) this->
GetValuePtr(colIndex, rowIndex);
739 this->
CopyGuid(colIndex, rowIndex, val);
751inline const Util::Guid&
755 Util::Guid** valuePtr = (Util::Guid**) this->
GetValuePtr(colIndex, rowIndex);
767 this->
CopyBlob(colIndex, rowIndex, val);
925inline const Util::Guid&
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:33
int64_t GetInt64(const Int64AttrId &colAttrId, IndexT rowIndex) const
get int64 value
Definition attributetable.h:854
void ReserveRows(SizeT numRows)
reserve rows to reduce re-allocation overhead
Definition attributetable.cc:711
void SetRowToDefaultValues(IndexT rowIndex)
set a row to its default values
Definition attributetable.cc:1085
IndexT CopyRow(IndexT rowIndex)
create a new row as copy of another row
Definition attributetable.cc:571
SizeT allocatedRows
Definition attributetable.h:290
SizeT GetNumRows() const
get number of rows in table
Definition attributetable.h:499
void BeginAddColumns(bool recordNewColumns=true)
optional: call before adding columns, speeds up adding many columns at once
Definition attributetable.cc:411
ValueType GetColumnValueType(IndexT colIndex) const
get a column's value type
Definition attributetable.h:490
IndexT FindRowIndexByAttr(const Attribute &attr) const
find all matching row indices by attribute value
Definition attributetable.cc:1030
bool HasDeletedRows() const
return true if table has deleted rows
Definition attributetable.h:338
AttributeTable()
constructor
Definition attributetable.cc:19
IndexT GetColumnIndex(const AttrId &id) const
return index of column by id
Definition attributetable.h:436
bool HasNewRows() const
return true if table has new rows
Definition attributetable.h:328
Util::Array< IndexT > GetModifiedRowsExcludeNewAndDeletedRows() const
return array of modified rows, exclude rows marked as rows
Definition attributetable.cc:1283
bool addColumnsRecordAsNewColumns
Definition attributetable.h:299
void InternalAddColumnHelper(const AttrId &id, bool recordAsNewColumn)
internal helper method for adding a column
Definition attributetable.cc:425
uchar * rowDeletedBuffer
Definition attributetable.h:293
void SetBlob(const BlobAttrId &colAttrId, IndexT rowIndex, const Util::Blob &blob)
set blob value
Definition attributetable.h:935
void DeleteAllRows()
mark all rows as deleted
Definition attributetable.cc:555
void SetBool(const BoolAttrId &colAttrId, IndexT rowIndex, bool val)
set bool value
Definition attributetable.h:791
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:308
Math::mat4 GetMat4(const Mat4AttrId &colAttrId, IndexT rowIndex) const
get mat4 value
Definition attributetable.h:890
void DeleteString(IndexT colIndex, IndexT rowIndex)
delete a string from the table
Definition attributetable.cc:116
bool trackModifications
Definition attributetable.h:295
const Util::Array< IndexT > & GetReadWriteColumnIndices() const
return indices of all ReadWrite columns
Definition attributetable.h:358
void * GetRowUserData(IndexT rowIndex) const
get optional row user data pointer
Definition attributetable.cc:1075
Attr::Attribute GetAttr(IndexT rowIndex, IndexT colIndex) const
get a generic attribute
Definition attributetable.cc:1257
void SetColumnToDefaultValues(IndexT colIndex)
set entire column to its default values
Definition attributetable.cc:1115
SizeT UpdateColumnOffsets()
update the column byte offset and return new pitch
Definition attributetable.cc:388
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:298
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:641
uchar * rowModifiedBuffer
Definition attributetable.h:292
SizeT rowPitch
Definition attributetable.h:288
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:863
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:777
Util::Dictionary< AttrId, IndexT > indexMap
Definition attributetable.h:282
virtual ~AttributeTable()
destructor
Definition attributetable.cc:59
IndexT AddRow()
add a row to the table, returns index of new row
Definition attributetable.cc:728
const Util::Blob & GetBlob(const BlobAttrId &colAttrId, IndexT rowIndex) const
get blob value
Definition attributetable.h:944
bool HasModifiedRows() const
return true if table has modified rows
Definition attributetable.h:348
uint GetUInt(IndexT colIndex, IndexT rowIndex) const
get uint value by column index
Definition attributetable.h:634
bool HasColumn(const AttrId &id) const
return true if a column exists
Definition attributetable.h:427
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:368
IndexT firstNewColumnIndex
Definition attributetable.h:300
const Util::Array< IndexT > & GetDeletedRowIndices() const
return indices of rows deleted since the last ResetModifiedState()
Definition attributetable.h:409
IndexT FindRowIndexByAttrs(const Util::Array< Attribute > &attrs) const
find all matching row indices by multiple attribute values
Definition attributetable.cc:1049
bool GetBool(const BoolAttrId &colAttrId, IndexT rowIndex) const
get bool value
Definition attributetable.h:800
Util::Array< IndexT > deletedRowIndices
Definition attributetable.h:286
Util::Array< IndexT > FindRowIndicesByAttr(const Attribute &attr, bool firstMatchOnly) const
find all matching row indices by attribute value
Definition attributetable.cc:1008
const AttrId & GetColumnId(IndexT colIndex) const
get column definition at index
Definition attributetable.h:454
void DeleteRow(IndexT rowIndex)
mark a row as deleted from the table
Definition attributetable.cc:532
Math::vec4 GetVec4(const Vec4AttrId &colAttrId, IndexT rowIndex) const
get float4 value
Definition attributetable.h:872
Util::Array< IndexT > InternalFindRowIndicesByAttrs(const Util::Array< Attr::Attribute > &attr, bool firstMatchOnly) const
internal row-indices-by-multiple-attrs find method
Definition attributetable.cc:802
const Util::Guid & GetGuid(const GuidAttrId &colAttrId, IndexT rowIndex) const
get guid value
Definition attributetable.h:926
void SetInt(const IntAttrId &colAttrId, IndexT rowIndex, int val)
set int value
Definition attributetable.h:827
Util::Array< IndexT > newColumnIndices
Definition attributetable.h:284
void PrintDebug()
print the contents of the table for debugging reasons
Definition attributetable.cc:1304
void SetMat4(const Mat4AttrId &colAttrId, IndexT rowIndex, const Math::mat4 &val)
set mat4 value
Definition attributetable.h:881
void SetInt64(const Int64AttrId &colAttrId, IndexT rowIndex, int64_t val)
set int64 value
Definition attributetable.h:845
void SetVariant(const Attr::AttrId &attrId, IndexT rowIndex, const Util::Variant &val)
set variant value
Definition attributetable.cc:1347
void SetGuid(const GuidAttrId &colAttrId, IndexT rowIndex, const Util::Guid &guid)
set guid value
Definition attributetable.h:917
void SetString(const StringAttrId &colAttrId, IndexT rowIndex, const Util::String &val)
set string value
Definition attributetable.h:899
const Util::Array< IndexT > & GetNewColumnIndices() const
return indices of columns added since the last ResetModifiedState()
Definition attributetable.h:418
void * GetValuePtr(IndexT colIndex, IndexT rowIndex) const
returns pointer to a value's memory location
Definition attributetable.h:509
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:459
void SetColumnInt(const IntAttrId &attrId, int val)
set entire column to int value
bool rowsModified
Definition attributetable.h:297
void SetFloat(const FloatAttrId &colAttrId, IndexT rowIndex, float val)
set float value
Definition attributetable.h:809
bool isModified
Definition attributetable.h:296
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:472
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:391
void DeleteRowData(IndexT rowIndex)
delete row data, frees all memory used in one row
Definition attributetable.cc:1404
void SetUInt(IndexT colIndex, IndexT rowIndex, uint val)
set uint value by column index
Definition attributetable.h:620
const Util::Array< IndexT > & GetNewRowIndices() const
return indices of rows added since the last ResetModfiedState()
Definition attributetable.h:400
bool GetModifiedTracking() const
get modified tracking flag
Definition attributetable.h:318
void * valueBuffer
Definition attributetable.h:291
Util::Array< IndexT > readWriteColumnIndices
Definition attributetable.h:283
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:287
AccessMode GetColumnAccessMode(IndexT colIndex) const
get a column's access mode
Definition attributetable.h:481
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:836
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:910
void AddColumn(const AttrId &id, bool recordNewColumn=true)
add a column
Definition attributetable.cc:497
void ClearDeletedRowsFlags()
clear deleted rows flags
Definition attributetable.cc:788
void SetAttr(const Attr::Attribute &attr, IndexT rowIndex)
set a generic attribute (slow!)
Definition attributetable.cc:1232
void SetRowUserData(IndexT rowIndex, void *p)
set an optional row user data pointer
Definition attributetable.cc:1066
bool IsRowDeleted(IndexT rowIndex) const
return true if row has been marked as deleted
Definition attributetable.h:380
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:908
SizeT GetNumColumns() const
get number of columns
Definition attributetable.h:445
void SetColumnBlob(const BlobAttrId &attrId, const Util::Blob &blob)
set entire column to blob value
uchar * rowNewBuffer
Definition attributetable.h:294
SizeT numRows
Definition attributetable.h:289
Util::Array< IndexT > FindRowIndicesByAttrs(const Util::Array< Attribute > &attrs, bool firstMatchOnly) const
find all matching row indices by multiple attribute values
Definition attributetable.cc:1019
void SetColumnFloat(const FloatAttrId &attrId, float val)
set entire column float value
Util::Array< ColumnInfo > columns
Definition attributetable.h:281
Util::Array< IndexT > newRowIndices
Definition attributetable.h:285
float GetFloat(const FloatAttrId &colAttrId, IndexT rowIndex) const
get float value
Definition attributetable.h:818
const Util::String & GetColumnName(IndexT colIndex) const
get a column's name
Definition attributetable.h:463
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
Definition intattrid.h:97
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
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:32
#define n_assert(exp)
Definition debug.h:50
Definition accessmode.h:13
ValueType
Definition valuetype.h:20
@ Vec4Type
Definition valuetype.h:32
@ IntType
Definition valuetype.h:25
@ FloatType
Definition valuetype.h:28
@ Mat4Type
Definition valuetype.h:35
@ BoolType
Definition valuetype.h:30
@ Int64Type
Definition valuetype.h:27
@ StringType
Definition valuetype.h:34
@ BlobType
Definition valuetype.h:37
@ UIntType
Definition valuetype.h:26
@ GuidType
Definition valuetype.h:38
AccessMode
Definition accessmode.h:15
float scalar
Definition scalar.h:45
Definition attributetable.h:277
IndexT byteOffset
Definition attributetable.h:279
AttrId attrId
Definition attributetable.h:278
A 4x4 single point precision float matrix.
Definition mat4.h:49
void loadu(const scalar *ptr)
load content from unaligned memory
Definition mat4.h:244
void storeu(scalar *ptr) const
write content to unaligned memory through the write cache
Definition mat4.h:279
A 4D vector.
Definition vec4.h:24
void loadu(const scalar *ptr)
load content from unaligned memory
Definition vec4.h:183
void storeu(scalar *ptr) const
write content to unaligned memory through the write cache
Definition vec4.h:203
Nebula's universal string class.
Definition String.cs:8
unsigned char uchar
Definition types.h:35
int SizeT
Definition types.h:42
unsigned int uint
Definition types.h:33
int IndexT
Definition types.h:41