![]() |
mksqlite
2.5
A MATLAB interface to SQLite
|
Encapsulating a MATLAB mxArray. More...
#include <value.hpp>
Public Types | |
enum | type_complexity_e { TC_EMPTY = 0, TC_SIMPLE, TC_SIMPLE_VECTOR, TC_SIMPLE_ARRAY, TC_COMPLEX, TC_UNSUPP = -1 } |
enum | { LOGICAL_CLASS = mxLOGICAL_CLASS, INT8_CLASS = mxINT8_CLASS, UINT8_CLASS = mxUINT8_CLASS, INT16_CLASS = mxINT16_CLASS, INT32_CLASS = mxINT32_CLASS, UINT16_CLASS = mxUINT16_CLASS, UINT32_CLASS = mxUINT32_CLASS, INT64_CLASS = mxINT64_CLASS, DOUBLE_CLASS = mxDOUBLE_CLASS, SINGLE_CLASS = mxSINGLE_CLASS, CHAR_CLASS = mxCHAR_CLASS } |
Public Member Functions | |
ValueMex () | |
Standard ctor. | |
ValueMex (const ValueMex &other) | |
Copy ctor for const objects. | |
ValueMex (ValueMex &other) | |
Move ctor for lvalues. | |
ValueMex (ValueMex &&other) | |
Move ctor for rvalues (temporary objects) | |
ValueMex & | operator= (const ValueMex &other) |
Assignment operator for const objects. | |
ValueMex & | operator= (ValueMex &other) |
Move assignment operator for lvalues. | |
ValueMex & | operator= (ValueMex &&other) |
Move assignment operator for rvalues (temporary objects) | |
ValueMex (const mxArray *pcItem) | |
Copy ctor for mxArrays. More... | |
ValueMex (mwIndex m, mwIndex n, int clsid=mxDOUBLE_CLASS) | |
Ctor allocating new MATLAB matrix object. More... | |
ValueMex & | Adopt (bool doAdopt=true) |
Take ownership (custody) of a MEX array. More... | |
void | Destroy () |
Dtor. More... | |
const mxArray * | Item () const |
Returns hosted MATLAB array. | |
mxArray * | Item () |
Returns hosted MATLAB array. | |
ValueMex | Duplicate () const |
Returns a duplictae of the hosted MATLAB array. | |
mxArray * | Detach () |
Detach hosted MATLAB array. | |
size_t | GetM () const |
Returns row count (1st dimension) | |
size_t | GetN () const |
Returns col count (2nd dimension) | |
bool | IsEmpty () const |
Returns true if item is NULL or empty ([]) | |
bool | IsCell () const |
Returns true if item is a cell array. | |
bool | IsComplex () const |
Returns true if item is not NULL and complex. | |
bool | IsScalar () const |
Returns true if item consists of exact 1 element. | |
bool | IsStruct () const |
Returns true if item is a struct array. | |
bool | IsVector () const |
Returns true if m_pcItem is of size 1xN or Mx1. | |
bool | IsDoubleClass () const |
Returns true if m_pcItem is of type mxDOUBLE_CLASS. | |
bool | IsFunctionHandle () const |
Returns true if m_pcItem is of type mxFUNCTION_CLASS. | |
size_t | NumElements () const |
Returns number of elements. | |
size_t | ByElement () const |
Returns size in bytes of one element. | |
int | NumDims () const |
Returns number of dimensions. | |
size_t | ByData () const |
Returns data size in bytes. | |
mxClassID | ClassID () const |
Returns item class ID or mxUNKNOWN_CLASS if item is NULL. | |
type_complexity_e | Complexity (bool bCanSerialize=false) const |
Get complexity information. Which storage level is necessary (scalar, vector, matrix, text, blob) More... | |
void * | Data () const |
Returns pointer to raw data. | |
char * | GetString (bool flagUTF=false, const char *format=NULL) const |
Convert a string to char, due flagUTF converted to utf8. More... | |
char * | GetEncString () const |
Returns allocated memory with items test, due to global flag converted to UTF. More... | |
int | GetInt (int errval=0) const |
Get integer value from item. More... | |
sqlite3_int64 | GetInt64 (int errval=0) const |
Get 64 bit integer value from item. More... | |
double | GetScalar () const |
const mxArray * | GetField (int n, const char *name) const |
Get field from a struct array. More... | |
void | SetCell (int i, const mxArray *cell) |
Sets a cell of a MATLAB cell array. More... | |
void | MakePersistent () |
Make the MATLAB array persistent. | |
void | Throw () |
Throws an exception if any occured. | |
void | Call (ValueMex *lhs, ValueMex *exception) |
Calling a MATLAB function (handle) with arguemnts. More... | |
![]() | |
~ValueBase () | |
Dtor. | |
Static Public Member Functions | |
static ValueMex | CreateCellMatrix (int m, int n) |
Create a cell array. More... | |
static ValueMex | CreateDoubleScalar (double value) |
Create a double scalar. More... | |
static ValueMex | CreateString (const char *str) |
Create a string. More... | |
Additional Inherited Members | |
![]() | |
bool | m_isConst |
if flagged as non-const, class may swap memory ownership (custody) | |
union { | |
double | m_float |
floating point representation | |
sqlite3_int64 | m_integer |
integer representation | |
char * | m_text |
text representation or allocated memory () | |
mxArray * | m_blob |
binary large object representation | |
mxArray * | m_pcItem |
MATLAB variable representation. | |
tagNativeArray * | m_array |
self allocated variable representation | |
long long | m_largest_field |
largest member used to copy entire union (dummy field) | |
}; | |
![]() | |
ValueBase () | |
Standard ctor. | |
ValueBase (const ValueBase &other) | |
Copy ctor for constant objects. | |
ValueBase (ValueBase &other) | |
Move ctor for lvalues. | |
ValueBase (ValueBase &&other) | |
Move ctor for rvalues (temporary objects) | |
ValueBase & | operator= (const ValueBase &other) |
Assignment operator. | |
ValueBase & | operator= (ValueBase &other) |
Move assignment operator for lvalues. | |
ValueBase & | operator= (ValueBase &&other) |
Move assignment operator for rvalues (temporary objects) | |
Encapsulating a MATLAB mxArray.
Class ValueMex never takes custody of a MATLAB memory object!
Even though there is a function Destroy() which frees the MATLAB object, this class has no destructor which automatically does.
It's intended that this class allocates and tends memory space through other functions than mxCreate*() functions, since these are quite slow. (see tagNativeArray)
If a dtor is declared, we have to fulfil the "rule of three"
Complexity information about a MATLAB variable. For testing if a variable is able to be packed or not.
|
inlineexplicit |
|
inline |
|
inline |
Take ownership (custody) of a MEX array.
doAdopt | true to adopt, false to make it const |
Definition at line 282 of file value.hpp.
Referenced by Call(), CreateCellMatrix(), CreateDoubleScalar(), CreateString(), and Duplicate().
|
inline |
Get complexity information. Which storage level is necessary (scalar, vector, matrix, text, blob)
[in] | bCanSerialize | true if serialization of item is enabled |
Definition at line 531 of file value.hpp.
Referenced by blob_pack(), and createValueSQLFromItem().
|
inlinestatic |
Create a cell array.
m | Number of rows |
n | Number of cols |
Definition at line 298 of file value.hpp.
References Adopt().
Referenced by MexFunctors::initGroupData(), and SQLiface::mexFcnWrapper().
|
inlinestatic |
|
inlinestatic |
|
inline |
Dtor.
If this class has its custody, memory is freed.
Definition at line 335 of file value.hpp.
Referenced by MexFunctors::initGroupData(), and MexFunctors::~MexFunctors().
|
inline |
Returns allocated memory with items test, due to global flag converted to UTF.
Definition at line 665 of file value.hpp.
References g_convertUTF8.
|
inline |
|
inline |
Get integer value from item.
errval | Value to return in case of non-convertible variable data type |
Definition at line 677 of file value.hpp.
Referenced by have_serialize().
|
inline |
|
inline |
|
inline |
Convert a string to char, due flagUTF converted to utf8.
[in] | flagUTF | if true, string will be converted to UTF8 |
[out] | format | optional format string (see fprintf()) |
Definition at line 584 of file value.hpp.
References getLocaleMsg(), MEM_ALLOC, and utils_destroy_array().
|
inline |