FEDEM Model Database  R8.0
Source code of the FEDEM model database
Classes | Namespaces | Macros | Typedefs | Functions
FFaSwitchBoard.H File Reference

Signal handling management. More...

#include <map>
#include <set>
#include <list>
#include <cstddef>
Include dependency graph for FFaSwitchBoard.H:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  FFaSlotBasePt
 A slot pointer with reference counting. More...
 
class  FFaSwitchBoardConnector
 Base class for every class that want to send or recieve. More...
 
class  FFaSlotBase
 The most basic slot class. More...
 

Namespaces

 FFaSwitchBoard
 Static switchboard that holds the connection information.
 

Macros

#define FFASWB_MAKE_SLOTBASE_TEMPLATE(nr, templateDef, argumentList, typeList)
 Macro that defines the different slotBaseN templates. More...
 
#define FFASWB_MAKE_SLOT_TEMPLATE(nr, addedTemplateArgs, argumentList, parameterList, typeList)
 Macro that defines the different slotN templates. More...
 
#define FFASWB_MAKE_STATIC_SLOT_TEMPLATE(nr, templateDef, argumentList, parameterList, typeList)
 Macro that defines the different static slotN templates. More...
 
#define FFASWB_MAKE_EMIT_FUNCTION_TEMPLATE(nr, templateDef, addedArgumentList, parameterList, typeList)
 Function to call all the slots connected to a signal. More...
 
#define FFASWB_MAKE_SIMPLE_CONNECT_FUNCTION_TEMPLATE(nr, addedTemplateArgs, argumentList, addedTypeList)
 Macro that defines the connect function templates. More...
 
#define FFASWB_MAKE_SIMPLE_DISCONNECT_FUNCTION_TEMPLATE(nr, addedTemplateArgs, argumentList, addedTypeList)
 Macro that defines the disconnect function templates. More...
 
#define FFaSlot0S(ownerType, method)   new FFaStaticSlot0 (&ownerType::method)
 Static function slot without arguments. More...
 
#define FFaSlot1S(ownerType, method, P1Type)   new FFaStaticSlot1<P1Type> (&ownerType::method)
 Static function slot with one argument. More...
 
#define FFaSlot2S(ownerType, method, P1Type, P2Type)   new FFaStaticSlot2<P1Type, P2Type> (&ownerType::method)
 Static function slot with two arguments. More...
 
#define FFaSlot3S(ownerType, method, P1Type, P2Type, P3Type)   new FFaStaticSlot3<P1Type, P2Type, P3Type> (&ownerType::method)
 Static function slot with three arguments. More...
 
#define FFaSlot4S(ownerType, method, P1Type, P2Type, P3Type, P4Type)   new FFaStaticSlot4<P1Type, P2Type, P3Type, P4Type> (&ownerType::method)
 Static function slot with four arguments. More...
 
#define FFaSlot0M(ownerType, owner, method)   new FFaSlot0<ownerType> (owner,&ownerType::method)
 Class method slot without arguments. More...
 
#define FFaSlot1M(ownerType, owner, method, P1Type)   new FFaSlot1<ownerType, P1Type> (owner,&ownerType::method)
 Class method slot with one argument. More...
 
#define FFaSlot2M(ownerType, owner, method, P1Type, P2Type)   new FFaSlot2<ownerType, P1Type, P2Type> (owner,&ownerType::method)
 Class method slot with two arguments. More...
 
#define FFaSlot3M(ownerType, owner, method, P1Type, P2Type, P3Type)   new FFaSlot3<ownerType, P1Type, P2Type, P3Type> (owner,&ownerType::method)
 Class method slot with three arguments. More...
 
#define FFaSlot4M(ownerType, owner, method, P1Type, P2Type, P3Type, P4Type)   new FFaSlot4<ownerType, P1Type, P2Type, P3Type, P4Type> (owner,&ownerType::method)
 Class method slot with four arguments. More...
 

Typedefs

using FFaSlotList = std::list< FFaSlotBasePt >
 Slot container. More...
 
typedef void(FFaSwitchBoardConnector::* anyMethodType) (...)
 Callback function pointer. More...
 
typedef void(* anyFunctionType) (...)
 Callback function pointer. More...
 

Functions

void FFaSwitchBoard::connect (FFaSwitchBoardConnector *sender, int subject, FFaSlotBase *slot)
 Adds a new slot to the switchboard. More...
 
void FFaSwitchBoard::disConnect (FFaSwitchBoardConnector *sender, int subject, FFaSlotBase *slot)
 Removes slot from the switchboard. More...
 
void FFaSwitchBoard::removeAllOwnerConnections (FFaSwitchBoardConnector *owner)
 Removes all slots connected to owener. More...
 
FFaSlotList & FFaSwitchBoard::getSlots (FFaSwitchBoardConnector *sender, int subject, unsigned int typeID)
 Used internally in switchboard mechanism classes. More...
 
