Compound Operations
Compound operations are composed of sub-operations that together form a logical processing unit. An example of such an operation is PiiVisualSomClassifier that combines a PiiSomOperation and a PiiVisualTrainer to a visually trainable SOM classifier. Compound operations are derived from PiiOperationCompound, and PiiEngine is in fact just a compound operation.
Inputs and Outputs
The input and output sockets in a compound can be either aliased or proxied. An alias is more efficient as it just reveals a socket that is actually in one of the sub-operations. If you delete either the sub-operation or the socket, the alias disappears.
Using a proxy (PiiSocketProxy) has the advantage that it won't disappear unless explicitly told so. An alias will be destroyed if the operation containing the aliased socket is destroyed. This will obviously break all connections to the socket. Furthermore, a proxy input can be connected to many input sockets within the compound. This is not possible with an alias. The downside is that passing objects through a proxy is slightly slower than through an alias.
Accessing Components within a Compound
All operations added as childs to a compound with the addOperation() function will be placed under the
compound in QObject's object hierachy. That is, the parent()
function of the child operation will return a pointer to the
compound. Therefore, QObject::findChild() can be used to find child
operations by name. All direct child operations can be retrieved
with PiiOperationCompound::childOperations(). In
documentation, child operations are listed by their
objectName under a section titled "Children".
It is a common task to assign properties to the child operations of
a compound. To help this, the non-virtual member function
QObject::setProperty() is overridden by PiiOperation::setProperty(). The property() function
is treated similarly. Although this breaks C++ conventions, it
makes it easy to set properties to child objects. Assuming a
compound has a child operation with an object name "foo" that has a
property called "bar" one can access the property directly through
the compound by calling
compound->property("foo.bar"). The nesting can, of
course, be deeper if needed. "foo.baz.bar" is a valid property name
if "foo" is a compound that contains "baz". Care must however be
taken that the operations are accessed through PiiOperation pointers, not
QObject
pointers. The same approach is used when accessing sockets within
the compound. See PiiOperationCompound
for examples.
Serializing a Compound
PENDING
Compound Example
PENDING
Add a note
Not a single note added yet. Be the first, add yours.