feat(plugin): add name arguments to addOperator function
This commit is contained in:
@@ -30,4 +30,5 @@ protected:
|
|||||||
};
|
};
|
||||||
|
|
||||||
using opConstructor = GeometryOpDef* (*)(enzo::nt::OpId);
|
using opConstructor = GeometryOpDef* (*)(enzo::nt::OpId);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,9 +2,10 @@
|
|||||||
|
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
|
|
||||||
void enzo::op::OperatorTable::addOperator(nt::opConstructor ctorFunc)
|
void enzo::op::OperatorTable::addOperator(const char* internalName, const char* displayName, nt::opConstructor ctorFunc)
|
||||||
{
|
{
|
||||||
std::cout << "OPERATOR TABLE ADDED\n";
|
std::cout << "OPERATOR TABLE ADDED\n";
|
||||||
|
std::cout << "adding operator: " << displayName << "\n";
|
||||||
ctorStore_.push_back(ctorFunc);
|
ctorStore_.push_back(ctorFunc);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -9,10 +9,11 @@ namespace enzo::op
|
|||||||
class BOOST_SYMBOL_EXPORT OperatorTable
|
class BOOST_SYMBOL_EXPORT OperatorTable
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
static void addOperator(nt::opConstructor ctorFunc);
|
static void addOperator(const char* internalName, const char* displayName, nt::opConstructor ctorFunc);
|
||||||
static nt::opConstructor getOpConstructor(size_t pos);
|
static nt::opConstructor getOpConstructor(size_t pos);
|
||||||
private:
|
private:
|
||||||
static std::vector<nt::opConstructor> ctorStore_;
|
static std::vector<nt::opConstructor> ctorStore_;
|
||||||
};
|
};
|
||||||
|
using addOperatorPtr = void (*)(const char* internalName, const char* displayName, nt::opConstructor ctorFunc);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -37,6 +37,5 @@ namespace enzo
|
|||||||
Input,
|
Input,
|
||||||
Output
|
Output
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -17,7 +17,7 @@ int main(int argc, char **argv)
|
|||||||
QSurfaceFormat::setDefaultFormat(format);
|
QSurfaceFormat::setDefaultFormat(format);
|
||||||
|
|
||||||
// setup table
|
// setup table
|
||||||
auto initPlugin = boost::dll::import_symbol<void(void (*addOperator)(enzo::nt::opConstructor))>(
|
auto initPlugin = boost::dll::import_symbol<void(enzo::op::addOperatorPtr)>(
|
||||||
"build/src/OpDefs/libenzoOps1.so", "newSopOperator"
|
"build/src/OpDefs/libenzoOps1.so", "newSopOperator"
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|||||||
@@ -7,10 +7,12 @@
|
|||||||
#include <iostream>
|
#include <iostream>
|
||||||
|
|
||||||
extern "C"
|
extern "C"
|
||||||
{ BOOST_SYMBOL_EXPORT std::string myVar = "hello world";
|
{
|
||||||
BOOST_SYMBOL_EXPORT void newSopOperator(void (*addOperator)(enzo::nt::opConstructor))
|
BOOST_SYMBOL_EXPORT void newSopOperator(enzo::op::addOperatorPtr addOperator)
|
||||||
{
|
{
|
||||||
addOperator(
|
addOperator(
|
||||||
|
"transform",
|
||||||
|
"Transform",
|
||||||
&GopTransform::ctor
|
&GopTransform::ctor
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -35,7 +35,7 @@ TEST_CASE("boost dll")
|
|||||||
);
|
);
|
||||||
std::cout << "VAR: " << *cpp_var << "\n";
|
std::cout << "VAR: " << *cpp_var << "\n";
|
||||||
|
|
||||||
auto cpp11_func = boost::dll::import_symbol<void(void (*addOperator)(enzo::nt::opConstructor))>(
|
auto cpp11_func = boost::dll::import_symbol<void(enzo::op::addOperatorPtr)>(
|
||||||
"build/src/OpDefs/libenzoOps1.so", "newSopOperator"
|
"build/src/OpDefs/libenzoOps1.so", "newSopOperator"
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user