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/src/qpid/console/Value.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/src/qpid/console/Value.cpp')
-rw-r--r-- | cpp/src/qpid/console/Value.cpp | 42 |
1 files changed, 21 insertions, 21 deletions
diff --git a/cpp/src/qpid/console/Value.cpp b/cpp/src/qpid/console/Value.cpp index 3ef5d01ec3..532709ab05 100644 --- a/cpp/src/qpid/console/Value.cpp +++ b/cpp/src/qpid/console/Value.cpp @@ -117,33 +117,33 @@ MapValue::MapValue(framing::Buffer& buffer) } -Value* ValueFactory::newValue(int typeCode, framing::Buffer& buffer) +Value::Ptr ValueFactory::newValue(int typeCode, framing::Buffer& buffer) { switch (typeCode) { - case 1: return static_cast<Value*>(new UintValue(buffer.getOctet())); // U8 - case 2: return static_cast<Value*>(new UintValue(buffer.getShort())); // U16 - case 3: return static_cast<Value*>(new UintValue(buffer.getLong())); // U32 - case 4: return static_cast<Value*>(new Uint64Value(buffer.getLongLong())); // U64 - case 6: return static_cast<Value*>(new StringValue(buffer, 6)); // SSTR - case 7: return static_cast<Value*>(new StringValue(buffer, 7)); // LSTR - case 8: return static_cast<Value*>(new Int64Value(buffer.getLongLong())); // ABSTIME - case 9: return static_cast<Value*>(new Uint64Value(buffer.getLongLong())); // DELTATIME - case 10: return static_cast<Value*>(new RefValue(buffer)); // REF - case 11: return static_cast<Value*>(new BoolValue(buffer.getOctet())); // BOOL - case 12: return static_cast<Value*>(new FloatValue(buffer.getFloat())); // FLOAT - case 13: return static_cast<Value*>(new DoubleValue(buffer.getDouble())); // DOUBLE - case 14: return static_cast<Value*>(new UuidValue(buffer)); // UUID - case 15: return static_cast<Value*>(new MapValue(buffer)); // MAP - case 16: return static_cast<Value*>(new IntValue(buffer.getOctet())); // S8 - case 17: return static_cast<Value*>(new IntValue(buffer.getShort())); // S16 - case 18: return static_cast<Value*>(new IntValue(buffer.getLong())); // S32 - case 19: return static_cast<Value*>(new Int64Value(buffer.getLongLong())); // S64 + case 1: return Value::Ptr(new UintValue(buffer.getOctet())); // U8 + case 2: return Value::Ptr(new UintValue(buffer.getShort())); // U16 + case 3: return Value::Ptr(new UintValue(buffer.getLong())); // U32 + case 4: return Value::Ptr(new Uint64Value(buffer.getLongLong())); // U64 + case 6: return Value::Ptr(new StringValue(buffer, 6)); // SSTR + case 7: return Value::Ptr(new StringValue(buffer, 7)); // LSTR + case 8: return Value::Ptr(new Int64Value(buffer.getLongLong())); // ABSTIME + case 9: return Value::Ptr(new Uint64Value(buffer.getLongLong())); // DELTATIME + case 10: return Value::Ptr(new RefValue(buffer)); // REF + case 11: return Value::Ptr(new BoolValue(buffer.getOctet())); // BOOL + case 12: return Value::Ptr(new FloatValue(buffer.getFloat())); // FLOAT + case 13: return Value::Ptr(new DoubleValue(buffer.getDouble())); // DOUBLE + case 14: return Value::Ptr(new UuidValue(buffer)); // UUID + case 15: return Value::Ptr(new MapValue(buffer)); // MAP + case 16: return Value::Ptr(new IntValue(buffer.getOctet())); // S8 + case 17: return Value::Ptr(new IntValue(buffer.getShort())); // S16 + case 18: return Value::Ptr(new IntValue(buffer.getLong())); // S32 + case 19: return Value::Ptr(new Int64Value(buffer.getLongLong())); // S64 } - return 0; + return Value::Ptr(); } -void ValueFactory::encodeValue(int typeCode, Value* value, framing::Buffer& buffer) +void ValueFactory::encodeValue(int typeCode, Value::Ptr value, framing::Buffer& buffer) { switch (typeCode) { case 1: buffer.putOctet(value->asUint()); return; // U8 |