QDaq  0.2.6
Qt-based Data Aqcuisition
 All Classes Functions Variables Typedefs Enumerations Enumerator Properties Groups Pages
Public Slots | Signals | Public Member Functions | Static Public Member Functions | Public Attributes | Protected Member Functions | List of all members
QDaqObject Class Reference

Base class of all QDaq objects. More...

#include <QDaqObject.h>

Inheritance diagram for QDaqObject:
Inheritance graph
[legend]
Collaboration diagram for QDaqObject:
Collaboration graph
[legend]

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.

QDaqObjectparent () const
 
QDaqObjectList children () const
 Return a list of children of this object.
 
bool hasChildren () const
 Returns true if the object has children.
 
QDaqObjectappendChild (QDaqObject *obj)
 Adds a new child QDaqObject, as the last child and returns a pointer to it.
 
QDaqObjectinsertBefore (QDaqObject *newobj, QDaqObject *existingobj)
 Adds a new child QDaqObject, before an existing child and returns a pointer to it.
 
QDaqObjectclone ()
 Clone a QDaqObject with its child objects.
 
QDaqObjectremoveChild (QDaqObject *obj)
 Remove a child and return a pointer to it.
 
QDaqObjectreplaceChild (QDaqObject *newobj, QDaqObject *oldobj)
 Replace a child and return a pointer to the old child.
 
QDaqObjectfindChild (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 QDaqRootroot ()
 Obtain a pointer to the one-and-only QDaqRoot object.
 
static QDaqObjectfromPath (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...
 

Detailed Description

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.

Constructor & Destructor Documentation

QDaqObject::QDaqObject ( const QString &  name)
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.

Member Function Documentation

void QDaqObject::attach ( )
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.

bool QDaqObject::checkName ( const QString &  name) const
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.

void QDaqObject::detach ( )
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.

QDaqObject * QDaqObject::fromPath ( const QString &  path)
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.

QDaqObject* QDaqObject::parent ( ) const
inlineslot

Return the object's parent or null if the object does not have a parent.

Definition at line 256 of file QDaqObject.h.

QString QDaqObject::path ( ) const
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.

void QDaqObject::readh5 ( H5::Group *  g,
QDaqH5File *  f 
)
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.

Parameters
gHDF5 Group object

Reimplemented in QDaqDataBuffer.

Definition at line 17 of file QDaqH5Serialize.cpp.

void QDaqObject::writeh5 ( H5::Group *  g,
QDaqH5File *  f 
) const
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.

Parameters
gHDF5 Group object

Reimplemented in QDaqDataBuffer.

Definition at line 12 of file QDaqH5Serialize.cpp.


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