cumbia-qtcontrols 1.x
Qt widgets on top of the cumbia C++ library
Public Types | Public Member Functions | List of all members
CuEngineHotSwitch Class Reference

Helper class to switch context on a controls reader (writer) More...

#include <cuengine_hot_switch.h>

Public Types

enum  Engines {
  NoEngine = 0 , Tango , Epics , Http ,
  Random , Websocket , MaxEngines
}
 

Public Member Functions

 CuEngineHotSwitch ()
 
 ~CuEngineHotSwitch ()
 
CuContexthot_switch (CuDataListener *l, CuContext *ctx, CumbiaPool *p, const CuControlsFactoryPool &fpoo)
 Perform the actual engine switch on either the reader or writer behind the given context. The old context will be deleted. The returned context shall be used by the caller to update its reference to its own context. More...
 
void switch_engine (int engine, CumbiaPool *p, const CuControlsFactoryPool &fpoo)
 
int detect_engine (CuContext *ctx) const
 
const char * engine_name (int engine) const
 returns the engine name corresponding to the input value from the CuEngineHotSwitch::Engines enum More...
 
bool error () const
 
const QString & msg () const
 

Detailed Description

Helper class to switch context on a controls reader (writer)

Since
1.5.0

Member Enumeration Documentation

◆ Engines

Enumerator
NoEngine 
Epics 
Http 
Random 
Websocket 
MaxEngines 

Constructor & Destructor Documentation

◆ CuEngineHotSwitch()

CuEngineHotSwitch::CuEngineHotSwitch ( )

◆ ~CuEngineHotSwitch()

CuEngineHotSwitch::~CuEngineHotSwitch ( )

Member Function Documentation

◆ detect_engine()

int CuEngineHotSwitch::detect_engine ( CuContext ctx) const

◆ engine_name()

const char * CuEngineHotSwitch::engine_name ( int  engine) const

returns the engine name corresponding to the input value from the CuEngineHotSwitch::Engines enum

Parameters
engineone value in the CuEngineHotSwitch::Engines enum
Returns
the name of the engine or nullptr if the input argument exceeds CuEngineHotSwitch::MaxEngines

References MaxEngines.

◆ error()

bool CuEngineHotSwitch::error ( ) const

◆ hot_switch()

CuContext * CuEngineHotSwitch::hot_switch ( CuDataListener *  l,
CuContext ctx,
CumbiaPool *  p,
const CuControlsFactoryPool fpoo 
)

Perform the actual engine switch on either the reader or writer behind the given context. The old context will be deleted. The returned context shall be used by the caller to update its reference to its own context.

Parameters
lthe data listener to which the new context with the new engine will be linked
ctxthe current context of the reader (or writer) to be replaced
pa pointer to the CumbiaPool holding the new engine configuration
fpooa const reference to the pool holding the new engine configuration
Returns
the new context holding a new reader (writer) belonging to the new engine

This method is mainly used by the library components (or by custom cumbia components) when a context switch (i.e. engine switch) is required by the application.

Example: QuLabel::ctxSwitch(CumbiaPool *cumbia_pool, const CuControlsFactoryPool &fpool)

References CuContext::disposeReader(), CuContext::disposeWriter(), CuContext::getReader(), CuContext::getWriter(), CuContext::replace_reader(), CuContext::replace_writer(), CuControlsReaderA::setSource(), CuControlsWriterA::setTarget(), CuControlsReaderA::source(), and CuControlsWriterA::target().

Referenced by QuButton::ctxSwitch(), and QuLabel::ctxSwitch().

◆ msg()

const QString & CuEngineHotSwitch::msg ( ) const

◆ switch_engine()

void CuEngineHotSwitch::switch_engine ( int  engine,
CumbiaPool *  p,
const CuControlsFactoryPool fpoo 
)

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