FFaSlotList::iterator FFaSwitchBoard::nextValidSlot (FFaSlotList::iterator it, FFaSlotList &slots, FFaSwitchBoardConnector *sender, int subject)
 Used internally by the switchboard mechanism classes. More...
 
void FFaSwitchBoard::removeSlotReference (FFaSwitchBoardConnector *sender, int subject, FFaSlotBase *slot)
 Used by FFaSlotBase only. More...
 
void FFaSwitchBoard::removeAllSenderConnections (FFaSwitchBoardConnector *sender)
 Used by FFaSwitchBoardConnector only. More...
 
void FFaSwitchBoard::removeInstance ()
 Cleans up the heap-allocated switchboard container. More...
 

Detailed Description

Signal handling management.

Macro Definition Documentation

◆ FFaSlot0M

#define FFaSlot0M (   ownerType,
  owner,
  method 
)    new FFaSlot0<ownerType> (owner,&ownerType::method)

Class method slot without arguments.

◆ FFaSlot0S

#define FFaSlot0S (   ownerType,
  method 
)    new FFaStaticSlot0 (&ownerType::method)

Static function slot without arguments.

◆ FFaSlot1M

#define FFaSlot1M (   ownerType,
  owner,
  method,
  P1Type 
)    new FFaSlot1<ownerType, P1Type> (owner,&ownerType::method)

Class method slot with one argument.

◆ FFaSlot1S

#define FFaSlot1S (   ownerType,
  method,
  P1Type 
)    new FFaStaticSlot1<P1Type> (&ownerType::method)

Static function slot with one argument.

◆ FFaSlot2M

#define FFaSlot2M (   ownerType,
  owner,
  method,
  P1Type,
  P2Type 
)    new FFaSlot2<ownerType, P1Type, P2Type> (owner,&ownerType::method)

Class method slot with two arguments.

◆ FFaSlot2S

#define FFaSlot2S (   ownerType,
  method,
  P1Type,
  P2Type 
)    new FFaStaticSlot2<P1Type, P2Type> (&ownerType::method)

Static function slot with two arguments.

◆ FFaSlot3M

#define FFaSlot3M (   ownerType,
  owner,
  method,
  P1Type,
  P2Type,
  P3Type 
)    new FFaSlot3<ownerType, P1Type, P2Type, P3Type> (owner,&ownerType::method)

Class method slot with three arguments.

◆ FFaSlot3S

#define FFaSlot3S (   ownerType,
  method,
  P1Type,
  P2Type,
  P3Type 
)    new FFaStaticSlot3<P1Type, P2Type, P3Type> (&ownerType::method)

Static function slot with three arguments.

◆ FFaSlot4M

#define FFaSlot4M (   ownerType,
  owner,
  method,
  P1Type,
  P2Type,
  P3Type,
  P4Type 
)    new FFaSlot4<ownerType, P1Type, P2Type, P3Type, P4Type> (owner,&ownerType::method)

Class method slot with four arguments.

◆ FFaSlot4S

#define FFaSlot4S (   ownerType,
  method,
  P1Type,
  P2Type,
  P3Type,
  P4Type 
)    new FFaStaticSlot4<P1Type, P2Type, P3Type, P4Type> (&ownerType::method)

Static function slot with four arguments.

◆ FFASWB_MAKE_EMIT_FUNCTION_TEMPLATE

#define FFASWB_MAKE_EMIT_FUNCTION_TEMPLATE (   nr,
  templateDef,
  addedArgumentList,
  parameterList,
  typeList 
)
Value:
\
templateDef void FFaSwitchBoardCall(FFaSwitchBoardConnector* sender, int subject addedArgumentList) \
{ \
unsigned int typeID = FFaSlotBase##nr typeList::getClassTypeID(); \
FFaSlotList& ffSlot = FFaSwitchBoard::getSlots(sender,subject,typeID); \
FFaSlotList::iterator it = ffSlot.end(); \
while ((it = FFaSwitchBoard::nextValidSlot(it,ffSlot,sender,subject)) != ffSlot.end()) \
static_cast<FFaSlotBase##nr typeList*>(it->slotPt)->invoke(parameterList); \
}
The most basic slot class.
Definition: FFaSwitchBoard.H:117
Base class for every class that want to send or recieve.
Definition: FFaSwitchBoard.H:83
FFaSlotList::iterator nextValidSlot(FFaSlotList::iterator it, FFaSlotList &slots, FFaSwitchBoardConnector *sender, int subject)
Used internally by the switchboard mechanism classes.
Definition: FFaSwitchBoard.C:238
FFaSlotList & getSlots(FFaSwitchBoardConnector *sender, int subject, unsigned int typeID)
Used internally in switchboard mechanism classes.
Definition: FFaSwitchBoard.C:214

Function to call all the slots connected to a signal.

Kind of "emit" from the Qt world. Loops trough all the slots connected to this signal and invokes them. This is made complicated by the fact that the slots can disappear due to the functions actually called.

