#include <DtsObject.h>
Public Member Functions | |
DtsObject_ (DTS *dts, int size, int type) | |
void | init (int size, dts_typeid type) |
(Re-)initialize the object to the given size and type | |
DtsObject | make_writable () |
void | prime_all_fields () |
Instantiate all fields defined by the type of this object. | |
void | prime_field (dts_field_info *) |
Instantiate a specific field. | |
std::vector< DtsObject > | fieldcache () |
Get a copy of all instantiated fields. | |
int | write (struct pickle *pickle, int fd) |
void | send (dts_field_element fieldnum, dts_comparison *comparisons) |
void | send (DtsField &field, dts_comparison *comparisons) |
int | match (dts_comparison *comps) |
double | eval_arith_operand (struct dts_operand *op) |
Expr module uses this. | |
DTS * | getDts () const |
Pointer to the DTS used by this type. | |
std::string | getfieldname (dts_field_element f) |
Return field name. | |
Copy Constructors | |
DtsObject | dup () |
Return a new object with a copy of the data and a private field vector. | |
DtsObject | private_copy () |
Return a new object with shared data, but a private field vector. | |
Meta-data Methods | |
void | setsize (int size) |
int | getsize () const |
unsigned long | getid () const |
Return the unique numeric identifier of the object. | |
unsigned char * | getdata () const |
Return the raw data contents of the object. | |
std::string | pygetdata () const |
Return the raw data contents as a C++ string. | |
const char * | gettypename () const |
Return the type name of the object. | |
dts_typeid | gettype () const |
Return the type of the object. | |
void | settype (int type) |
Initializers | |
void | setdata (void *data) |
void | setdatacopy (const void *src) |
int | set_fromstring (const char *datastr) |
Field Access | |
DtsObject | getfield (DtsField &fieldv, bool nowarn=false) |
Return a field object. | |
DtsObject | getfield (const char *s, bool nowarn=false) |
Less efficient lookup by string. | |
void | attach_field (DtsField &field, DtsObject field_data) |
Attach an object as a field. | |
Friends | |
DtsObject | DTS::msg_check (DtsObject, dts_field_element) |
Reference Counting | |
Programmers should NOT use these methods directly | |
void | intrusive_ptr_add_ref (DtsObject_ *o) |
Used by DtsObject (boost::intrusive_ptr). | |
void | intrusive_ptr_release (DtsObject_ *o) |
Used by DtsObject (boost::intrusive_ptr). |
An object is read-only except for initializaton (when it is assumed to only have a single user and therefore not require locking). Only the field cache is locked for thread safety.
A DtsObject is mainly accessed by requesting one of its fields with the getfield() method. Most objects will have a "string" and/or "double" field for accessing string or double representations of the object (if applicable).
To access the raw contents of an object, use the getdata() and getsize() methods or the dts_data_as(object, type) macro which will cast the data to the given type.
All DtsObjects have an underlying type that defines 0 or more fields that can be extracted from that object. The gettype() method returns the dts_typeid. However, a DtsObject may have additional fields added to it at runtime with the attach_field() method. To get a list of all of the current fields, you can use the fieldcache() method. To ensure that the fieldcache contains all available fields for the underlying type, precede the fieldcache() call with a call to prime_all_fields()
DtsObject DtsObject_::dup | ( | ) |
Return a new object with a copy of the data and a private field vector.
Shallow copy. Preserve all attached fields.
The field vector is a copy of the original.
std::vector<DtsObject> DtsObject_::fieldcache | ( | ) | [inline] |
Get a copy of all instantiated fields.
You may want to use prime_all_fields() first.
DtsObject DtsObject_::private_copy | ( | ) |
Return a new object with shared data, but a private field vector.
Return a new DtsObject that shares the underlying data, but with its own fieldspace.
The field vector is a copy of the original.