Poco::OSP::Python

class PythonService

Library: OSPPython
Package: OSPPython
Header: Poco/OSP/Python/PythonService.h

Description

Python service for script execution

Inheritance

Direct Base Classes: Poco::OSP::Service

All Base Classes: Poco::OSP::Service, Poco::RefCountedObject

Member Summary

Member Functions: emptyArgs, exec, execute, executeStatement, isA, mainModule, type

Inherited Functions: duplicate, isA, referenceCount, release, type

Nested Classes

class GIL

RAII wrapper for Python's Global Interpreter Lock. more...

Types

Ptr

typedef Poco::AutoPtr < PythonService > Ptr;

Constructors

PythonService

PythonService(
    BundleContext::Ptr pContext
);

Creates the PythonService.

Destructor

~PythonService virtual

virtual ~PythonService();

Destroys the PythonService.

Member Functions

emptyArgs static

static const std::vector < Poco::Any > & emptyArgs();

Returns default empty args

exec inline

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.

exec inline

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.

exec inline

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.

exec inline

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.

exec inline

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.

exec inline

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.

exec inline

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.

execute inline

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.

execute inline

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.

execute inline

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.

execute inline

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.

execute

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.

execute

void execute(
    const std::string & func,
    const std::vector < Poco::Any > & args = emptyArgs ()
);

Executes a python function from the main module. No return value.

executeStatement

void executeStatement(
    const std::string & cmd
);

Executes a single statement in the main context. No return value

executeStatement

void executeStatement(
    const std::string & mod,
    const std::string & cmd
);

Executes a single statement in the given module context. No return value.

isA virtual

bool isA(
    const std::type_info & otherType
) const;

See also: Poco::OSP::Service::isA()

mainModule static

static const std::string & mainModule();

Returns the mainmodule

type virtual

const std::type_info & type() const;

See also: Poco::OSP::Service::type()

Variables

SERVICE_NAME static

static const std::string SERVICE_NAME;