QDaq
0.2.6
Qt-based Data Aqcuisition
|
Base class of all QDaq objects. More...
#include <QDaqObject.h>
Public Slots | |
QString | errorBacktrace (int maxItems=10) const |
Print a backtrace of recent errors in this QDaqObject. | |
QString | path () const |
Return the object's path in the QDaq tree. More... | |
QString | objectTree () const |
Output in a string the object hierarchy beneath this object. | |
QString | listProperties () const |
List the objects properties. | |
QString | listFunctions () const |
List the objects scriptable functions. | |
DOM Level 1 Node interface | |
This group of QDaqObject slots implement the Node interface of DOM API Level 1. The functions are slots, thus available in script code. | |
QDaqObject * | parent () const |
QDaqObjectList | children () const |
Return a list of children of this object. | |
bool | hasChildren () const |
Returns true if the object has children. | |
QDaqObject * | appendChild (QDaqObject *obj) |
Adds a new child QDaqObject, as the last child and returns a pointer to it. | |
QDaqObject * | insertBefore (QDaqObject *newobj, QDaqObject *existingobj) |
Adds a new child QDaqObject, before an existing child and returns a pointer to it. | |
QDaqObject * | clone () |
Clone a QDaqObject with its child objects. | |
QDaqObject * | removeChild (QDaqObject *obj) |
Remove a child and return a pointer to it. | |
QDaqObject * | replaceChild (QDaqObject *newobj, QDaqObject *oldobj) |
Replace a child and return a pointer to the old child. | |
QDaqObject * | findChild (const QString &name) const |
Find the first child QDaqObject with objectName equal to name. | |
Signals | |
void | propertiesChanged () |
Fired when object properties have changed. | |
void | updateWidgets () |
Fired when widgets need update. | |
Public Member Functions | |
Q_INVOKABLE | QDaqObject (const QString &name) |
Construct a QDaqObject with a name. More... | |
virtual void | attach () |
Attach this QDaqObject to the QDaq tree. More... | |
virtual void | detach () |
Detach this QDaqObject from the QDaq tree. More... | |
bool | isAttached () const |
Returns true is this object is attached to the QDaq tree. | |
Static Public Member Functions | |
static QDaqRoot * | root () |
Obtain a pointer to the one-and-only QDaqRoot object. | |
static QDaqObject * | fromPath (const QString &path) |
Return a pointer to an object given its full path in the QDaq tree. More... | |
Public Attributes | |
QMutex | comm_lock |
A recursive mutex for synching thread access to this object. | |
Protected Member Functions | |
void | pushError (const QString &type, const QString &descr=QString()) const |
Push an error in the error queue. | |
void | throwScriptError (const QString &msg) const |
Throw a script error with message msg. | |
bool | checkName (const QString &name) const |
Check if name is a legal name for an QDaqObject. More... | |
virtual void | writeh5 (H5::Group *g, QDaqH5File *f) const |
Write contents of the object to a H5 group. More... | |
virtual void | readh5 (H5::Group *g, QDaqH5File *f) |
Read contents of the object from a H5 group. More... | |
Base class of all QDaq objects.
QDaqObject is derived from QObject and thus inherits all the Qt machinery, i.e., properties, meta-objects, signals & slots, etc.
QDaq objects are organized in a tree-like structure like QObjects. However, the children of a QDaqObject are ordered ,whereas those of a QObject are not. The ordering is necessary for QDaq because QDaq objects take part in loops where the order of execution is essential.
To create the QDaq object tree structure, the QDaqObject class offers an interface similar to the Node interface of Document Object Model (DOM) Level 1. The interface is defined by this group of functions.
Initially a QDaqObject is created without a parent and only its name needs to be specified. The object can than be incorporated into the QDaq hierarchy by one of the DOM API functions.
There is a static single root object at the top of the tree structure. The root object is accesible by QDaqObject::root() and it of type QDaqRoot.
Descendants of QDaqObject can be serialized to HDF5 files. A QDaq object with its children can be written/read by means of h5write() and h5read(), respectively.
HDF5 serialization is done according to the following rules:
Definition at line 108 of file QDaqObject.h.
|
explicit |
Construct a QDaqObject with a name.
The name is actually the objectName property of the QObject super-class.
Definition at line 25 of file QDaqObject.cpp.
|
virtual |
Attach this QDaqObject to the QDaq tree.
This function is called when the object becomes part of the QDaq tree.
In the base class implementation this function signals the root object that a new QDaqObject has been inserted in the tree and then calls attach() for each child QDaqObject.
Subclasses may reimplement this function to perform specific initialization.
Reimplemented in QDaqJob.
Definition at line 45 of file QDaqObject.cpp.
|
protected |
Check if name is a legal name for an QDaqObject.
Names should start with a letter and contain letters, numbers or the underscore _. This function also checks if there are any sibbling objects with the same name.
Definition at line 111 of file QDaqObject.cpp.
|
virtual |
Detach this QDaqObject from the QDaq tree.
This function is called just before the object becomes detached from the QDaq tree.
In the base class implementation it first calls detach() for each child QDaqObject and then signal root that the object is removed from the qdaq tree.
Subclasses may reimplement this function to perform needed actions before detaching.
Reimplemented in QDaqJob, QDaqChannel, QDaqDevice, and QDaqInterface.
Definition at line 52 of file QDaqObject.cpp.
|
static |
Return a pointer to an object given its full path in the QDaq tree.
If the specified path is invalid the function returns a null pointer.
Definition at line 179 of file QDaqObject.cpp.
|
inlineslot |
Return the object's parent or null if the object does not have a parent.
Definition at line 256 of file QDaqObject.h.
|
slot |
Return the object's path in the QDaq tree.
Example: qdaq.x.y.z.obj1 If the object is not attached to the tree, the function returns the name of the object.
Definition at line 166 of file QDaqObject.cpp.
|
protectedvirtual |
Read contents of the object from a H5 group.
The base class implementation reads all properties (static & dynamic) from corresponding datasets of the HDF5 file group.
Reimplement in QDaqObject descendants to read additional data.
g | HDF5 Group object |
Reimplemented in QDaqDataBuffer.
Definition at line 17 of file QDaqH5Serialize.cpp.
|
protectedvirtual |
Write contents of the object to a H5 group.
The base class implementation writes all properties (static & dynamic) as datasets of the HDF5 file group.
Reimplement in QDaqObject descendants to write additional data.
g | HDF5 Group object |
Reimplemented in QDaqDataBuffer.
Definition at line 12 of file QDaqH5Serialize.cpp.