Nebula
Loading...
Searching...
No Matches
Db::ValueTable Class Reference

#include <valuetable.h>

Detailed Description

A table of database values.

This is the basic data container of the database subsystem. ValueTables are used to store the result of a query or to define the data which should be written back into the database.

Inherits Attr::AttributeTable.

Public Member Functions

 ValueTable ()
 constructor
virtual ~ValueTable ()
 destructor
Public Member Functions inherited from Attr::AttributeTable
 AttributeTable ()
 constructor
 AttributeTable (std::initializer_list< Attr::AttrId > columns, bool recordColumns=false)
 construct with initializer list
virtual ~AttributeTable ()
 destructor
void SetModifiedTracking (bool b)
 enable/disable modified tracking (default is on)
bool GetModifiedTracking () const
 get modified tracking flag
bool IsModified () const
 return true if the object has been modified since the last ResetModifiedState()
void ResetModifiedState ()
 reset all the modified bits in the table
void Clear ()
 clear the table object
void PrintDebug ()
 print the contents of the table for debugging reasons
void BeginAddColumns (bool recordNewColumns=true)
 optional: call before adding columns, speeds up adding many columns at once
void AddColumn (const AttrId &id, bool recordNewColumn=true)
 add a column
void EndAddColumns ()
 optional: call after adding columns, speeds up adding many columns at once
bool HasColumn (const AttrId &id) const
 return true if a column exists
IndexT GetColumnIndex (const AttrId &id) const
 return index of column by id
SizeT GetNumColumns () const
 get number of columns
const AttrIdGetColumnId (IndexT colIndex) const
 get column definition at index
const Util::StringGetColumnName (IndexT colIndex) const
 get a column's name
const Util::FourCCGetColumnFourCC (IndexT colIndex) const
 get column FourCC
AccessMode GetColumnAccessMode (IndexT colIndex) const
 get a column's access mode
ValueType GetColumnValueType (IndexT colIndex) const
 get a column's value type
const Util::Array< IndexT > & GetNewColumnIndices () const
 return indices of columns added since the last ResetModifiedState()
const Util::Array< IndexT > & GetReadWriteColumnIndices () const
 return indices of all ReadWrite columns
IndexT AddRow ()
 add a row to the table, returns index of new row
void ClearNewRowFlags ()
 clear the new row flags, so that new rows are treated like updated rows
void ClearDeletedRowsFlags ()
 clear deleted rows flags
void DeleteRow (IndexT rowIndex)
 mark a row as deleted from the table
void DeleteAllRows ()
 mark all rows as deleted
bool IsRowDeleted (IndexT rowIndex) const
 return true if row has been marked as deleted
IndexT CopyRow (IndexT rowIndex)
 create a new row as copy of another row
void CopyRow (IndexT srcRowIndex, IndexT dstRowIndex)
 Copy contents of one row into another.
IndexT CopyExtRow (AttributeTable *other, IndexT otherRowIndex, bool createMissingRows=false)
 create a new row as copy of a row from another value table
SizeT GetNumRows () const
 get number of rows in table
bool HasNewRows () const
 return true if table has new rows
bool HasModifiedRows () const
 return true if table has modified rows
bool HasDeletedRows () const
 return true if table has deleted rows
bool IsRowModified (IndexT rowIndex) const
 return true if a row has been modified since the last ResetModifiedState()
const Util::Array< IndexT > & GetNewRowIndices () const
 return indices of rows added since the last ResetModfiedState()
const Util::Array< IndexT > & GetDeletedRowIndices () const
 return indices of rows deleted since the last ResetModifiedState()
Util::Array< IndexTGetModifiedRowsExcludeNewAndDeletedRows () const
 return array of modified rows, exclude rows marked as rows
void ReserveRows (SizeT numRows)
 reserve rows to reduce re-allocation overhead
Util::Array< IndexTFindRowIndicesByAttr (const Attribute &attr, bool firstMatchOnly) const
 find all matching row indices by attribute value
Util::Array< IndexTFindRowIndicesByAttrs (const Util::Array< Attribute > &attrs, bool firstMatchOnly) const
 find all matching row indices by multiple attribute values
IndexT FindRowIndexByAttr (const Attribute &attr) const
 find all matching row indices by attribute value
IndexT FindRowIndexByAttrs (const Util::Array< Attribute > &attrs) const
 find all matching row indices by multiple attribute values
void SetRowUserData (IndexT rowIndex, void *p)
 set an optional row user data pointer
void * GetRowUserData (IndexT rowIndex) const
 get optional row user data pointer
void SetAttr (const Attr::Attribute &attr, IndexT rowIndex)
 set a generic attribute (slow!)
Attr::Attribute GetAttr (IndexT rowIndex, IndexT colIndex) const
 get a generic attribute
void SetVariant (const Attr::AttrId &attrId, IndexT rowIndex, const Util::Variant &val)
 set variant value
void SetBool (const BoolAttrId &colAttrId, IndexT rowIndex, bool val)
 set bool value
bool GetBool (const BoolAttrId &colAttrId, IndexT rowIndex) const
 get bool value
void SetFloat (const FloatAttrId &colAttrId, IndexT rowIndex, float val)
 set float value
