cc_tools_qt
Common Environment for Protocol Analysis.
|
#include "cc_tools_qt/Plugin.h"
Interface class for plugin definition.
Inherits QObject.
Public Types | |
using | InterPluginConfigReportCallback = std::function< void(const QVariantMap &)> |
Callback to report inter-plugin configuration updates. | |
using | ListOfFilters = PluginProperties::ListOfFilters |
List of filter objects. | |
using | ListOfGuiActions = PluginProperties::ListOfGuiActions |
List of GUI action buttons. | |
using | WidgetPtr = std::unique_ptr< QWidget > |
Pointer to widget object. | |
Public Member Functions | |
Plugin () | |
Constructor. | |
virtual | ~Plugin () noexcept |
Destructor. | |
void | applyInterPluginConfig (const QVariantMap &props) |
Apply inter-plugin configuration. | |
QWidget * | createConfiguarionWidget () const |
Create a widget to perform plugin configuration in GUI application. | |
ListOfFilters | createFilters () const |
Create filters. | |
ListOfGuiActions | createGuiActions () const |
Create GUI actions relevant to the plugin. | |
ProtocolPtr | createProtocol () const |
Create protocol. | |
SocketPtr | createSocket () const |
Create socket. | |
QVariantMap | getCurrentConfig () |
Get currentConfiguration. | |
void | getCurrentConfig (QVariantMap &config) |
Get current configuration. | |
QVariant | getCustomProperty (const QString &name) |
Retrieve custom property assigned by the derived class. | |
void | reconfigure (const QVariantMap &config) |
Request to perform reconfigure. | |
void | setDebugOutputLevel (unsigned level=0U) |
Set debug output level. | |
void | setInterPluginConfigReportCallback (InterPluginConfigReportCallback &&func) |
Set callback to report inter-plugin configuration. | |
Protected Member Functions | |
virtual void | applyInterPluginConfigImpl (const QVariantMap &props) |
Polymorphic inter-plugin configuration application. | |
virtual void | getCurrentConfigImpl (QVariantMap &config) |
Polymorphic call to retrieve current configuration. | |
PluginProperties & | pluginProperties () |
Get access to plugin properties. | |
virtual void | reconfigureImpl (const QVariantMap &config) |
Polymorphic call to perform plugin (re)configuration. | |
void | reportInterPluginConfig (const QVariantMap &props) |
Report inter-plugin configuration. | |
void cc_tools_qt::Plugin::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().
[in] | props | Properties map. |
|
protectedvirtual |
Polymorphic inter-plugin configuration application.
Invoked by the applyInterPluginConfig().
[in] | props | Properties map. |
QWidget * cc_tools_qt::Plugin::createConfiguarionWidget | ( | ) | const |
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.
ListOfFilters cc_tools_qt::Plugin::createFilters | ( | ) | const |
Create filters.
This function will be called if it is filter plugin. It will invoke filters creation callback function assigned by the derived class to pluginProperties().
ListOfGuiActions cc_tools_qt::Plugin::createGuiActions | ( | ) | const |
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.
ProtocolPtr cc_tools_qt::Plugin::createProtocol | ( | ) | const |
Create protocol.
This function will be called if it is protocol plugin. It will invoke protocol creation callback function assigned by the derived class to pluginProperties().
SocketPtr cc_tools_qt::Plugin::createSocket | ( | ) | const |
Create socket.
This function will be called if it is socket plugin. It will invoke socket creation callback function assigned by the derived class to pluginProperties().
QVariantMap cc_tools_qt::Plugin::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.
void cc_tools_qt::Plugin::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.
[in,out] | config | Configuration map |
|
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.
[in,out] | config | Configuration map |
QVariant cc_tools_qt::Plugin::getCustomProperty | ( | const QString & | name | ) |
Retrieve custom property assigned by the derived class.
[in] | name | Name of the property |
|
protected |
Get access to plugin properties.
Expected to be called by the derived class to get an access to the properties accumulation objects and provide appropriate callbacks and/or other custom properties.
void cc_tools_qt::Plugin::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.
|
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.
[in] | config | Configuration map |
|
protected |
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.
[in] | props | Reported properties. |
void cc_tools_qt::Plugin::setDebugOutputLevel | ( | unsigned | level = 0U | ) |
Set debug output level.
[in] | level | Debug level. If 0, debug output is disabled |