Simbody  3.3
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Plugin.h File Reference

Declaration of the SimTK::Plugin class providing platform-independent handling of dynamically-loaded libraries. More...

#include "SimTKcommon/internal/common.h"
#include "SimTKcommon/internal/Array.h"
#include "SimTKcommon/internal/Pathname.h"
#include <string>
#include <stdexcept>

Go to the source code of this file.

Classes

class  SimTK::Plugin
 This is the base class for representing a runtime-linked dynamic library, also known as a "plugin", in a platform-independent manner. More...
 

Namespaces

 SimTK
 This is the top-level SimTK namespace into which all SimTK names are placed to avoid collision with other symbols.
 

Macros

#define SimTK_PLUGIN_XXX_MAKE_HOLDER(FuncName)
 
#define SimTK_PLUGIN_XXX_MAKE_BODY(FuncName)
 
#define SimTK_PLUGIN_XXX_MAKE_SYMTEST(Symbol)
 
#define SimTK_PLUGIN_DEFINE_SYMBOL(Type, SymName)
 
#define SimTK_PLUGIN_DEFINE_FUNCTION(RetType, FuncName)
 
#define SimTK_PLUGIN_DEFINE_FUNCTION1(RetType, FuncName, Arg1)
 
#define SimTK_PLUGIN_DEFINE_FUNCTION2(RetType, FuncName, Arg1, Arg2)
 

Detailed Description

Declaration of the SimTK::Plugin class providing platform-independent handling of dynamically-loaded libraries.

Macro Definition Documentation

#define SimTK_PLUGIN_XXX_MAKE_HOLDER (   FuncName)
Value:
struct FuncName##__Holder__ { \
FuncName##__Holder__() : fp(0) {} \
bool loadSym(void* h, std::string& msg) const { \
if(!fp) fp =(FuncName##__Type__) \
Plugin::getSymbolAddress(h, #FuncName, msg); \
return (fp!=0); \
} \
mutable FuncName##__Type__ fp; \
} FuncName##__Ref__
#define SimTK_PLUGIN_XXX_MAKE_BODY (   FuncName)
Value:
if (!FuncName##__Ref__.loadSym(m_handle,m_lastMessage)) \
throw std::runtime_error \
("Plugin function " #FuncName " not found: " + m_lastMessage); \
return FuncName##__Ref__.fp
#define SimTK_PLUGIN_XXX_MAKE_SYMTEST (   Symbol)
Value:
bool has_##Symbol() const { \
return Symbol##__Ref__.loadSym(m_handle,m_lastMessage); \
}
#define SimTK_PLUGIN_DEFINE_SYMBOL (   Type,
  SymName 
)
Value:
typedef Type SymName##__Type__; \
const Type& SymName() const { \
if (!SymName##__Ref__.loadSym(m_handle,m_lastMessage)) \
throw std::runtime_error \
("Plugin symbol " #SymName " not found: " + m_lastMessage); \
return *(SymName##__Ref__.fp); \
}
#define SimTK_PLUGIN_XXX_MAKE_HOLDER(FuncName)
Definition: Plugin.h:259
#define SimTK_PLUGIN_DEFINE_FUNCTION (   RetType,
  FuncName 
)
Value:
typedef RetType (*FuncName##__Type__)(); \
RetType FuncName() const { \
} \
#define SimTK_PLUGIN_XXX_MAKE_HOLDER(FuncName)
Definition: Plugin.h:259
#define SimTK_PLUGIN_XXX_MAKE_BODY(FuncName)
Definition: Plugin.h:269
#define SimTK_PLUGIN_XXX_MAKE_SYMTEST(Symbol)
Definition: Plugin.h:274
#define SimTK_PLUGIN_DEFINE_FUNCTION1 (   RetType,
  FuncName,
  Arg1 
)
Value:
typedef RetType (*FuncName##__Type__)(Arg1); \
RetType FuncName(Arg1 a1) const { \
} \
#define SimTK_PLUGIN_XXX_MAKE_HOLDER(FuncName)
Definition: Plugin.h:259
#define SimTK_PLUGIN_XXX_MAKE_BODY(FuncName)
Definition: Plugin.h:269
#define SimTK_PLUGIN_XXX_MAKE_SYMTEST(Symbol)
Definition: Plugin.h:274
#define SimTK_PLUGIN_DEFINE_FUNCTION2 (   RetType,
  FuncName,
  Arg1,
  Arg2 
)
Value:
typedef RetType (*FuncName##__Type__)(Arg1,Arg2); \
RetType FuncName(Arg1 a1, Arg2 a2) const { \
SimTK_PLUGIN_XXX_MAKE_BODY(FuncName)(a1,a2); \
} \
#define SimTK_PLUGIN_XXX_MAKE_HOLDER(FuncName)
Definition: Plugin.h:259
#define SimTK_PLUGIN_XXX_MAKE_BODY(FuncName)
Definition: Plugin.h:269
#define SimTK_PLUGIN_XXX_MAKE_SYMTEST(Symbol)
Definition: Plugin.h:274