|
#ifndef _MTCOMPLUGINADAPTER_INCLUDED
#define _MTCOMPLUGINADAPTER_INCLUDED
#include "MTParser.h"
#include <atlbase.h>
#import "../MTPluginIDL/MTPluginIDL.tlb" no_namespace
// @class Plugin loader
// Load a COM plugin: constants, operators and functions.
class MTCOMPluginLoader
{
public:
// Load this plugin
// @param plugin: plugin object (class)
// @param pMathExpr: all items contained in the plugin will be defined
// in this math expression object.
static bool loadPlugin(CLSID plugin, MTParser *pMathExpr) throw(MTDefException);
};
// @class Adapter to allow COM plugin functions to be handled
// like native c++ functions.
// All calls will be delegated to the plugin
class MTCOMFuncAdapter : public MTFunctionI
{
public:
void init(int id, CComPtr<IMTPlugin> &pPlugin);
~MTCOMFuncAdapter();
//******************************
// MTFunctionI implementation
virtual MTSTRING getSymbol();
virtual MTSTRING getHelpString();
virtual MTSTRING getDescription();
virtual int getNbArgs();
virtual bool isConstant();
virtual MTDOUBLE evaluate(unsigned int nbArgs, const MTDOUBLE *pArg);
virtual MTFunctionI* spawn();
private:
int m_id;
CComPtr<IMTPlugin> m_pPlugin;
};
// @class Adapter to allow COM plugin operators to be handled
// like native c++ operators.
// All calls will be delegated to the plugin
class MTCOMOpAdapter : public MTOperatorI
{
public:
void init(int id, CComPtr<IMTPlugin> &plugin);
~MTCOMOpAdapter();
//******************************
// MTOperatorI implementation
virtual EMathOpPrecedence getPrecedence();
virtual MTSTRING getSymbol();
virtual MTSTRING getHelpString();
virtual MTSTRING getDescription();
virtual MTDOUBLE evaluate(unsigned int nbArgs, const MTDOUBLE *pArg);
virtual MTOperatorI* spawn();
private:
int m_id;
CComPtr<IMTPlugin> m_pPlugin;
};
#endif
|
By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.
If a file you wish to view isn't highlighted, and is a text file (not binary), please
let us know and we'll add colourisation support for it.