Modeler Extensions Framework
DataHelper Class Reference

Data Structures

class  DataHelperException
 

Public Member Functions

 DataHelper (CLEMEXTIterator *iter, bool passThrough=true)
 
 ~DataHelper ()
 
void clear ()
 
bool nextRecord ()
 
bool rewind ()
 
template<class T >
void getInputValue (size_t index, T &val, bool &isNull)
 
void getInputStringValue (size_t index, const char *&val, bool &isNull)
 
template<class T >
void setOutputValue (size_t index, const T &val, bool isNull)
 
void setOutputStringValue (size_t index, const char *val, bool isNull)
 
CLEMEXTStatus getRecordValue (size_t index, void **value, size_t *value_len, CLEMEXTErrorCode *errorCode)
 
int getNumberRecordsRetrieved ()
 

Detailed Description

helper to assist with extracting data from the CLEMEXT C-API input iterator

can also be used to return output data in situations where the CLEMEXT module adds column values to each input row

Definition at line 158 of file DataHelper.h.

Constructor & Destructor Documentation

DataHelper ( CLEMEXTIterator *  iter,
bool  passThrough = true 
)

construct - possibly based on an underlying CLEMEXT C-API iterator object

Parameters
iterthe input iterator that can provide input values (can be NULL)
passThroughoverride the default behaviour enabling output values to be collected from the input iterator unless explicitly set
~DataHelper ( )

destroy the helper - the underlying CLEMEXT C-API CLEMEXTIterator object is deleted

Member Function Documentation

void clear ( )

clear values in the current data record

void getInputStringValue ( size_t  index,
const char *&  val,
bool &  isNull 
)

return values from the input data of string types

Parameters
indexthe position of the field to query
valreference to a pointer to return the result
isNulltrue iff the value of the field is NULL
void getInputValue ( size_t  index,
T &  val,
bool &  isNull 
)
inline

return values from the input data of integer and real types

Parameters
indexthe position of the field to query
valreference to a value to return the result
isNulltrue iff the value of the field is NULL

Definition at line 243 of file DataHelper.h.

References CLEMEXT_OK.

int getNumberRecordsRetrieved ( )
inline

Get the number of records retrieved so far on this pass

Returns
number of records

Definition at line 312 of file DataHelper.h.

CLEMEXTStatus getRecordValue ( size_t  index,
void **  value,
size_t *  value_len,
CLEMEXTErrorCode errorCode 
)

implement the CLEMEXT C-API function for retrieving an output value

Parameters
indexthe index position of the output field
valueaddress of a pointer to return the output value (or NULL)
value_lenthe size of the memory area returned by the pointer
errorCodethe detailed error code

if a value has been explicitly set for the requested field, this value is returned otherwise, if passThrough=true, an attempt is made to fetch data from the input otherwise a DataHelperException is thrown

Returns
CLEMEXT_OK if value is returned, a DataHelperException is thrown otherwise
bool nextRecord ( )

are there further input records?

Returns
true iff further input records exist
bool rewind ( )

get the status and error code from the last call to nextRecord() rewind the iterator to start again

Returns
true if completed successfully, false otherwise
void setOutputStringValue ( size_t  index,
const char *  val,
bool  isNull 
)

set an output value of a string field

Parameters
indexthe position of the field to set
valthe value to set
isNulltrue iff the value of the field is NULL
void setOutputValue ( size_t  index,
const T &  val,
bool  isNull 
)
inline

set an output value of an integer or real field

Parameters
indexthe position of the field to set
valthe value to set
isNulltrue iff the value of the field is NULL

Definition at line 275 of file DataHelper.h.

References DataRecord::values_.


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