EvEmu  0.8.4
11 September 2021
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
CIndexedRowSet Class Reference

Python object "dbutil.CIndexedRowset". More...

#include "PyDatabase.h"

Inheritance diagram for CIndexedRowSet:
Collaboration diagram for CIndexedRowSet:

Public Member Functions

 CIndexedRowSet (DBRowDescriptor **rowDesc)
 
size_t GetRowCount () const
 
PyPackedRow * GetRow (PyRep *index) const
 
PyPackedRow * NewRow (PyRep *key)
 
- Public Member Functions inherited from PyObjectEx_Type2
 PyObjectEx_Type2 (PyTuple *args, PyDict *keywords, bool enclosed=false)
 
 PyObjectEx_Type2 (PyToken *args, PyDict *keywords, bool enclosed=false)
 
PyTuple * GetArgs () const
 
PyDict * GetKeywords () const
 
PyRep * FindKeyword (const char *keyword) const
 
- Public Member Functions inherited from PyObjectEx
 PyObjectEx (bool is_type_2, PyRep *header)
 
 PyObjectEx (const PyObjectEx &oth)
 
 PyObjectEx (PyObjectEx &&oth)=delete
 
PyObjectEx & operator= (const PyObjectEx &oth)
 
PyObjectEx & operator= (PyObjectEx &&oth)=delete
 
PyRep * Clone () const
 Clones object. More...
 
bool visit (PyVisitor &v) const
 Visits object. More...
 
PyRep * header () const
 
bool isType2 () const
 
list_type & list ()
 
const list_type & list () const
 
dict_type & dict ()
 
const dict_type & dict () const
 
- Public Member Functions inherited from PyRep
PyType GetType () const
 
bool IsInt () const
 
bool IsLong () const
 
bool IsFloat () const
 
bool IsBool () const
 
bool IsBuffer () const
 
bool IsString () const
 
bool IsWString () const
 
bool IsToken () const
 
bool IsTuple () const
 
bool IsList () const
 
bool IsDict () const
 
bool IsNone () const
 
bool IsSubStruct () const
 
bool IsSubStream () const
 
bool IsChecksumedStream () const
 
bool IsObject () const
 
bool IsObjectEx () const
 
bool IsPackedRow () const
 
const char * TypeString () const
 
PyInt * AsInt ()
 
const PyInt * AsInt () const
 
PyLong * AsLong ()
 
const PyLong * AsLong () const
 
PyFloat * AsFloat ()
 
const PyFloat * AsFloat () const
 
PyBool * AsBool ()
 
const PyBool * AsBool () const
 
PyBuffer * AsBuffer ()
 
const PyBuffer * AsBuffer () const
 
PyString * AsString ()
 
const PyString * AsString () const
 
PyWString * AsWString ()
 
const PyWString * AsWString () const
 
PyToken * AsToken ()
 
const PyToken * AsToken () const
 
PyTuple * AsTuple ()
 
const PyTuple * AsTuple () const
 
PyList * AsList ()
 
const PyList * AsList () const
 
PyDict * AsDict ()
 
const PyDict * AsDict () const
 
PyNone * AsNone ()
 
const PyNone * AsNone () const
 
PySubStruct * AsSubStruct ()
 
const PySubStruct * AsSubStruct () const
 
PySubStream * AsSubStream ()
 
const PySubStream * AsSubStream () const
 
PyChecksumedStream * AsChecksumedStream ()
 
const PyChecksumedStream * AsChecksumedStream () const
 
PyObject * AsObject ()
 
const PyObject * AsObject () const
 
PyObjectEx * AsObjectEx ()
 
const PyObjectEx * AsObjectEx () const
 
PyPackedRow * AsPackedRow ()
 
const PyPackedRow * AsPackedRow () const
 
void Dump (FILE *into, const char *pfx) const
 Dumps object to file. More...
 
void Dump (LogType type, const char *pfx) const
 Dumps object to console. More...
 
virtual int32 hash () const
 virtual function to generate a hash value of a object. More...
 
- Public Member Functions inherited from RefObject
 RefObject (size_t initRefCount)
 Initializes reference count. More...
 
virtual ~RefObject ()
 Destructor; must be virtual. More...
 
