cc_tools_qt
Common Environment for Protocol Analysis.
Loading...
Searching...
No Matches
Public Types | Signals | Public Member Functions | Protected Slots | Protected Member Functions | List of all members
cc_tools_qt::ToolsPlugin Class Reference

#include "cc_tools_qt/ToolsPlugin.h"

Detailed Description

Interface class for plugin definition.

Inherits QObject.

Public Types

using ListOfGuiActions = QList< QAction * >
 List of GUI action buttons.
 
enum  Type : unsigned { Type_Socket , Type_Filter , Type_Protocol , Type_NumOfValues }
 Type of the plugin. More...
 

Signals

void sigInterPluginConfigReport (const QVariantMap &props)
 Signal reporting inter-plugin configuration request.
 

Public Member Functions

 ToolsPlugin (Type type)
 Constructor.
 
virtual ~ToolsPlugin () noexcept
 Destructor.
 
void applyInterPluginConfig (const QVariantMap &props)
 Apply inter-plugin configuration.
 
QWidget * createConfigurationWidget ()
 Create a widget to perform plugin configuration in GUI application.
 
ToolsFilterPtr createFilter ()
 Create filter.
 
ListOfGuiActions createGuiActions ()
 Create GUI actions relevant to the plugin.
 
ToolsProtocolPtr createProtocol ()
 Create protocol.
 
ToolsSocketPtr createSocket ()
 Create socket.
 
QVariantMap getCurrentConfig ()
 Get currentConfiguration.
 
void getCurrentConfig (QVariantMap &config)
 Get current configuration.
 
void reconfigure (const QVariantMap &config)
 Request to perform reconfigure.
 
void setDebugOutputLevel (unsigned level=0U)
 Set debug output level.
 

Protected Slots

void reportInterPluginConfig (const QVariantMap &props)
 Report inter-plugin configuration.
 

Protected Member Functions

virtual void applyInterPluginConfigImpl (const QVariantMap &props)
 Polymorphic inter-plugin configuration application.
 
virtual QWidget * createConfigurationWidgetImpl ()
 Create configuration widget.
 
virtual ToolsFilterPtr createFilterImpl ()
 Create filter object.
 
virtual ListOfGuiActions createGuiActionsImpl ()
 Create GUI actions.
 
virtual ToolsProtocolPtr createProtocolImpl ()
 Create protocol object.
 
virtual ToolsSocketPtr createSocketImpl ()
 Create socket object.
 
virtual void getCurrentConfigImpl (QVariantMap &config)
 Polymorphic call to retrieve current configuration.
 
virtual void reconfigureImpl (const QVariantMap &config)
 Polymorphic call to perform plugin (re)configuration.
 

Member Enumeration Documentation

◆ Type

Type of the plugin.

Enumerator
Type_Socket 

Socket.

Type_Filter 

Filter.

Type_Protocol 

Protocol.

Type_NumOfValues 

Upper limit to enum values.

Member Function Documentation

◆ applyInterPluginConfig()

void cc_tools_qt::ToolsPlugin::applyInterPluginConfig ( const QVariantMap &  props)

Apply inter-plugin configuration.

Allows one plugin to influence the configuration of another. This function will be called for all currently chosen plugins to override current configuration. Invokes polymorphic applyInterPluginConfigImpl().

Parameters
[in]propsProperties map.

◆ applyInterPluginConfigImpl()

void cc_tools_qt::ToolsPlugin::applyInterPluginConfigImpl ( const QVariantMap &  props)
protectedvirtual

Polymorphic inter-plugin configuration application.

Invoked by the applyInterPluginConfig().

Parameters
[in]propsProperties map.

◆ createConfigurationWidget()

QWidget * cc_tools_qt::ToolsPlugin::createConfigurationWidget ( )

Create a widget to perform plugin configuration in GUI application.

Sometimes there is a need to provide a way to configure the plugin. A GUI application will call this function to retrieve a widget which will control the configuration. The returned widged is expected to be dynamically allocated and will be owned by the GUI application, i.e. the plugin doesn't need to perform any delete operation on it.
The function will invoke createConfigurationWidgetImpl().

Returns
Dynamically allocated widget object

◆ createConfigurationWidgetImpl()

QWidget * cc_tools_qt::ToolsPlugin::createConfigurationWidgetImpl ( )
protectedvirtual

Create configuration widget.

Returns
If not overriden returns nullptr.

◆ createFilter()

ToolsFilterPtr cc_tools_qt::ToolsPlugin::createFilter ( )

Create filter.

This function will be called if it is filter plugin. It will invoke createFilterImpl() if assigned type is Type_Filter.

Returns
Allocated filter object

◆ createFilterImpl()

