cuapps 1.x
A header file to load available modules in a cumbia application
Public Member Functions | List of all members
CuModuleLoader Class Reference

Find and load installed cumbia modules. More...

#include <quapps.h>

Public Member Functions

 CuModuleLoader ()
 
 CuModuleLoader (CumbiaPool *cu_pool, CuControlsFactoryPool *ctrl_f_pool, CuLogImplI *log_impl)
 Class constructor. Detects available modules and loads them according to command line options. More...
 
virtual ~CuModuleLoader ()
 
CuLog * log () const
 
QStringList modules () const
 
QString msg () const
 
bool error () const
 
bool switch_engine (int engine, CumbiaPool *cu_pool, CuControlsFactoryPool &m_ctrl_factory_pool, QList< QObject * > &objs)
 
bool switch_engine (int engine, CumbiaPool *cu_pool, CuControlsFactoryPool &m_ctrl_factory_pool, QObject *root)
 
bool m_prepare_switch (int engine, CumbiaPool *cu_pool, CuControlsFactoryPool &m_ctrl_factory_pool, std::vector< Cumbia * > &cumbias)
 
int m_apply_switch (const QList< QObject * > objs, CumbiaPool *cu_pool, const CuControlsFactoryPool &m_ctrl_factory_pool)
 
int m_delete_cumbias (const std::vector< Cumbia * > &vc)
 
int engine_type (const CuContext *ctx) const
 
bool same_engine (CumbiaPool *cu_pool, int engine) const
 
std::vector< Cumbia * > m_clear_cumbia (CumbiaPool *cu_pool, CuControlsFactoryPool &fp)
 

Detailed Description

Find and load installed cumbia modules.

Foreword
In this documentation, the words module, engine, domain are synonyms.

CuModuleLoader detects the installed cumbia modules, such as cumbia-tango, cumbia-epics, cumbia-websocket, cumbia-http, cumbia-random. In order to be found, each module must have been compiled and installed either through the scripts/cubiuild.sh automatic procedure or manually.

To get the list of searched modules for the current cumbia version, inspect quapps.pri.

Usage
The application Qt project file (*.pro*) shall include $${CUMBIA_ROOT}/include/quapps/quapps.pri instead of an engine specific *.pri* project include file, for examaple qumbia-tango-controls.pri.

Including quapps.pri in your project *.pro* file and using CuModuleLoader allows engine auto detection and loading.

Loading precedence.

cumbia-websocket and cumbia-http are mutually exclusive. If either is loaded, module search stops. This lets the same application work seamlessly across different engines without changing its code.

Constructor & Destructor Documentation

◆ CuModuleLoader() [1/2]

CuModuleLoader::CuModuleLoader ( )
inline

◆ CuModuleLoader() [2/2]

CuModuleLoader::CuModuleLoader ( CumbiaPool *  cu_pool,
CuControlsFactoryPool *  ctrl_f_pool,
CuLogImplI *  log_impl 
)
inline

Class constructor. Detects available modules and loads them according to command line options.

Parameters
cu_poolpointer to a valid CumbiaPool. Ownership is not taken.
ctrl_f_poolpointer to a valid CuControlsFactoryPool. Ownership is not taken
log_implpointer to a valid CuLogImplI implementation. Ownership is not taken.

Modules listed in quapps.pri are searched. If found, they are loaded.

Http and websocket modules
If the -u command line argument is followed by an URL, either a http/https or a ws/wss URL is expected. In the former case, the URL of the server must be followed by a channel name, used for the publisher/subscriber communication.

If -u + url is detected, one of cumbia-http or cumbia-websocket modules is loaded. Since a cumbia application is studied to rely on any supported engine at runtime transparently, no other modules are loaded after either http or websocket. They indeed share the same source syntax as the native engines.

If no URL is provided, all the other available engines are loaded.

Parameters cu_pool and ctrl_f_pool must be valid. If log_impl is null, then no CuLog service is instantiated and registered. If log_impl is not null, a CuLog is created for you with the given CuLogImplI instance, and can be fetched with the CuModuleLoader::log method. If a CuLog is instantiated, it will be deleted together with CuModuleLoader.

The CuModuleLoader::modules method returns the list of modules (or, equivalently engines, domains) loaded.

◆ ~CuModuleLoader()

virtual CuModuleLoader::~CuModuleLoader ( )
inlinevirtual

Member Function Documentation

◆ engine_type()

int CuModuleLoader::engine_type ( const CuContext *  ctx) const
inline

◆ error()

bool CuModuleLoader::error ( ) const
inline

◆ log()

CuLog * CuModuleLoader::log ( ) const
inline

Referenced by m_prepare_switch().

◆ m_apply_switch()

int CuModuleLoader::m_apply_switch ( const QList< QObject * >  objs,
CumbiaPool *  cu_pool,
const CuControlsFactoryPool &  m_ctrl_factory_pool 
)
inline

Referenced by switch_engine().

◆ m_clear_cumbia()

std::vector< Cumbia * > CuModuleLoader::m_clear_cumbia ( CumbiaPool *  cu_pool,
CuControlsFactoryPool &  fp 
)
inline

Referenced by m_prepare_switch().

◆ m_delete_cumbias()

int CuModuleLoader::m_delete_cumbias ( const std::vector< Cumbia * > &  vc)
inline

Referenced by switch_engine().

◆ m_prepare_switch()

bool CuModuleLoader::m_prepare_switch ( int  engine,
CumbiaPool *  cu_pool,
CuControlsFactoryPool &  m_ctrl_factory_pool,
std::vector< Cumbia * > &  cumbias 
)
inline

References log(), m_clear_cumbia(), and same_engine().

Referenced by switch_engine().

◆ modules()

QStringList CuModuleLoader::modules ( ) const
inline

◆ msg()

QString CuModuleLoader::msg ( ) const
inline

◆ same_engine()

bool CuModuleLoader::same_engine ( CumbiaPool *  cu_pool,
int  engine 
) const
inline

Referenced by m_prepare_switch().

◆ switch_engine() [1/2]

bool CuModuleLoader::switch_engine ( int  engine,
CumbiaPool *  cu_pool,
CuControlsFactoryPool &  m_ctrl_factory_pool,
QList< QObject * > &  objs 
)
inline

◆ switch_engine() [2/2]

bool CuModuleLoader::switch_engine ( int  engine,
CumbiaPool *  cu_pool,
CuControlsFactoryPool &  m_ctrl_factory_pool,
QObject *  root 
)
inline

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