Library: OSPPython
Package: OSPPython
Header: Poco/OSP/Python/PythonService.h
Python service for script execution
Direct Base Classes: Poco::OSP::Service
All Base Classes: Poco::OSP::Service, Poco::RefCountedObject
Member Functions: emptyArgs, exec, execute, executeStatement, isA, mainModule, type
Inherited Functions: duplicate, isA, referenceCount, release, type
RAII wrapper for Python's Global Interpreter Lock.
typedef Poco::AutoPtr < PythonService > Ptr;
PythonService(
BundleContext::Ptr pContext
);
Creates the PythonService.
virtual ~PythonService();
Destroys the PythonService.
static const std::vector < Poco::Any > & emptyArgs();
Returns default empty args
template < typename T > T exec(
const std::string & mod,
const std::string & func
);
Executes a python function from the given module, tries to convert the return type to the given data type. If you are not sure what type to expect use Poco::DynamicAny.
template < typename T, typename P1 > T exec(
const std::string & mod,
const std::string & func,
const P1 & param1
);
Executes a python function from the given module, tries to convert the return type to the given data type. If you are not sure what type to expect use Poco::DynamicAny.
template < typename T, typename P1, typename P2 > T exec(
const std::string & mod,
const std::string & func,
const P1 & p1,
const P2 & p2
);
Executes a python function from the given module, tries to convert the return type to the given data type. If you are not sure what type to expect use Poco::DynamicAny.
template < typename T, typename P1, typename P2, typename P3 > T exec(
const std::string & mod,
const std::string & func,
const P1 & p1,
const P2 & p2,
const P3 & p3
);
Executes a python function from the given module, tries to convert the return type to the given data type. If you are not sure what type to expect use Poco::DynamicAny.
template < typename T, typename P1, typename P2, typename P3, typename P4 > T exec(
const std::string & mod,
const std::string & func,
const P1 & p1,
const P2 & p2,
const P3 & p3,
const P4 & p4
);
Executes a python function from the given module, tries to convert the return type to the given data type. If you are not sure what type to expect use Poco::DynamicAny.
template < typename T, typename P1, typename P2, typename P3, typename P4, typename P5 > T exec(
const std::string & mod,
const std::string & func,
const P1 & p1,
const P2 & p2,
const P3 & p3,
const P4 & p4,
const P5 & p5
);
Executes a python function from the given module, tries to convert the return type to the given data type. If you are not sure what type to expect use Poco::DynamicAny.
template < typename T, typename P1, typename P2, typename P3, typename P4, typename P5, typename P6 > T exec(
const std::string & mod,
const std::string & func,
const P1 & p1,
const P2 & p2,
const P3 & p3,
const P4 & p4,
const P5 & p5,
const P6 & p6
);
Executes a python function from the given module, tries to convert the return type to the given data type. If you are not sure what type to expect use Poco::DynamicAny.
template < typename T > T execute(
const std::string & func
);
Executes a python function in the main module. The function takes no argument, tries to convert the return type to the given data type. If you are not sure what type to expect use Poco::DynamicAny.
template < typename T > T execute(
const std::string & mod,
const std::string & func
);
Executes a python function from the given module with empty arguments, tries to convert the return type to the given data type. If you are not sure what type to expect use Poco::DynamicAny.
template < typename T > T execute(
const std::string & func,
const std::vector < Poco::Any > & args
);
Calls a python function from the main module, tries to convert the return type to the given data type. If T is Poco::Any the any value will contain a string. If you are not sure what type to expect use Poco::DynamicAny.
template < typename T > T execute(
const std::string & mod,
const std::string & func,
const std::vector < Poco::Any > & args
);
Executes a python function from the given module, tries to convert the return type to the given data type. If you are not sure what type to expect use Poco::DynamicAny.
void execute(
const std::string & mod,
const std::string & func,
const std::vector < Poco::Any > & args = emptyArgs ()
);
Executes a python function from the given module. No return value.
void execute(
const std::string & func,
const std::vector < Poco::Any > & args = emptyArgs ()
);
Executes a python function from the main module. No return value.
void executeStatement(
const std::string & cmd
);
Executes a single statement in the main context. No return value
void executeStatement(
const std::string & mod,
const std::string & cmd
);
Executes a single statement in the given module context. No return value.
bool isA(
const std::type_info & otherType
) const;
See also: Poco::OSP::Service::isA()
static const std::string & mainModule();
Returns the mainmodule
const std::type_info & type() const;
See also: Poco::OSP::Service::type()
static const std::string SERVICE_NAME;