float GetFloat (const FloatAttrId &colAttrId, IndexT rowIndex) const
 get float value
void SetInt (const IntAttrId &colAttrId, IndexT rowIndex, int val)
 set int value
int GetInt (const IntAttrId &colAttrId, IndexT rowIndex) const
 get int value
void SetString (const StringAttrId &colAttrId, IndexT rowIndex, const Util::String &val)
 set string value
const Util::StringGetString (const StringAttrId &colAttrId, IndexT rowIndex) const
 get string value
void SetVec4 (const Vec4AttrId &colAttrId, IndexT rowIndex, const Math::vec4 &val)
 set float4 value
Math::vec4 GetVec4 (const Vec4AttrId &colAttrId, IndexT rowIndex) const
 get float4 value
void SetMat4 (const Mat4AttrId &colAttrId, IndexT rowIndex, const Math::mat4 &val)
 set mat4 value
Math::mat4 GetMat4 (const Mat4AttrId &colAttrId, IndexT rowIndex) const
 get mat4 value
void SetGuid (const GuidAttrId &colAttrId, IndexT rowIndex, const Util::Guid &guid)
 set guid value
const Util::GuidGetGuid (const GuidAttrId &colAttrId, IndexT rowIndex) const
 get guid value
void SetBlob (const BlobAttrId &colAttrId, IndexT rowIndex, const Util::Blob &blob)
 set blob value
const Util::BlobGetBlob (const BlobAttrId &colAttrId, IndexT rowIndex) const
 get blob value
void SetVariant (IndexT colIndex, IndexT rowIndex, const Util::Variant &val)
 set variant value
void SetBool (IndexT colIndex, IndexT rowIndex, bool val)
 set bool value by column index
bool GetBool (IndexT colIndex, IndexT rowIndex) const
 get bool value by column index
void SetFloat (IndexT colIndex, IndexT rowIndex, float val)
 set float value by column index
float GetFloat (IndexT colIndex, IndexT rowIndex) const
 get float value by column index
void SetInt (IndexT colIndex, IndexT rowIndex, int val)
 set int value by column index
int GetInt (IndexT colIndex, IndexT rowIndex) const
 get int value by column index
void SetUInt (IndexT colIndex, IndexT rowIndex, uint val)
 set uint value by column index
uint GetUInt (IndexT colIndex, IndexT rowIndex) const
 get uint value by column index
void SetString (IndexT colIndex, IndexT rowIndex, const Util::String &val)
 set string value by column index
const Util::StringGetString (IndexT colIndex, IndexT rowIndex) const
 get string value by column index
void SetVec4 (IndexT colIndex, IndexT rowIndex, const Math::vec4 &val)
 set float4 value by column index
Math::vec4 GetVec4 (IndexT colIndex, IndexT rowIndex) const
 get float4 value by column index
void SetMat4 (IndexT colIndex, IndexT rowIndex, const Math::mat4 &val)
 set mat4 value by column index
Math::mat4 GetMat4 (IndexT colIndex, IndexT rowIndex) const
 get mat4 value by column index
void SetGuid (IndexT colIndex, IndexT rowIndex, const Util::Guid &guid)
 set guid value by column index
const Util::GuidGetGuid (IndexT colIndex, IndexT rowIndex) const
 get guid value by column index
void SetBlob (IndexT colIndex, IndexT rowIndex, const Util::Blob &blob)
 set blob value by column index
const Util::BlobGetBlob (IndexT colIndex, IndexT rowIndex) const
 get blob value by column index
bool LoadXmlTable (const Util::String &fileName)
 load xml table
Public Member Functions inherited from Core::RefCounted
 RefCounted ()
 constructor
int GetRefCount () const
 get the current refcount
void AddRef ()
 increment refcount by one
void Release ()
 decrement refcount and destroy object if refcount is zero
bool IsInstanceOf (const Rtti &rtti) const
 return true if this object is instance of given class
bool IsInstanceOf (const Util::String &className) const
 return true if this object is instance of given class by string
bool IsInstanceOf (const Util::FourCC &classFourCC) const
 return true if this object is instance of given class by fourcc
bool IsA (const Rtti &rtti) const
 return true if this object is instance of given class, or a derived class
bool IsA (const Util::String &rttiName) const
 return true if this object is instance of given class, or a derived class, by string
bool IsA (const Util::FourCC &rttiFourCC) const
 return true if this object is instance of given class, or a derived class, by fourcc
const Util::StringGetClassName () const
 get the class name
Util::FourCC GetClassFourCC () const
 get the class FourCC code

Private Member Functions

 __DeclareClass (ValueTable)

Additional Inherited Members

Static Public Member Functions inherited from Core::RefCounted
static void DumpRefCountingLeaks ()
 dump refcounting leaks, call at end of application (NEBULA_DEBUG builds only!)
Protected Member Functions inherited from Core::RefCounted
virtual ~RefCounted ()
 destructor (called when refcount reaches zero)

Constructor & Destructor Documentation

◆ ValueTable()

Db::ValueTable::ValueTable ( )

constructor

◆ ~ValueTable()

Db::ValueTable::~ValueTable ( )
virtual

destructor

Member Function Documentation

◆ __DeclareClass()

Db::ValueTable::__DeclareClass ( ValueTable )
private

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