◆ FFASWB_MAKE_SIMPLE_CONNECT_FUNCTION_TEMPLATE

#define FFASWB_MAKE_SIMPLE_CONNECT_FUNCTION_TEMPLATE (   nr,
  addedTemplateArgs,
  argumentList,
  addedTypeList 
)
Value:
\
template<class RecieverType addedTemplateArgs> \
void FFaSwitchBoardConnect(FFaSwitchBoardConnector* sender, int subject, RecieverType* receiver, \
void (RecieverType::*method)(argumentList)) \
{ \
FFaSwitchBoard::connect(sender, subject, new FFaSlot##nr <RecieverType addedTypeList>(receiver,method)); \
}
void connect(FFaSwitchBoardConnector *sender, int subject, FFaSlotBase *slot)
Adds a new slot to the switchboard.
Definition: FFaSwitchBoard.C:77

Macro that defines the connect function templates.

◆ FFASWB_MAKE_SIMPLE_DISCONNECT_FUNCTION_TEMPLATE

#define FFASWB_MAKE_SIMPLE_DISCONNECT_FUNCTION_TEMPLATE (   nr,
  addedTemplateArgs,
  argumentList,
  addedTypeList 
)
Value:
\
template<class RecieverType addedTemplateArgs> \
void FFaSwitchBoardDisConnect(FFaSwitchBoardConnector* sender, int subject, RecieverType* receiver, \
void (RecieverType::*method)(argumentList)) \
{ \
FFaSwitchBoard::disConnect(sender, subject, new FFaSlot##nr <RecieverType addedTypeList>(receiver,method)); \
}
void disConnect(FFaSwitchBoardConnector *sender, int subject, FFaSlotBase *slot)
Removes slot from the switchboard.
Definition: FFaSwitchBoard.C:89

Macro that defines the disconnect function templates.

◆ FFASWB_MAKE_SLOT_TEMPLATE

#define FFASWB_MAKE_SLOT_TEMPLATE (   nr,
  addedTemplateArgs,
  argumentList,
  parameterList,
  typeList 
)

Macro that defines the different slotN templates.

One macro call for each number of arguments nr we want to support.

◆ FFASWB_MAKE_SLOTBASE_TEMPLATE

#define FFASWB_MAKE_SLOTBASE_TEMPLATE (   nr,
  templateDef,
  argumentList,
  typeList 
)
Value:
\
templateDef \
class FFaSlotBase##nr : public FFaSlotBase \
{ \
public: \
FFaSlotBase##nr () { myTypeID = getClassTypeID(); } \
virtual ~FFaSlotBase##nr () {} \
virtual void invoke(argumentList) = 0; \
static unsigned int getClassTypeID() \
{ \
static unsigned int ourClassTypeID = ++uniqueTypeId; \
return ourClassTypeID; \
} \
};

Macro that defines the different slotBaseN templates.

One macro call for each number of arguments nr we want to support.

◆ FFASWB_MAKE_STATIC_SLOT_TEMPLATE

#define FFASWB_MAKE_STATIC_SLOT_TEMPLATE (   nr,
  templateDef,
  argumentList,
  parameterList,
  typeList 
)
Value:
\
templateDef \
class FFaStaticSlot##nr : public FFaSlotBase##nr typeList \
{ \
typedef void (*functionType)(argumentList); \
\
public: \
FFaStaticSlot##nr (functionType func) { myFunctionPt = func; } \
virtual ~FFaStaticSlot##nr () {} \
\
virtual void invoke(argumentList) { (this->myFunctionPt)(parameterList); } \
\
virtual bool operator==(FFaSlotBase& otherSlot) \
{ \
if (otherSlot.isStaticSlot()) \
return (anyFunctionType)myFunctionPt == otherSlot.getFunction(); \
else \
return false; \
} \
\
virtual FFaSwitchBoardConnector* getObject() { return NULL; } \
virtual anyMethodType getMethod() { return (anyMethodType)NULL; } \
virtual anyFunctionType getFunction() { return (anyFunctionType)myFunctionPt; } \
virtual bool isStaticSlot() const { return true; } \
\
private: \
functionType myFunctionPt; \
};
void(* anyFunctionType)(...)
Callback function pointer.
Definition: FFaSwitchBoard.H:42
void(FFaSwitchBoardConnector::* anyMethodType)(...)
Callback function pointer.
Definition: FFaSwitchBoard.H:40
bool operator==(const Fm1DMaster &lhs, const Fm1DMaster &rhs)
Definition: Fm1DMaster.C:282

Macro that defines the different static slotN templates.

One macro call for each number of arguments nr we want to support.

Typedef Documentation

◆ anyFunctionType

typedef void(* anyFunctionType) (...)

Callback function pointer.

◆ anyMethodType

typedef void(FFaSwitchBoardConnector::* anyMethodType) (...)

Callback function pointer.

◆ FFaSlotList

using FFaSlotList = std::list<FFaSlotBasePt>

Slot container.