|
|
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)
| DynamicRequest |
creates a dynamic request which will be sent to a specific object
| ~DynamicRequest ()
| ~DynamicRequest |
deletes the dynamic request
| DynamicRequest& oneway ()
| 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)
| method |
sets the method to invoke
| DynamicRequest& param (const AnyConstRef& value)
| param |
adds a parameter to the call
| bool invoke ()
| 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)
| invoke |
executes the request: this version accepts an AnyRef& as result type
Returns: true if the request could be performed
| Generated by: stefan on stefan on Sat Jun 2 23:13:28 2001, using kdoc 2.0a53. |