diff options
author | Ted Ross <tross@apache.org> | 2008-12-23 19:38:25 +0000 |
---|---|---|
committer | Ted Ross <tross@apache.org> | 2008-12-23 19:38:25 +0000 |
commit | 12d7d4125a42a7f0ab26a89c3c34e88135cf5869 (patch) | |
tree | 5970de22eb3027833688156a4116d71ef6b44442 /cpp/examples/qmf-console/console.cpp | |
parent | 912a6db37456524c60e1b7f3236de4dca3c77636 (diff) | |
download | qpid-python-12d7d4125a42a7f0ab26a89c3c34e88135cf5869.tar.gz |
QPID-1412 Updates and fixes for the c++ console API:
- Added event support
- Converted raw pointers to shared_ptrs in references to Values.
This fixes a memory leak in the original code.
- Added wrappers to make value access more convenient.
- Added timeout handling for synchronous operations.
Timeout values are configurable.
- Fixed a bug in getObjects whereby waitForStable was not called and
the operation could fail if called too early.
- Added examples "printevents" and "ping" to illustrate the usage of
different aspects of the API.
git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk/qpid@729075 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'cpp/examples/qmf-console/console.cpp')
-rw-r--r-- | cpp/examples/qmf-console/console.cpp | 16 |
1 files changed, 6 insertions, 10 deletions
diff --git a/cpp/examples/qmf-console/console.cpp b/cpp/examples/qmf-console/console.cpp index c98f1ace34..5700d5556f 100644 --- a/cpp/examples/qmf-console/console.cpp +++ b/cpp/examples/qmf-console/console.cpp @@ -21,17 +21,9 @@ #include "qpid/console/ConsoleListener.h" #include "qpid/console/SessionManager.h" -#include "qpid/console/Value.h" -#include <unistd.h> -#include <cstdlib> -#include <iostream> - -#include <sstream> using namespace std; using namespace qpid::console; -using std::cout; -using std::endl; class Listener : public ConsoleListener { public: @@ -68,6 +60,10 @@ public: void objectStats(Broker& broker, Object& object) { cout << "objectStats: broker=" << broker << " object=" << object << endl; } + + void event(Event& event) { + cout << "event: " << event << endl; + } }; @@ -127,8 +123,8 @@ int main_int(int /*argc*/, char** /*argv*/) Object::AttributeMap args; MethodResponse result; - args["sequence"] = new UintValue(1); - args["body"] = new StringValue("Testing..."); + args.addUint("sequence", 1); + args.addString("body", "Testing..."); cout << "Call echo method..." << endl; broker.invokeMethod("echo", args, result); |