size_t GetCount ()
 

Protected Member Functions

virtual ~CIndexedRowSet ()
 
DBRowDescriptor * _GetRowDesc () const
 
- Protected Member Functions inherited from PyObjectEx_Type2
virtual ~PyObjectEx_Type2 ()
 
- Protected Member Functions inherited from PyObjectEx
virtual ~PyObjectEx ()
 
- Protected Member Functions inherited from PyRep
 PyRep (PyType t)
 
 PyRep (const PyRep &oth)
 
 PyRep (PyRep &&oth)=delete
 
PyRep & operator= (const PyRep &oth)=default
 
PyRep & operator= (PyRep &&oth)=default
 
virtual ~PyRep ()
 
- Protected Member Functions inherited from RefObject
void IncRef () const
 Increments reference count of object by one. More...
 
void DecRef () const
 Decrements reference count of object by one. More...
 

Static Protected Member Functions

static PyTuple * _CreateArgs ()
 
static PyDict * _CreateKeywords (DBRowDescriptor *rowDesc)
 
- Static Protected Member Functions inherited from PyObjectEx_Type2
static PyTuple * _CreateHeader (PyTuple *args, PyDict *keywords, bool enclosed=false)
 
static PyTuple * _CreateHeader (PyToken *args, PyDict *keywords, bool enclosed=false)
 

Additional Inherited Members

- Public Types inherited from PyObjectEx
typedef PyList list_type
 
typedef list_type::iterator list_iterator
 
typedef list_type::const_iterator const_list_iterator
 
typedef PyDict dict_type
 
typedef dict_type::iterator dict_iterator
 
typedef dict_type::const_iterator const_dict_iterator
 
- Public Types inherited from PyRep
enum  PyType {
  PyTypeMin = 0, PyTypeInt = 1, PyTypeLong = 2, PyTypeFloat = 3,
  PyTypeBool = 4, PyTypeBuffer = 5, PyTypeString = 6, PyTypeWString = 7,
  PyTypeToken = 8, PyTypeTuple = 9, PyTypeList = 10, PyTypeDict = 11,
  PyTypeNone = 12, PyTypeSubStruct = 13, PyTypeSubStream = 14, PyTypeChecksumedStream = 15,
  PyTypeObject = 16, PyTypeObjectEx = 17, PyTypePackedRow = 18, PyTypeError = 19
}
 Python wire object types. More...
 
- Static Public Member Functions inherited from PyRep
static std::string StringContent (PyRep *pRep)
 
static int64 IntegerValue (PyRep *pRep)
 
static uint32 IntegerValueU32 (PyRep *pRep)
 
- Protected Attributes inherited from PyObjectEx
PyRep *const mHeader
 
const bool mIsType2
 
list_type *const mList
 
dict_type *const mDict
 
- Protected Attributes inherited from PyRep
const PyType mType
 
- Protected Attributes inherited from RefObject
size_t mRefCount
 Reference count of instance. More...
 
bool mDeleted
 

Detailed Description

Python object "dbutil.CIndexedRowset".

This object contains DBRowDescriptor header and bunch of PyPackedRows.

Note
At the moment it's designed that once it's created, its header cannot be changed. I don't know whether it's correct or not, but it makes our life easier.
Author
ozatomic

Definition at line 172 of file PyDatabase.h.

Constructor & Destructor Documentation

CIndexedRowSet::CIndexedRowSet ( DBRowDescriptor **  rowDesc)
Parameters
[in]rowDescDBRowDescriptor header to be used.

Definition at line 185 of file PyDatabase.cpp.

186 : PyObjectEx_Type2( _CreateArgs(), _CreateKeywords( *rowDesc ) )
187 {
188 
189 }
PyObjectEx_Type2(PyTuple *args, PyDict *keywords, bool enclosed=false)
Definition: PyRep.cpp:942
static PyTuple * _CreateArgs()
Definition: PyDatabase.cpp:208
static PyDict * _CreateKeywords(DBRowDescriptor *rowDesc)
Definition: PyDatabase.cpp:215
virtual CIndexedRowSet::~CIndexedRowSet ( )
inlineprotectedvirtual

Definition at line 199 of file PyDatabase.h.

