Classes | Namespaces | Defines | Typedefs

base/PlugFunction.hpp File Reference

Go to the source code of this file.

Classes

class  openfluid::base::PluggableFunction
 Abstract class for plugin interface. More...

Namespaces

namespace  openfluid
namespace  openfluid::base

Defines

#define PLUGFUNCTION_PROC_NAME   "GetPlugFunction"
#define PLUGSIGNATURE_PROC_NAME   "GetPlugSignature"
#define PLUGSDKVERSION_PROC_NAME   "GetPlugSDKVersion"
#define DECLARE_PLUGIN_HOOKS
#define DEFINE_FUNCTION_HOOK(pluginclassname)
#define DECLARE_UNITS_ORDERED_LOOP(loopid)
#define DECLARE_GLOBAL_UNITS_ORDERED_LOOP(loopid)
#define BEGIN_UNITS_ORDERED_LOOP(loopid, unitclass, unit)
#define BEGIN_GLOBAL_UNITS_ORDERED_LOOP(loopid, unit)
#define APPLY_UNITS_ORDERED_LOOP_THREADED(loopid, unitclass, funcptr,...)
#define APPLY_GLOBAL_UNITS_ORDERED_LOOP_THREADED(loopid, funcptr,...)
#define DECLARE_UNITS_LIST_LOOP(loopid)   openfluid::core::UnitsPtrList_t::iterator _M_##loopid##_lstit;\
#define BEGIN_UNITS_LIST_LOOP(loopid, ulist, unit)
#define DECLARE_EVENT_COLLECTION_LOOP   openfluid::core::EventsList_t::iterator _M_EvListiter;
#define BEGIN_EVENT_COLLECTION_LOOP(evlist, evobj)
#define END_LOOP

Typedefs

typedef PluggableFunction *(* openfluid::base::GetPluggableFunctionProc )()
typedef FunctionSignature *(* openfluid::base::GetSignatureProc )()
typedef std::string(* openfluid::base::GetSDKVersionProc )()

Detailed Description

Author:
Jean-Christophe FABRE <fabrejc@supagro.inra.fr>

Every simulation function must :

To be linked to an OpenFLUID application, the simulation function must have two hooks declarations.

  extern "C"
  {
    DLLIMPORT PluggableFunction* GetPlugFunction();
    DLLIMPORT PluggableFunction* GetPlugSignature();
  };

returning the signature and an instance of the derived class inherited from the PluggableFunction class.


Define Documentation

