Plugin.h File Reference
#include "SimTKcommon/internal/common.h"
#include "SimTKcommon/internal/Array.h"
#include <string>
#include <stdexcept>
Go to the source code of this file.
Define Documentation
#define SimTK_PLUGIN_DEFINE_FUNCTION |
( |
RetType, |
|
|
FuncName |
|
) |
|
#define SimTK_PLUGIN_DEFINE_FUNCTION1 |
( |
RetType, |
|
|
FuncName, |
|
|
Arg1 |
|
) |
|
#define SimTK_PLUGIN_DEFINE_FUNCTION2 |
( |
RetType, |
|
|
FuncName, |
|
|
Arg1, |
|
|
Arg2 |
|
) |
|
#define SimTK_PLUGIN_DEFINE_SYMBOL |
( |
Type, |
|
|
SymName |
|
) |
|
Value:typedef Type SymName##__Type__; \
SimTK_PLUGIN_XXX_MAKE_HOLDER(SymName); \
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_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_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_SYMTEST |
( |
Symbol |
|
) |
|
Value:bool has_##Symbol() const { \
return Symbol##__Ref__.loadSym(m_handle,m_lastMessage); \
}