Share

AlModelTool

Base class for all model tools.

Synopsis

This is a base class for data model algorithms tools. It is intended for supporting a uniform interface to data model tools.

#include <AlModelTool.h>

Description

The input data is passed in using setNodes() function, the output data is retrieved with getResult(). The reset function is clearing both inputs and outputs, so the tool is ready for reuse. Multiple tools can be chained and executed in sequence by passing the result of one tool to the nodes of the next.

Example:

     AlModelTool* firstTool = createFirstTool();
     firstTool->setNodes( nodes );
     firstTool->execute();

     AlModelTool* nextTool = createNextTool();
     nextTool->setNodes( firstTool->getResult() );
     nextTool->execute();


#ifndef _AlModelTool
#define _AlModelTool

#include <AlStudioAPIDecl.h>
#include <AlLinkListT.h>
#include <statusCodes.h>

class AlDagNode;

class STUDIOAPI_DECL AlModelTool
{
public:
    using AlDagNodeList = AlListT<AlDagNode>;

    AlModelTool();
    virtual ~AlModelTool();

    statusCode setNodes( const AlDagNodeList& list );
    const AlDagNodeList& getNodes() const;
    statusCode addNode( AlDagNode* dagNode );
    const AlDagNodeList& getResult() const;
    statusCode reset();
    virtual statusCode execute() = 0;

protected:
    AlDagNodeList& result();

private:
    struct Impl;
    Impl* m_impl;
};
#endif

Was this information helpful?