#define APPLY_GLOBAL_UNITS_ORDERED_LOOP_THREADED (   loopid,
  funcptr,
  ... 
)
Value:
_M_##loopid##_GUList = mp_CoreData->getUnitsGlobally(); \
  if (_M_##loopid##_GUList != NULL) \
  { \
    _M_##loopid##_ordit = _M_##loopid##_GUList->begin(); \
    if (_M_##loopid##_ordit != _M_##loopid##_GUList->end()) \
    { \
      openfluid::core::PcsOrd_t _M_##loopid##_pcsord = (*_M_##loopid##_ordit)->getProcessOrder(); \
      while (_M_##loopid##_ordit != _M_##loopid##_GUList->end()) \
      { \
        Glib::ThreadPool _M_##loopid##_pool(OPENFLUID_GetFunctionMaxThreads(),true); \
        while (_M_##loopid##_ordit != _M_##loopid##_GUList->end() && (*_M_##loopid##_ordit)->getProcessOrder() == _M_##loopid##_pcsord) \
        { \
          openfluid::core::Unit* _M_##loopid##_unit = (*_M_##loopid##_ordit); \
          _M_##loopid##_pool.push(sigc::bind(sigc::mem_fun(*this,&funcptr),_M_##loopid##_unit, ## __VA_ARGS__)); \
          ++_M_##loopid##_ordit; \
        } \
        _M_##loopid##_pool.shutdown(); \
        if (_M_##loopid##_ordit != _M_##loopid##_GUList->end()) _M_##loopid##_pcsord = (*_M_##loopid##_ordit)->getProcessOrder(); \
      } \
    } \
  }

Macro for applying a threaded function to each units of the domain, following their process order

Parameters:
[in]loopidID of the loop, must match declaration
[in]functptrmember function name
[in]...extra parameters to pass to the member function
#define APPLY_UNITS_ORDERED_LOOP_THREADED (   loopid,
  unitclass,
  funcptr,
  ... 
)
Value:
_M_##loopid##_UList = mp_CoreData->getUnits(unitclass)->getList(); \
  if (_M_##loopid##_UList != NULL) \
  { \
    _M_##loopid##_ordit = _M_##loopid##_UList->begin(); \
    if (_M_##loopid##_ordit != _M_##loopid##_UList->end()) \
    { \
      openfluid::core::PcsOrd_t _M_##loopid##_pcsord = _M_##loopid##_ordit->getProcessOrder(); \
      while (_M_##loopid##_ordit != _M_##loopid##_UList->end()) \
      { \
        Glib::ThreadPool _M_##loopid##_pool(OPENFLUID_GetFunctionMaxThreads(),true); \
        while (_M_##loopid##_ordit != _M_##loopid##_UList->end() && _M_##loopid##_ordit->getProcessOrder() == _M_##loopid##_pcsord) \
        { \
          openfluid::core::Unit* _M_##loopid##_unit = &(*_M_##loopid##_ordit); \
          _M_##loopid##_pool.push(sigc::bind(sigc::mem_fun(*this,&funcptr),_M_##loopid##_unit, ## __VA_ARGS__)); \
          ++_M_##loopid##_ordit; \
        } \
        _M_##loopid##_pool.shutdown(); \
        if (_M_##loopid##_ordit != _M_##loopid##_UList->end()) _M_##loopid##_pcsord = _M_##loopid##_ordit->getProcessOrder(); \
      } \
    } \
  }

Macro for applying a threaded function to each units of a class, following their process order

Parameters:
[in]loopidID of the loop, must match declaration
[in]unitclassname of the unit class
[in]functptrmember function name
[in]...extra parameters to pass to the member function
#define BEGIN_EVENT_COLLECTION_LOOP (   evlist,
  evobj 
)
Value:
{ \
    for(_M_EvListiter=(evlist)->begin(); _M_EvListiter != (evlist)->end(); _M_EvListiter++) \
    { \
      evobj = &(*_M_EvListiter);

Macro for the beginning of a loop processing an event list from an event collection

Parameters:
[in]evlistpointer to a list of events
[out]evobjthe current processed event
#define BEGIN_GLOBAL_UNITS_ORDERED_LOOP (   loopid,
  unit 
)
Value:
{ \
    _M_##loopid##_GUList = mp_CoreData->getUnitsGlobally(); \
    for (_M_##loopid##_ordit = _M_##loopid##_GUList->begin();_M_##loopid##_ordit != _M_##loopid##_GUList->end();++_M_##loopid##_ordit) \
    { \
      unit = (*_M_##loopid##_ordit);

Macro for the beginning of a loop processing all units, following their process order

Parameters:
[in]loopidID of the loop, must match declaration
[out]unitpointer to a openfluid::core::Unit objects, pointing to the current processed SU
#define BEGIN_UNITS_LIST_LOOP (   loopid,
  ulist,
  unit 
)
Value:
if ((ulist) != NULL) \
  { \
    for(_M_##loopid##_lstit=ulist->begin(); _M_##loopid##_lstit != ulist->end(); _M_##loopid##_lstit++) \
    { \
      unit = *_M_##loopid##_lstit; \

Macro for the beginning of a loop processing a list of units

Parameters:
[in]loopidID of the loop, must match declaration
[in]ulistpointer to a list of openfluid::core::Unit
[out]unitpointer to a openfluid::core::Unit objects, pointing to the current processed SU
#define BEGIN_UNITS_ORDERED_LOOP (   loopid,
  unitclass,
  unit 
)
Value:
_M_##loopid##_UList = mp_CoreData->getUnits(unitclass)->getList(); \
  if (_M_##loopid##_UList != NULL) \
    { \
    for (_M_##loopid##_ordit = _M_##loopid##_UList->begin();_M_##loopid##_ordit != _M_##loopid##_UList->end();++_M_##loopid##_ordit) \
    { \
      unit = &(*_M_##loopid##_ordit);

Macro for the beginning of a loop processing all units of a class, following their process order

Parameters:
[in]loopidID of the loop, must match declaration
[in]unitclassname of the unit class
[out]unitpointer to a openfluid::core::Unit objects, pointing to the current processed SU
#define DECLARE_EVENT_COLLECTION_LOOP   openfluid::core::EventsList_t::iterator _M_EvListiter;

Macro for declaration of a loop processing events in an event collection

#define DECLARE_GLOBAL_UNITS_ORDERED_LOOP (   loopid)
Value:
openfluid::core::UnitsPtrList_t::iterator _M_##loopid##_ordit;\
  openfluid::core::UnitsPtrList_t* _M_##loopid##_GUList;

Macro for declaration of a loop processing all units, following their process order

Parameters:
[in]loopidID of the loop
#define DECLARE_PLUGIN_HOOKS
Value:
extern "C" \
  { \
    DLLEXPORT std::string GetPlugSDKVersion(); \
    DLLEXPORT openfluid::base::PluggableFunction* GetPlugFunction(); \
    DLLEXPORT openfluid::base::FunctionSignature* GetPlugSignature(); \
  }

Macro for declaration of function and signature hooks

#define DECLARE_UNITS_LIST_LOOP (   loopid)    openfluid::core::UnitsPtrList_t::iterator _M_##loopid##_lstit;\

Macro for declaration of a loop processing a list of units

Parameters:
[in]loopidID of the loop
#define DECLARE_UNITS_ORDERED_LOOP (   loopid)
Value:
openfluid::core::UnitsList_t::iterator _M_##loopid##_ordit;\
  openfluid::core::UnitsList_t* _M_##loopid##_UList;

Macro for declaration of a loop processing all units of a class, following their process order

Parameters:
[in]loopidID of the loop
#define DEFINE_FUNCTION_HOOK (   pluginclassname)
Value:
std::string GetPlugSDKVersion() \
  { \
    return std::string(STRINGIFY(OPENFLUID_VERSION)); \
  } \
  \
  openfluid::base::PluggableFunction* GetPlugFunction() \
  { \
    return new pluginclassname(); \
  }

Macro for definition of function hook

Parameters:
[in]pluginclassnameThe name of the class to instanciate
#define END_LOOP
Value:
} \
  }

Macro for the ending of a loop

#define PLUGFUNCTION_PROC_NAME   "GetPlugFunction"

Function hook name

#define PLUGSDKVERSION_PROC_NAME   "GetPlugSDKVersion"

SDK version hook name

#define PLUGSIGNATURE_PROC_NAME   "GetPlugSignature"

Signature hook name


Generated using Doxygen 1.7.3
Creative Commons License Creative Commons By-NC-ND license