#include <Y2Function.h>
Public Member Functions | |
virtual | ~Y2Function () |
virtual bool | attachParameter (const YCPValue &arg, const int position)=0 |
virtual constTypePtr | wantedParameterType () const =0 |
virtual bool | appendParameter (const YCPValue &arg)=0 |
virtual bool | finishParameters ()=0 |
virtual YCPValue | evaluateCall ()=0 |
virtual bool | reset ()=0 |
virtual string | name () const =0 |
an example to call Popup::Message()
first, find out the component for the namespace Y2Component* impl = Y2ComponentBroker::provideNamespace ("Popup"); if (impl != 0) { let the component import the namespace Y2Namespace* ns = impl->import ("Popup");
if (ns != 0) { create a function call object for the function Y2Function* fnc = ns->createFunctionCall ("Message" , Type::fromSignature ("void (string)"));
if (fnc != 0) { pass the parameter for the function fnc->appendParameter (YCPString ("This is my test")); fnc->finishParameters ();
evaluate the call fnc->evaluateCall ();
function is not longer needed, free it delete fnc; } } }
virtual Y2Function::~Y2Function | ( | ) | [inline, virtual] |
Whithout this, can't delete YEFunction which is derived from YCode, Y2Function
virtual bool Y2Function::appendParameter | ( | const YCPValue & | arg | ) | [pure virtual] |
Appends a parameter to the call.
Implemented in Y2YCPFunction, Y2StdioFunction, and Y2SystemFunction.
Referenced by Y2SystemFunction::appendParameter().
virtual bool Y2Function::attachParameter | ( | const YCPValue & | arg, | |
const int | position | |||
) | [pure virtual] |
Attaches a parameter to a given position to the call.
Implemented in Y2YCPFunction, Y2StdioFunction, and Y2SystemFunction.
Referenced by Y2SystemFunction::attachParameter(), YEFunctionPointer::evaluate(), and YEFunction::evaluate().
virtual YCPValue Y2Function::evaluateCall | ( | ) | [pure virtual] |
Executes the call
Implemented in Y2YCPFunction, Y2StdioFunction, and Y2SystemFunction.
Referenced by YEFunctionPointer::evaluate(), YEFunction::evaluate(), Y2SystemFunction::evaluateCall(), and Y2Namespace::initialize().
virtual bool Y2Function::finishParameters | ( | ) | [pure virtual] |
Signal that we're done adding parameters.
Implemented in Y2YCPFunction, Y2StdioFunction, and Y2SystemFunction.
Referenced by Y2SystemFunction::finishParameters().
virtual string Y2Function::name | ( | ) | const [pure virtual] |
Implemented in Y2YCPFunction, Y2StdioFunction, and Y2SystemFunction.
Referenced by Y2SystemFunction::evaluateCall(), Y2SystemFunction::name(), Y2SystemFunction::useRemote(), and Y2SystemFunction::Y2SystemFunction().
virtual bool Y2Function::reset | ( | ) | [pure virtual] |
Reset the currecn parameters, so the instance can be reused for the next call (appendParameter etc)
Implemented in Y2YCPFunction, Y2StdioFunction, and Y2SystemFunction.
Referenced by YEFunctionPointer::evaluate(), YEFunction::evaluate(), and Y2SystemFunction::reset().
virtual constTypePtr Y2Function::wantedParameterType | ( | ) | const [pure virtual] |
What type is expected for the next appendParameter (val) ? (Used when calling from Perl, to be able to convert from the simple type system of Perl to the elaborate type system of YCP)
Implemented in Y2YCPFunction, Y2StdioFunction, and Y2SystemFunction.
Referenced by Y2SystemFunction::wantedParameterType().