itom  4.1.0
ito::AlgoInterfaceValidator Class Reference

The class AlgoInterfaceValidator provides validators and checks in order to verify that a certain filter or algoWidget that pretends to implement a certain interface really fits to the requirements and conditions of this interface. More...

Inheritance diagram for ito::AlgoInterfaceValidator:

Public Member Functions

 AlgoInterfaceValidator (ito::RetVal &retValue)
 constructor More...
 
 ~AlgoInterfaceValidator ()
 destructor
 
ito::RetVal addInterface (ito::AddInAlgo::tAlgoInterface iface, QVector< ito::Param > &mandParams, QVector< ito::Param > &outParams, int maxNumMand, int maxNumOpt, int maxNumOut)
 addInterface More...
 
bool isValidFilter (const ito::AddInAlgo::FilterDef &filter, ito::RetVal &ret, QStringList &tags) const
 verifies a given filter with respect to its indicated interface More...
 
bool isValidWidget (const ito::AddInAlgo::AlgoWidgetDef &widget, ito::RetVal &ret, QStringList &tags) const
 verifies a given algo-widget with respect to its indicated interface More...
 
ito::RetVal getInterfaceParameters (ito::AddInAlgo::tAlgoInterface iface, QVector< ito::ParamBase > &mandParams, QVector< ito::ParamBase > &outParams) const
 

Protected Member Functions

ito::RetVal init (void)
 loads the requirements for every interface defined in the enumeration AddInAlgo::tAlgoInterface More...
 
bool isValid (const ito::AddInAlgo::tAlgoInterface iface, const ito::AddInAlgo::t_filterParam filterParamFunc, ito::RetVal &ret) const
 
bool getTags (const ito::AddInAlgo::tAlgoInterface iface, const QString &metaInformation, QStringList &tags) const
 verifies and parses the meta information string of any filter or algoWidget More...
 

Private Member Functions

 Q_DECLARE_PRIVATE (AlgoInterfaceValidator)
 

self-managed pointer to the private class container (deletes itself if d_ptr is destroyed)


 

Private Attributes

QScopedPointer< AlgoInterfaceValidatorPrivated_ptr
 

Detailed Description

The class AlgoInterfaceValidator provides validators and checks in order to verify that a certain filter or algoWidget that pretends to implement a certain interface really fits to the requirements and conditions of this interface.

In the current implementation this class is instantiated once by the class AddInManager, hence, it can be considered as singleton class.

See also
AddInManager, AddInAlgo::tAlgoInterface, AddInAlgo::FilterDef, AddInAlgo::AlgoWidgetDef

Constructor & Destructor Documentation

ito::AlgoInterfaceValidator::AlgoInterfaceValidator ( ito::RetVal retValue)

constructor

Calls method init in order to load the requirements and conditions for each interface, defined in the enumeration tAlgoInterface

See also
AddInAlgo::tAlgoInterface

Member Function Documentation

ito::RetVal ito::AlgoInterfaceValidator::addInterface ( ito::AddInAlgo::tAlgoInterface  iface,
QVector< ito::Param > &  mandParams,
QVector< ito::Param > &  outParams,
int  maxNumMand,
int  maxNumOpt,
int  maxNumOut 
)

addInterface

Registers the requirements for any interface given by the enumeration value AddInAlgo::tAlgoInterface.

Parameters
[in]ifaceis the interface enumeration value whose requirements should be registered
[in]mandParamsis a vector indicating the first m mandatory parameters every filter that implements this interface must provide, too.
[in]outParamsis a vector indicating the fist n output parameters every filter that implements this interface must provide, too. Remember that every parameter in this vector must have the Out-flag set and no In-flag.
[in]maxNumMandis the maximum number of mandatory parameters
[in]maxNumOptis the maximum number of optional parameters
[in]maxNumOutis the maximum number of output parameters
See also
AddInAlgo::tAlgoInterface
bool ito::AlgoInterfaceValidator::getTags ( const ito::AddInAlgo::tAlgoInterface  iface,
const QString &  metaInformation,
QStringList &  tags 
) const
protected

verifies and parses the meta information string of any filter or algoWidget

Sometimes a certain algorithm interface needs that the user gives additional information about the filter when creating this filter in the plugin. This additional information can be given by the meta information string in the structs FilterDef and AlgoWidgetDef. In the filter or algoWidget pretends to fit to a certain algorithm interface, this method is called with the interface number and the meta information string. Then, this string is checked if it fits the requirements of the interface and if so it can be parsed. The parsed elements are then returned in form of a string list. The meaning and definition of the content of this string list must be interpreted by the method which wishes to use filters of a certain interface type.

Parameters
[in]ifaceis the interface number
[in]metaInformationis the meta information string connected to the filter in any plugin
[out]tagsis the parsed string list (or empty in case of an error)
Returns
true if the meta information string has been valid and could be parsed, else false
See also
AddInAlgo::tAlgoInterface
ito::RetVal ito::AlgoInterfaceValidator::init ( void  )
protected

loads the requirements for every interface defined in the enumeration AddInAlgo::tAlgoInterface

The requirements of every interface can be given by several things:

  • You can indicate the first n mandatory parameters. This is done by filling a vector of class ito::Param.
  • You can define the first m output parameters.
  • You can indicate a maximum number of mandatory, optional and output parameters. must be greater or equal than the previously indicated vectors.

If any mandatory, optional or output parameters are defined, the corresponding filter, that pretends to fit to this interface, must have a parameter at the same position whose type is equal to the given parameter and if the indicated parameter of the interface has any restricitions given in form of a meta information instance, the corresponding parameter of the filter must have a restriction which is equal or "stricter" than the restriction defined in this method.

For every interface defined in the enumeration AddInAlgo::tAlgoInterface, you should call the method addInInterface in this method in order to create the requirements. The last requirement of every interface is the possible structure or content of the meta information string, that can or sometimes must be appended when creating the FilterDef-instance in any plugin. This meta information string is checked and parsed in the method getTags.

See also
AddInAlgo::tAlgoInterface, ito::Param, addInterface, getTags
bool ito::AlgoInterfaceValidator::isValid ( const ito::AddInAlgo::tAlgoInterface  iface,
const ito::AddInAlgo::t_filterParam  filterParamFunc,
ito::RetVal ret 
) const
protected
Parameters
iface
filterParamFunc
ret
Returns
bool
See also
isValid, getTags
bool ito::AlgoInterfaceValidator::isValidFilter ( const ito::AddInAlgo::FilterDef filter,
ito::RetVal ret,
QStringList &  tags 
) const

verifies a given filter with respect to its indicated interface

If the given filter pretends to implement a certain interface, the parameters of the filter are checked with respect to the requirements of the interface and the additional meta information string is checked and parsed.

Parameters
[in]filteris the filter-definition struct of the filter to check
[in/out]ret is the result of the check
[out]tagsare an optional string list containing tags extracted from the meta information string
Returns
true if filter is valid with respect to the interface
See also
isValid, getTags
bool ito::AlgoInterfaceValidator::isValidWidget ( const ito::AddInAlgo::AlgoWidgetDef widget,
ito::RetVal ret,
QStringList &  tags 
) const

verifies a given algo-widget with respect to its indicated interface

If the given algo-widget pretends to implement a certain interface, the parameters of the algo-widget are checked with respect to the requirements of the interface and the additional meta information string is checked and parsed.

Parameters
[in]widgetis the algo-widget-definition struct of the algo-widget to check
[in/out]ret is the result of the check
[out]tagsare an optional string list containing tags extracted from the meta information string
Returns
true if the algo-widget is valid with respect to the interface
See also
isValid, getTags

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