class DynamicRequest

The DynamicRequest class can be used to invoke requests on objects, without using IDL generated code to do so (i. More...

Full nameArts::DynamicRequest
Definition#include <arts/dynamicrequest.h>
List of all Methods
Annotated List
Files
Globals
Hierarchy
Index

Public Methods


Detailed Description

The DynamicRequest class can be used to invoke requests on objects, without using IDL generated code to do so (i.e. you can talk to objects without having to know their interfaces at compile time)

Suppose you have the interface

interface SimpleSoundServer { [...] long play(string file); // plays a file and returns an id [...] };

And server is of type SimpleSoundServer, you can write in your C++ code:

long id; if(DynamicRequest(server).method("play").param("/tmp/bong.wav").invoke(id)) { cout << "playing file now, id is " << id << endl; } else { cout << "something went wrong with the dynamic request" << endl; }

You can of course also add parameters and other information one-by-one:

DynamicRequest request(server); request.method("play"); request.param("/tmp/bong.wav");

long id; if(request.invoke(id)) cout << "success" << endl;

 DynamicRequest (const Object& object)

creates a dynamic request which will be sent to a specific object

 ~DynamicRequest ()

deletes the dynamic request

DynamicRequest&  oneway ()

says that the following method will be a oneway method, for example

DynamicRequest(someobject).oneway().method("stop").invoke();

DynamicRequest&  method (const std::string& method)

sets the method to invoke

DynamicRequest&  param (const AnyConstRef& value)

adds a parameter to the call

bool  invoke ()

executes the request, call this if you don't expect a return type

Returns: true if the request could be performed

bool  invoke (const AnyRef& result)

executes the request: this version accepts an AnyRef& as result type

Returns: true if the request could be performed


Generated by: stefan@stefan on Sat Feb 24 19:11:23 2001, using kdoc 2.0a47.