ToolsFilterPtr cc_tools_qt::ToolsPlugin::createFilterImpl ( )
protectedvirtual

Create filter object.

Expected to be overriden by the derived class.

Returns
By default returns empty pointer.

◆ createGuiActions()

ToolsPlugin::ListOfGuiActions cc_tools_qt::ToolsPlugin::createGuiActions ( )

Create GUI actions relevant to the plugin.

This function will invoke the relevant callback function assigned by the derived class to pluginProperties(). The callback function is responsible to allocate and return a list of QAction objects, which will appear to the main toolbar of the GUI application. Note, that the main application will own the allocated QAction objects and will delete them later. The plugin doesn't need to do it explicityly.
The function will invoke createGuiActionsImpl().

Returns
List of GUI QAction objects.

◆ createGuiActionsImpl()

ToolsPlugin::ListOfGuiActions cc_tools_qt::ToolsPlugin::createGuiActionsImpl ( )
protectedvirtual

Create GUI actions.

Returns
If not overriden returns empty list.

◆ createProtocol()

ToolsProtocolPtr cc_tools_qt::ToolsPlugin::createProtocol ( )

Create protocol.

This function will be called if it is protocol plugin. It will invoke createProtocolImpl() if assigned type is Type_Protocol.

Returns
Allocated protocol object

◆ createProtocolImpl()

ToolsProtocolPtr cc_tools_qt::ToolsPlugin::createProtocolImpl ( )
protectedvirtual

Create protocol object.

Expected to be overriden by the derived class.

Returns
By default returns empty pointer.

◆ createSocket()

ToolsSocketPtr cc_tools_qt::ToolsPlugin::createSocket ( )

Create socket.

This function will be called if it is socket plugin. It will invoke createSocketImpl() if assigned type is Type_Socket.

Returns
Allocated socket object

◆ createSocketImpl()

ToolsSocketPtr cc_tools_qt::ToolsPlugin::createSocketImpl ( )
protectedvirtual

Create socket object.

Expected to be overriden by the derived class.

Returns
By default returns empty pointer.

◆ getCurrentConfig() [1/2]

QVariantMap cc_tools_qt::ToolsPlugin::getCurrentConfig ( )

Get currentConfiguration.

Invokes getCurrentConfigImpl(), which can be overridden by the derived class. It is responsible to update the provided configuration with new entries relevant to the plugin.

Returns
Configuration map.

◆ getCurrentConfig() [2/2]

void cc_tools_qt::ToolsPlugin::getCurrentConfig ( QVariantMap &  config)

Get current configuration.

Invokes getCurrentConfigImpl(), which can be overridden by the derived class. It is responsible to update the provided configuration with new entries relevant to the plugin.

Parameters
[in,out]configConfiguration map

◆ getCurrentConfigImpl()

void cc_tools_qt::ToolsPlugin::getCurrentConfigImpl ( QVariantMap &  config)
protectedvirtual

Polymorphic call to retrieve current configuration.

Default implementation does nothing. The derived class needs to override this function if the plugin requires or supports configuration and update the provided map with relevant values.

Parameters
[in,out]configConfiguration map

◆ reconfigure()

void cc_tools_qt::ToolsPlugin::reconfigure ( const QVariantMap &  config)

Request to perform reconfigure.

Invokes reconfigureImpl(), which can be overridden by the derived class. The latter must retrieve appropriate values from the configuration map and apply requested updates.

◆ reconfigureImpl()

void cc_tools_qt::ToolsPlugin::reconfigureImpl ( const QVariantMap &  config)
protectedvirtual

Polymorphic call to perform plugin (re)configuration.

Default implementation does nothing. The derived class needs to override byt function if the plugin requires or supports (re)configuration.

Parameters
[in]configConfiguration map

◆ reportInterPluginConfig

void cc_tools_qt::ToolsPlugin::reportInterPluginConfig ( const QVariantMap &  props)
protectedslot

Report inter-plugin configuration.

Sometimes configuration of one plugin may influence configuration of another. Use this function to report inter-plugin configuration properties. When invoked all other plugins are expected to get their respecitve applyInterPluginConfig() functions invoked.
Emits sigInterPluginConfigReport() signal.

Parameters
[in]propsReported properties.

◆ setDebugOutputLevel()

void cc_tools_qt::ToolsPlugin::setDebugOutputLevel ( unsigned  level = 0U)

Set debug output level.

Parameters
[in]levelDebug level. If 0, debug output is disabled

◆ sigInterPluginConfigReport

void cc_tools_qt::ToolsPlugin::sigInterPluginConfigReport ( const QVariantMap &  props)
signal

Signal reporting inter-plugin configuration request.

Parameters
[in]propsConfiguration properties.

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