199 { /* do we need to do anything here? */ }

Member Function Documentation

PyTuple * CIndexedRowSet::_CreateArgs ( )
staticprotected

Definition at line 208 of file PyDatabase.cpp.

References args, and PyTuple::SetItem().

209 {
210  PyTuple* args = new PyTuple( 1 );
211  args->SetItem( 0, new PyToken( "dbutil.CIndexedRowset" ) );
212  return args;
213 }
Python tuple.
Definition: PyRep.h:567
* args
void SetItem(size_t index, PyRep *object)
Stores Python object.
Definition: PyRep.h:610
Python token (eg. class name).
Definition: PyRep.h:522

Here is the call graph for this function:

PyDict * CIndexedRowSet::_CreateKeywords ( DBRowDescriptor *  rowDesc)
staticprotected

Definition at line 215 of file PyDatabase.cpp.

References DBRowDescriptor::GetColumnName(), and PyDict::SetItemString().

216 {
217  assert( rowDesc );
218 
219  PyDict* keywords = new PyDict();
220  keywords->SetItemString( "header", rowDesc );
221  keywords->SetItemString( "columnName", rowDesc->GetColumnName(0) );
222 
223  return keywords;
224 }
Python's dictionary.
Definition: PyRep.h:719
PyString * GetColumnName(uint32 index) const
Definition: PyDatabase.cpp:65
void SetItemString(const char *key, PyRep *value)
SetItemString adds or sets a database entry.
Definition: PyRep.h:812

Here is the call graph for this function:

DBRowDescriptor * CIndexedRowSet::_GetRowDesc ( ) const
protected

Definition at line 200 of file PyDatabase.cpp.

References PyRep::AsObjectEx(), and PyObjectEx_Type2::FindKeyword().

Referenced by NewRow().

201 {
202  PyRep* r(FindKeyword( "header" ));
203  if (r != nullptr)
204  return (DBRowDescriptor*)r->AsObjectEx();
205  return nullptr;
206 }
Base Python wire object.
Definition: PyRep.h:66
PyRep * FindKeyword(const char *keyword) const
Definition: PyRep.cpp:959
Python object "blue.DBRowDescriptor".
Definition: PyDatabase.h:41

Here is the call graph for this function:

Here is the caller graph for this function:

PyPackedRow* CIndexedRowSet::GetRow ( PyRep *  index) const
inline
Parameters
[in]Indexof row to be returned.
Returns
Row with given index.

Definition at line 191 of file PyDatabase.h.

References PyRep::AsPackedRow(), PyObjectEx::dict(), and PyDict::GetItem().

191 { return dict().GetItem( index )->AsPackedRow(); }
PyRep * GetItem(PyRep *key) const
Obtains a database entry based on given key object.
Definition: PyRep.cpp:691
PyPackedRow * AsPackedRow()
Definition: PyRep.h:156
dict_type & dict()
Definition: PyRep.h:892

Here is the call graph for this function:

size_t CIndexedRowSet::GetRowCount ( ) const
inline
Returns
Row count.

Definition at line 184 of file PyDatabase.h.

References PyObjectEx::list(), and PyList::size().

184 { return list().size(); }
list_type & list()
Definition: PyRep.h:889
size_t size() const
Definition: PyRep.h:663

Here is the call graph for this function:

PyPackedRow * CIndexedRowSet::NewRow ( PyRep *  key)
Returns
New row which user may fill.

Definition at line 191 of file PyDatabase.cpp.

References _GetRowDesc(), PyObjectEx::dict(), and PyDict::SetItem().

Referenced by DBResultToCIndexedRowset().

192 {
193  //DBRowDescriptor* rowDesc = _GetRowDesc();
194  PyPackedRow* row = new PyPackedRow( _GetRowDesc() );
195 
196  dict().SetItem( key , row );
197  return row;
198 }
DBRowDescriptor * _GetRowDesc() const
Definition: PyDatabase.cpp:200
dict_type & dict()
Definition: PyRep.h:892
Packed row.
Definition: PyRep.h:961
void SetItem(PyRep *key, PyRep *value)
SetItem adds or sets a database entry.
Definition: PyRep.cpp:713

Here is the call graph for this function:

Here is the caller graph for this function:


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