You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@qpid.apache.org by tr...@apache.org on 2009/09/18 22:15:16 UTC
svn commit: r816770 [1/2] - in /qpid/trunk/qpid/cpp: bindings/qmf/ruby/
bindings/qmf/tests/ include/qmf/ src/qmf/
Author: tross
Date: Fri Sep 18 20:15:15 2009
New Revision: 816770
URL: http://svn.apache.org/viewvc?rev=816770&view=rev
Log:
Refactored the QMF engine to adhere to the following rules regarding
the pimpl (Pointer to Implementation) pattern:
1) Impl classes have constructors matching the public constructors
2) Additional Impl constructors are accessed through a static factory function
3) All linkages to objects are to the public object
4) If a back-link (from Impl to public) is needed, the Impl class must be
derived from boost::noncopyable
5) All public classes have non-default copy constructors that make a copy of the
Impl class
Modified:
qpid/trunk/qpid/cpp/bindings/qmf/ruby/qmf.rb
qpid/trunk/qpid/cpp/bindings/qmf/tests/ruby_console.rb
qpid/trunk/qpid/cpp/include/qmf/ConnectionSettings.h
qpid/trunk/qpid/cpp/src/qmf/AgentEngine.cpp
qpid/trunk/qpid/cpp/src/qmf/AgentEngine.h
qpid/trunk/qpid/cpp/src/qmf/BrokerProxyImpl.cpp
qpid/trunk/qpid/cpp/src/qmf/BrokerProxyImpl.h
qpid/trunk/qpid/cpp/src/qmf/ConnectionSettingsImpl.cpp
qpid/trunk/qpid/cpp/src/qmf/ConnectionSettingsImpl.h
qpid/trunk/qpid/cpp/src/qmf/ConsoleEngine.h
qpid/trunk/qpid/cpp/src/qmf/ConsoleEngineImpl.cpp
qpid/trunk/qpid/cpp/src/qmf/ConsoleEngineImpl.h
qpid/trunk/qpid/cpp/src/qmf/Object.h
qpid/trunk/qpid/cpp/src/qmf/ObjectId.h
qpid/trunk/qpid/cpp/src/qmf/ObjectIdImpl.cpp
qpid/trunk/qpid/cpp/src/qmf/ObjectIdImpl.h
qpid/trunk/qpid/cpp/src/qmf/ObjectImpl.cpp
qpid/trunk/qpid/cpp/src/qmf/ObjectImpl.h
qpid/trunk/qpid/cpp/src/qmf/Query.h
qpid/trunk/qpid/cpp/src/qmf/QueryImpl.cpp
qpid/trunk/qpid/cpp/src/qmf/QueryImpl.h
qpid/trunk/qpid/cpp/src/qmf/ResilientConnection.cpp
qpid/trunk/qpid/cpp/src/qmf/Schema.h
qpid/trunk/qpid/cpp/src/qmf/SchemaImpl.cpp
qpid/trunk/qpid/cpp/src/qmf/SchemaImpl.h
qpid/trunk/qpid/cpp/src/qmf/Value.h
qpid/trunk/qpid/cpp/src/qmf/ValueImpl.cpp
qpid/trunk/qpid/cpp/src/qmf/ValueImpl.h
Modified: qpid/trunk/qpid/cpp/bindings/qmf/ruby/qmf.rb
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/cpp/bindings/qmf/ruby/qmf.rb?rev=816770&r1=816769&r2=816770&view=diff
==============================================================================
--- qpid/trunk/qpid/cpp/bindings/qmf/ruby/qmf.rb (original)
+++ qpid/trunk/qpid/cpp/bindings/qmf/ruby/qmf.rb Fri Sep 18 20:15:15 2009
@@ -512,9 +512,7 @@
class MethodResponse
def initialize(impl)
- puts "start copying..."
@impl = Qmfengine::MethodResponse.new(impl)
- puts "done copying..."
end
def status
@@ -896,7 +894,6 @@
valid = @impl.getEvent(@event)
while valid
count += 1
- puts "Console Event: #{@event.kind}"
case @event.kind
when Qmfengine::ConsoleEvent::AGENT_ADDED
when Qmfengine::ConsoleEvent::AGENT_DELETED
@@ -977,7 +974,6 @@
valid = @impl.getEvent(@event)
while valid
count += 1
- puts "Broker Event: #{@event.kind}"
case @event.kind
when Qmfengine::BrokerEvent::BROKER_INFO
when Qmfengine::BrokerEvent::DECLARE_QUEUE
Modified: qpid/trunk/qpid/cpp/bindings/qmf/tests/ruby_console.rb
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/cpp/bindings/qmf/tests/ruby_console.rb?rev=816770&r1=816769&r2=816770&view=diff
==============================================================================
--- qpid/trunk/qpid/cpp/bindings/qmf/tests/ruby_console.rb (original)
+++ qpid/trunk/qpid/cpp/bindings/qmf/tests/ruby_console.rb Fri Sep 18 20:15:15 2009
@@ -100,7 +100,7 @@
puts " port : #{b.port}"
puts " uptime : #{b.uptime / 1000000000}"
- for rep in 0...0
+ for rep in 0...1
puts " Pinging..."
ret = b.echo(45, 'text string')
puts " ret=#{ret}"
Modified: qpid/trunk/qpid/cpp/include/qmf/ConnectionSettings.h
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/cpp/include/qmf/ConnectionSettings.h?rev=816770&r1=816769&r2=816770&view=diff
==============================================================================
--- qpid/trunk/qpid/cpp/include/qmf/ConnectionSettings.h (original)
+++ qpid/trunk/qpid/cpp/include/qmf/ConnectionSettings.h Fri Sep 18 20:15:15 2009
@@ -36,8 +36,6 @@
class ConnectionSettings {
public:
- ConnectionSettings(const ConnectionSettings& copy);
-
/**
* Create a set of default connection settings.
*
@@ -64,6 +62,11 @@
QMF_EXTERN ConnectionSettings(const char* url);
/**
+ * Copy Constructor.
+ */
+ ConnectionSettings(const ConnectionSettings& from);
+
+ /**
* Destroy the connection settings object.
*/
QMF_EXTERN ~ConnectionSettings();
Modified: qpid/trunk/qpid/cpp/src/qmf/AgentEngine.cpp
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/cpp/src/qmf/AgentEngine.cpp?rev=816770&r1=816769&r2=816770&view=diff
==============================================================================
--- qpid/trunk/qpid/cpp/src/qmf/AgentEngine.cpp (original)
+++ qpid/trunk/qpid/cpp/src/qmf/AgentEngine.cpp Fri Sep 18 20:15:15 2009
@@ -40,6 +40,7 @@
#include <iostream>
#include <fstream>
#include <boost/shared_ptr.hpp>
+#include <boost/noncopyable.hpp>
using namespace std;
using namespace qmf;
@@ -61,7 +62,7 @@
boost::shared_ptr<Value> arguments;
string exchange;
string bindingKey;
- SchemaObjectClass* objectClass;
+ const SchemaObjectClass* objectClass;
AgentEventImpl(AgentEvent::EventKind k) :
kind(k), sequence(0), object(0), objectClass(0) {}
@@ -74,11 +75,11 @@
uint32_t sequence;
string exchange;
string key;
- SchemaMethodImpl* schemaMethod;
+ const SchemaMethod* schemaMethod;
AgentQueryContext() : schemaMethod(0) {}
};
- class AgentEngineImpl {
+ class AgentEngineImpl : public boost::noncopyable {
public:
AgentEngineImpl(char* label, bool internalStore);
~AgentEngineImpl();
@@ -163,8 +164,8 @@
}
};
- typedef map<AgentClassKey, SchemaObjectClassImpl*, AgentClassKeyComp> ObjectClassMap;
- typedef map<AgentClassKey, SchemaEventClassImpl*, AgentClassKeyComp> EventClassMap;
+ typedef map<AgentClassKey, SchemaObjectClass*, AgentClassKeyComp> ObjectClassMap;
+ typedef map<AgentClassKey, SchemaEventClass*, AgentClassKeyComp> EventClassMap;
struct ClassMaps {
ObjectClassMap objectClasses;
@@ -180,7 +181,7 @@
boost::shared_ptr<ObjectId> oid);
AgentEventImpl::Ptr eventMethod(uint32_t num, const string& userId, const string& method,
boost::shared_ptr<ObjectId> oid, boost::shared_ptr<Value> argMap,
- SchemaObjectClass* objectClass);
+ const SchemaObjectClass* objectClass);
void sendBufferLH(Buffer& buf, const string& destination, const string& routingKey);
void sendPackageIndicationLH(const string& packageName);
@@ -366,15 +367,15 @@
buffer.putLong(status);
buffer.putMediumString(text);
if (status == 0) {
- for (vector<SchemaArgumentImpl*>::const_iterator aIter = context->schemaMethod->arguments.begin();
- aIter != context->schemaMethod->arguments.end(); aIter++) {
- const SchemaArgumentImpl* schemaArg = *aIter;
- if (schemaArg->dir == DIR_OUT || schemaArg->dir == DIR_IN_OUT) {
- if (argMap.keyInMap(schemaArg->name.c_str())) {
- const Value* val = argMap.byKey(schemaArg->name.c_str());
+ for (vector<const SchemaArgument*>::const_iterator aIter = context->schemaMethod->impl->arguments.begin();
+ aIter != context->schemaMethod->impl->arguments.end(); aIter++) {
+ const SchemaArgument* schemaArg = *aIter;
+ if (schemaArg->getDirection() == DIR_OUT || schemaArg->getDirection() == DIR_IN_OUT) {
+ if (argMap.keyInMap(schemaArg->getName())) {
+ const Value* val = argMap.byKey(schemaArg->getName());
val->impl->encode(buffer);
} else {
- Value val(schemaArg->typecode);
+ Value val(schemaArg->getType());
val.impl->encode(buffer);
}
}
@@ -421,17 +422,16 @@
void AgentEngineImpl::registerClass(SchemaObjectClass* cls)
{
Mutex::ScopedLock _lock(lock);
- SchemaObjectClassImpl* impl = cls->impl;
- map<string, ClassMaps>::iterator iter = packages.find(impl->package);
+ map<string, ClassMaps>::iterator iter = packages.find(cls->getClassKey()->getPackageName());
if (iter == packages.end()) {
- packages[impl->package] = ClassMaps();
- iter = packages.find(impl->getClassKey()->getPackageName());
+ packages[cls->getClassKey()->getPackageName()] = ClassMaps();
+ iter = packages.find(cls->getClassKey()->getPackageName());
// TODO: Indicate this package if connected
}
- AgentClassKey key(impl->getClassKey()->getClassName(), impl->getClassKey()->getHash());
- iter->second.objectClasses[key] = impl;
+ AgentClassKey key(cls->getClassKey()->getClassName(), cls->getClassKey()->getHash());
+ iter->second.objectClasses[key] = cls;
// TODO: Indicate this schema if connected.
}
@@ -439,17 +439,16 @@
void AgentEngineImpl::registerClass(SchemaEventClass* cls)
{
Mutex::ScopedLock _lock(lock);
- SchemaEventClassImpl* impl = cls->impl;
- map<string, ClassMaps>::iterator iter = packages.find(impl->package);
+ map<string, ClassMaps>::iterator iter = packages.find(cls->getClassKey()->getPackageName());
if (iter == packages.end()) {
- packages[impl->package] = ClassMaps();
- iter = packages.find(impl->getClassKey()->getPackageName());
+ packages[cls->getClassKey()->getPackageName()] = ClassMaps();
+ iter = packages.find(cls->getClassKey()->getPackageName());
// TODO: Indicate this package if connected
}
- AgentClassKey key(impl->getClassKey()->getClassName(), impl->getClassKey()->getHash());
- iter->second.eventClasses[key] = impl;
+ AgentClassKey key(cls->getClassKey()->getClassName(), cls->getClassKey()->getHash());
+ iter->second.eventClasses[key] = cls;
// TODO: Indicate this schema if connected.
}
@@ -466,8 +465,8 @@
uint16_t sequence = persistId ? 0 : bootSequence;
uint64_t objectNum = persistId ? persistId : nextObjectId++;
- ObjectIdImpl* oid = new ObjectIdImpl(&attachment, 0, sequence, objectNum);
- return oid->envelope;
+ ObjectId* oid = ObjectIdImpl::factory(&attachment, 0, sequence, objectNum);
+ return oid;
}
const ObjectId* AgentEngineImpl::allocObjectId(uint32_t persistIdLo, uint32_t persistIdHi)
@@ -520,7 +519,7 @@
AgentEventImpl::Ptr AgentEngineImpl::eventMethod(uint32_t num, const string& userId, const string& method,
boost::shared_ptr<ObjectId> oid, boost::shared_ptr<Value> argMap,
- SchemaObjectClass* objectClass)
+ const SchemaObjectClass* objectClass)
{
AgentEventImpl::Ptr event(new AgentEventImpl(AgentEvent::METHOD_CALL));
event->sequence = num;
@@ -688,10 +687,10 @@
ClassMaps cMap = pIter->second;
ObjectClassMap::iterator ocIter = cMap.objectClasses.find(key);
if (ocIter != cMap.objectClasses.end()) {
- SchemaObjectClassImpl* oImpl = ocIter->second;
+ SchemaObjectClass* oImpl = ocIter->second;
Buffer buffer(outputBuffer, MA_BUFFER_SIZE);
Protocol::encodeHeader(buffer, Protocol::OP_SCHEMA_RESPONSE, sequence);
- oImpl->encode(buffer);
+ oImpl->impl->encode(buffer);
sendBufferLH(buffer, rExchange, rKey);
QPID_LOG(trace, "SENT SchemaResponse: (object) package=" << packageName << " class=" << key.name);
return;
@@ -699,10 +698,10 @@
EventClassMap::iterator ecIter = cMap.eventClasses.find(key);
if (ecIter != cMap.eventClasses.end()) {
- SchemaEventClassImpl* eImpl = ecIter->second;
+ SchemaEventClass* eImpl = ecIter->second;
Buffer buffer(outputBuffer, MA_BUFFER_SIZE);
Protocol::encodeHeader(buffer, Protocol::OP_SCHEMA_RESPONSE, sequence);
- eImpl->encode(buffer);
+ eImpl->impl->encode(buffer);
sendBufferLH(buffer, rExchange, rKey);
QPID_LOG(trace, "SENT SchemaResponse: (event) package=" << packageName << " class=" << key.name);
return;
@@ -768,8 +767,7 @@
Mutex::ScopedLock _lock(lock);
string pname;
string method;
- ObjectIdImpl* oidImpl = new ObjectIdImpl(buffer);
- boost::shared_ptr<ObjectId> oid(oidImpl->envelope);
+ boost::shared_ptr<ObjectId> oid(ObjectIdImpl::factory(buffer));
buffer.getShortString(pname);
AgentClassKey classKey(buffer);
buffer.getShortString(method);
@@ -788,29 +786,29 @@
return;
}
- const SchemaObjectClassImpl* schema = cIter->second;
- vector<SchemaMethodImpl*>::const_iterator mIter = schema->methods.begin();
- for (; mIter != schema->methods.end(); mIter++) {
- if ((*mIter)->name == method)
+ const SchemaObjectClass* schema = cIter->second;
+ vector<const SchemaMethod*>::const_iterator mIter = schema->impl->methods.begin();
+ for (; mIter != schema->impl->methods.end(); mIter++) {
+ if ((*mIter)->getName() == method)
break;
}
- if (mIter == schema->methods.end()) {
+ if (mIter == schema->impl->methods.end()) {
sendMethodErrorLH(sequence, replyTo, MERR_UNKNOWN_METHOD, method);
return;
}
- SchemaMethodImpl* schemaMethod = *mIter;
+ const SchemaMethod* schemaMethod = *mIter;
boost::shared_ptr<Value> argMap(new Value(TYPE_MAP));
- ValueImpl* value;
- for (vector<SchemaArgumentImpl*>::const_iterator aIter = schemaMethod->arguments.begin();
- aIter != schemaMethod->arguments.end(); aIter++) {
- const SchemaArgumentImpl* schemaArg = *aIter;
- if (schemaArg->dir == DIR_IN || schemaArg->dir == DIR_IN_OUT)
- value = new ValueImpl(schemaArg->typecode, buffer);
+ Value* value;
+ for (vector<const SchemaArgument*>::const_iterator aIter = schemaMethod->impl->arguments.begin();
+ aIter != schemaMethod->impl->arguments.end(); aIter++) {
+ const SchemaArgument* schemaArg = *aIter;
+ if (schemaArg->getDirection() == DIR_IN || schemaArg->getDirection() == DIR_IN_OUT)
+ value = ValueImpl::factory(schemaArg->getType(), buffer);
else
- value = new ValueImpl(schemaArg->typecode);
- argMap->insert(schemaArg->name.c_str(), value->envelope);
+ value = ValueImpl::factory(schemaArg->getType());
+ argMap->insert(schemaArg->getName(), value);
}
AgentQueryContext::Ptr context(new AgentQueryContext);
@@ -821,7 +819,7 @@
context->schemaMethod = schemaMethod;
contextMap[contextNum] = context;
- eventQueue.push_back(eventMethod(contextNum, userId, method, oid, argMap, schema->envelope));
+ eventQueue.push_back(eventMethod(contextNum, userId, method, oid, argMap, schema));
}
void AgentEngineImpl::handleConsoleAddedIndication()
Modified: qpid/trunk/qpid/cpp/src/qmf/AgentEngine.h
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/cpp/src/qmf/AgentEngine.h?rev=816770&r1=816769&r2=816770&view=diff
==============================================================================
--- qpid/trunk/qpid/cpp/src/qmf/AgentEngine.h (original)
+++ qpid/trunk/qpid/cpp/src/qmf/AgentEngine.h Fri Sep 18 20:15:15 2009
@@ -61,7 +61,7 @@
Value* arguments; // Method parameters (METHOD_CALL)
char* exchange; // Exchange for bind (BIND, UNBIND)
char* bindingKey; // Key for bind (BIND, UNBIND)
- SchemaObjectClass* objectClass; // (METHOD_CALL)
+ const SchemaObjectClass* objectClass; // (METHOD_CALL)
};
class AgentEngineImpl;
Modified: qpid/trunk/qpid/cpp/src/qmf/BrokerProxyImpl.cpp
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/cpp/src/qmf/BrokerProxyImpl.cpp?rev=816770&r1=816769&r2=816770&view=diff
==============================================================================
--- qpid/trunk/qpid/cpp/src/qmf/BrokerProxyImpl.cpp (original)
+++ qpid/trunk/qpid/cpp/src/qmf/BrokerProxyImpl.cpp Fri Sep 18 20:15:15 2009
@@ -43,7 +43,7 @@
const Object* QueryResponseImpl::getObject(uint32_t idx) const
{
- vector<ObjectImpl::Ptr>::const_iterator iter = results.begin();
+ vector<ObjectPtr>::const_iterator iter = results.begin();
while (idx > 0) {
if (iter == results.end())
@@ -52,7 +52,7 @@
idx--;
}
- return (*iter)->envelope;
+ return iter->get();
}
#define STRING_REF(s) {if (!s.empty()) item.s = const_cast<char*>(s.c_str());}
@@ -68,14 +68,13 @@
STRING_REF(exchange);
STRING_REF(bindingKey);
item.context = context;
- item.queryResponse = queryResponse.get() ? queryResponse->envelope : 0;
- item.methodResponse = methodResponse.get() ? methodResponse->envelope : 0;
+ item.queryResponse = queryResponse.get();
+ item.methodResponse = methodResponse.get();
return item;
}
-BrokerProxyImpl::BrokerProxyImpl(BrokerProxy* e, ConsoleEngine& _console) :
- envelope(e), console(_console.impl)
+BrokerProxyImpl::BrokerProxyImpl(BrokerProxy& pub, ConsoleEngine& _console) : publicObject(pub), console(_console)
{
stringstream qn;
qpid::TcpAddress addr;
@@ -114,7 +113,7 @@
char rawbuffer[512];
Buffer buffer(rawbuffer, 512);
- agentList.push_back(AgentProxyImpl::Ptr(new AgentProxyImpl(console, this, 0, "Agent embedded in broker")));
+ agentList.push_back(AgentProxyPtr(AgentProxyImpl::factory(console, publicObject, 0, "Agent embedded in broker")));
requestsOutstanding = 1;
topicBound = false;
@@ -190,10 +189,10 @@
const AgentProxy* BrokerProxyImpl::getAgent(uint32_t idx) const
{
Mutex::ScopedLock _lock(lock);
- for (vector<AgentProxyImpl::Ptr>::const_iterator iter = agentList.begin();
+ for (vector<AgentProxyPtr>::const_iterator iter = agentList.begin();
iter != agentList.end(); iter++)
if (idx-- == 0)
- return (*iter)->envelope;
+ return iter->get();
return 0;
}
@@ -202,17 +201,17 @@
SequenceContext::Ptr queryContext(new QueryContext(*this, context));
Mutex::ScopedLock _lock(lock);
if (agent != 0) {
- sendGetRequestLH(queryContext, query, agent->impl);
+ sendGetRequestLH(queryContext, query, agent);
} else {
// TODO (optimization) only send queries to agents that have the requested class+package
- for (vector<AgentProxyImpl::Ptr>::const_iterator iter = agentList.begin();
+ for (vector<AgentProxyPtr>::const_iterator iter = agentList.begin();
iter != agentList.end(); iter++) {
sendGetRequestLH(queryContext, query, (*iter).get());
}
}
}
-void BrokerProxyImpl::sendGetRequestLH(SequenceContext::Ptr queryContext, const Query& query, const AgentProxyImpl* agent)
+void BrokerProxyImpl::sendGetRequestLH(SequenceContext::Ptr queryContext, const Query& query, const AgentProxy* agent)
{
stringstream key;
Buffer outBuffer(outputBuffer, MA_BUFFER_SIZE);
@@ -220,7 +219,7 @@
Protocol::encodeHeader(outBuffer, Protocol::OP_GET_QUERY, sequence);
query.impl->encode(outBuffer);
- key << "agent.1." << agent->agentBank;
+ key << "agent.1." << agent->impl->agentBank;
sendBufferLH(outBuffer, QMF_EXCHANGE, key.str());
QPID_LOG(trace, "SENT GetQuery seq=" << sequence << " key=" << key.str());
}
@@ -250,7 +249,7 @@
return string();
}
-void BrokerProxyImpl::sendMethodRequest(ObjectIdImpl* oid, const SchemaObjectClass* cls,
+void BrokerProxyImpl::sendMethodRequest(ObjectId* oid, const SchemaObjectClass* cls,
const string& methodName, const Value* args, void* userContext)
{
int methodCount = cls->getMethodCount();
@@ -259,30 +258,30 @@
const SchemaMethod* method = cls->getMethod(idx);
if (string(method->getName()) == methodName) {
Mutex::ScopedLock _lock(lock);
- SequenceContext::Ptr methodContext(new MethodContext(*this, userContext, method->impl));
+ SequenceContext::Ptr methodContext(new MethodContext(*this, userContext, method));
stringstream key;
Buffer outBuffer(outputBuffer, MA_BUFFER_SIZE);
uint32_t sequence(seqMgr.reserve(methodContext));
Protocol::encodeHeader(outBuffer, Protocol::OP_METHOD_REQUEST, sequence);
- oid->encode(outBuffer);
+ oid->impl->encode(outBuffer);
cls->getClassKey()->impl->encode(outBuffer);
outBuffer.putShortString(methodName);
string argErrorString = encodeMethodArguments(method, args, outBuffer);
if (argErrorString.empty()) {
- key << "agent.1." << oid->getAgentBank();
+ key << "agent.1." << oid->impl->getAgentBank();
sendBufferLH(outBuffer, QMF_EXCHANGE, key.str());
QPID_LOG(trace, "SENT MethodRequest seq=" << sequence << " method=" << methodName << " key=" << key.str());
} else {
- MethodResponseImpl::Ptr argError(new MethodResponseImpl(1, argErrorString));
+ MethodResponsePtr argError(MethodResponseImpl::factory(1, argErrorString));
eventQueue.push_back(eventMethodResponse(userContext, argError));
}
return;
}
}
- MethodResponseImpl::Ptr error(new MethodResponseImpl(1, string("Unknown method: ") + methodName));
+ MethodResponsePtr error(MethodResponseImpl::factory(1, string("Unknown method: ") + methodName));
Mutex::ScopedLock _lock(lock);
eventQueue.push_back(eventMethodResponse(userContext, error));
}
@@ -322,7 +321,7 @@
return event;
}
-BrokerEventImpl::Ptr BrokerProxyImpl::eventQueryComplete(void* context, QueryResponseImpl::Ptr response)
+BrokerEventImpl::Ptr BrokerProxyImpl::eventQueryComplete(void* context, QueryResponsePtr response)
{
BrokerEventImpl::Ptr event(new BrokerEventImpl(BrokerEvent::QUERY_COMPLETE));
event->context = context;
@@ -330,7 +329,7 @@
return event;
}
-BrokerEventImpl::Ptr BrokerProxyImpl::eventMethodResponse(void* context, MethodResponseImpl::Ptr response)
+BrokerEventImpl::Ptr BrokerProxyImpl::eventMethodResponse(void* context, MethodResponsePtr response)
{
BrokerEventImpl::Ptr event(new BrokerEventImpl(BrokerEvent::METHOD_RESPONSE));
event->context = context;
@@ -357,7 +356,7 @@
inBuffer.getShortString(package);
QPID_LOG(trace, "RCVD PackageIndication seq=" << seq << " package=" << package);
- console->learnPackage(package);
+ console.impl->learnPackage(package);
Mutex::ScopedLock _lock(lock);
Buffer outBuffer(outputBuffer, MA_BUFFER_SIZE);
@@ -380,25 +379,25 @@
void BrokerProxyImpl::handleClassIndication(Buffer& inBuffer, uint32_t seq)
{
uint8_t kind = inBuffer.getOctet();
- SchemaClassKeyImpl classKey(inBuffer);
+ auto_ptr<SchemaClassKey> classKey(SchemaClassKeyImpl::factory(inBuffer));
- QPID_LOG(trace, "RCVD ClassIndication seq=" << seq << " kind=" << (int) kind << " key=" << classKey.str());
+ QPID_LOG(trace, "RCVD ClassIndication seq=" << seq << " kind=" << (int) kind << " key=" << classKey->impl->str());
- if (!console->haveClass(classKey)) {
+ if (!console.impl->haveClass(classKey.get())) {
Mutex::ScopedLock _lock(lock);
incOutstandingLH();
Buffer outBuffer(outputBuffer, MA_BUFFER_SIZE);
uint32_t sequence(seqMgr.reserve());
Protocol::encodeHeader(outBuffer, Protocol::OP_SCHEMA_REQUEST, sequence);
- classKey.encode(outBuffer);
+ classKey->impl->encode(outBuffer);
sendBufferLH(outBuffer, QMF_EXCHANGE, BROKER_KEY);
- QPID_LOG(trace, "SENT SchemaRequest seq=" << sequence <<" key=" << classKey.str());
+ QPID_LOG(trace, "SENT SchemaRequest seq=" << sequence <<" key=" << classKey->impl->str());
}
}
-MethodResponseImpl::Ptr BrokerProxyImpl::handleMethodResponse(Buffer& inBuffer, uint32_t seq, SchemaMethodImpl* schema)
+MethodResponsePtr BrokerProxyImpl::handleMethodResponse(Buffer& inBuffer, uint32_t seq, const SchemaMethod* schema)
{
- MethodResponseImpl::Ptr response(new MethodResponseImpl(inBuffer, schema));
+ MethodResponsePtr response(MethodResponseImpl::factory(inBuffer, schema));
QPID_LOG(trace, "RCVD MethodResponse seq=" << seq << " status=" << response->getStatus() << " text=" <<
response->getException()->asString());
@@ -418,15 +417,15 @@
void BrokerProxyImpl::handleSchemaResponse(Buffer& inBuffer, uint32_t seq)
{
- SchemaObjectClassImpl::Ptr oClassPtr;
- SchemaEventClassImpl::Ptr eClassPtr;
+ SchemaObjectClass* oClassPtr;
+ SchemaEventClass* eClassPtr;
uint8_t kind = inBuffer.getOctet();
- const SchemaClassKeyImpl* key;
+ const SchemaClassKey* key;
if (kind == CLASS_OBJECT) {
- oClassPtr.reset(new SchemaObjectClassImpl(inBuffer));
- console->learnClass(oClassPtr);
- key = oClassPtr->getClassKey()->impl;
- QPID_LOG(trace, "RCVD SchemaResponse seq=" << seq << " kind=object key=" << key->str());
+ oClassPtr = SchemaObjectClassImpl::factory(inBuffer);
+ console.impl->learnClass(oClassPtr);
+ key = oClassPtr->getClassKey();
+ QPID_LOG(trace, "RCVD SchemaResponse seq=" << seq << " kind=object key=" << key->impl->str());
//
// If we have just learned about the org.apache.qpid.broker:agent class, send a get
@@ -447,28 +446,28 @@
QPID_LOG(trace, "SENT GetQuery seq=" << sequence << " key=" << BROKER_AGENT_KEY);
}
} else if (kind == CLASS_EVENT) {
- eClassPtr.reset(new SchemaEventClassImpl(inBuffer));
- console->learnClass(eClassPtr);
- key = eClassPtr->getClassKey()->impl;
- QPID_LOG(trace, "RCVD SchemaResponse seq=" << seq << " kind=event key=" << key->str());
+ eClassPtr = SchemaEventClassImpl::factory(inBuffer);
+ console.impl->learnClass(eClassPtr);
+ key = eClassPtr->getClassKey();
+ QPID_LOG(trace, "RCVD SchemaResponse seq=" << seq << " kind=event key=" << key->impl->str());
}
else {
QPID_LOG(error, "BrokerProxyImpl::handleSchemaResponse received unknown class kind: " << (int) kind);
}
}
-ObjectImpl::Ptr BrokerProxyImpl::handleObjectIndication(Buffer& inBuffer, uint32_t seq, bool prop, bool stat)
+ObjectPtr BrokerProxyImpl::handleObjectIndication(Buffer& inBuffer, uint32_t seq, bool prop, bool stat)
{
- SchemaClassKeyImpl classKey(inBuffer);
- QPID_LOG(trace, "RCVD ObjectIndication seq=" << seq << " key=" << classKey.str());
+ auto_ptr<SchemaClassKey> classKey(SchemaClassKeyImpl::factory(inBuffer));
+ QPID_LOG(trace, "RCVD ObjectIndication seq=" << seq << " key=" << classKey->impl->str());
- SchemaObjectClassImpl::Ptr schema = console->getSchema(classKey);
- if (schema.get() == 0) {
- QPID_LOG(trace, "No Schema Found for ObjectIndication. seq=" << seq << " key=" << classKey.str());
- return ObjectImpl::Ptr();
+ SchemaObjectClass* schema = console.impl->getSchema(classKey.get());
+ if (schema == 0) {
+ QPID_LOG(trace, "No Schema Found for ObjectIndication. seq=" << seq << " key=" << classKey->impl->str());
+ return ObjectPtr();
}
- return ObjectImpl::Ptr(new ObjectImpl(schema->envelope, this, inBuffer, prop, stat, true));
+ return ObjectPtr(ObjectImpl::factory(schema, this, inBuffer, prop, stat, true));
}
void BrokerProxyImpl::incOutstandingLH()
@@ -482,8 +481,8 @@
requestsOutstanding--;
if (requestsOutstanding == 0 && !topicBound) {
topicBound = true;
- for (vector<pair<string, string> >::const_iterator iter = console->bindingList.begin();
- iter != console->bindingList.end(); iter++) {
+ for (vector<pair<string, string> >::const_iterator iter = console.impl->bindingList.begin();
+ iter != console.impl->bindingList.end(); iter++) {
string exchange(iter->first.empty() ? QMF_EXCHANGE : iter->first);
string key(iter->second);
eventQueue.push_back(eventBind(exchange, queueName, key));
@@ -493,15 +492,15 @@
}
MethodResponseImpl::MethodResponseImpl(const MethodResponseImpl& from) :
- envelope(from.envelope), // !!!! TODO !!!! this is not right
- status(from.status), schema(from.schema),
- exception(from.exception.get() ? new Value(*from.exception) : 0),
- arguments(from.arguments.get() ? new Value(*from.arguments) : 0)
+ status(from.status), schema(from.schema)
{
+ if (from.exception.get())
+ exception.reset(new Value(*(from.exception)));
+ if (from.arguments.get())
+ arguments.reset(new Value(*(from.arguments)));
}
-MethodResponseImpl::MethodResponseImpl(Buffer& buf, SchemaMethodImpl* s) :
- envelope(new MethodResponse(this)), schema(s)
+MethodResponseImpl::MethodResponseImpl(Buffer& buf, const SchemaMethod* s) : schema(s)
{
string text;
@@ -518,19 +517,31 @@
for (int idx = 0; idx < argCount; idx++) {
const SchemaArgument* arg = schema->getArgument(idx);
if (arg->getDirection() == DIR_OUT || arg->getDirection() == DIR_IN_OUT) {
- ValueImpl* value(new ValueImpl(arg->getType(), buf));
- arguments->insert(arg->getName(), value->envelope);
+ Value* value(ValueImpl::factory(arg->getType(), buf));
+ arguments->insert(arg->getName(), value);
}
}
}
-MethodResponseImpl::MethodResponseImpl(uint32_t s, const string& text) : envelope(new MethodResponse(this)), schema(0)
+MethodResponseImpl::MethodResponseImpl(uint32_t s, const string& text) : schema(0)
{
status = s;
exception.reset(new Value(TYPE_LSTR));
exception->setString(text.c_str());
}
+MethodResponse* MethodResponseImpl::factory(Buffer& buf, const SchemaMethod* schema)
+{
+ MethodResponseImpl* impl(new MethodResponseImpl(buf, schema));
+ return new MethodResponse(impl);
+}
+
+MethodResponse* MethodResponseImpl::factory(uint32_t status, const std::string& text)
+{
+ MethodResponseImpl* impl(new MethodResponseImpl(status, text));
+ return new MethodResponse(impl);
+}
+
bool StaticContext::handleMessage(uint8_t opcode, uint32_t sequence, Buffer& buffer)
{
bool completeContext = false;
@@ -589,7 +600,7 @@
bool QueryContext::handleMessage(uint8_t opcode, uint32_t sequence, Buffer& buffer)
{
bool completeContext = false;
- ObjectImpl::Ptr object;
+ ObjectPtr object;
if (opcode == Protocol::OP_COMMAND_COMPLETE) {
broker.handleCommandComplete(buffer, sequence);
@@ -598,7 +609,7 @@
else if (opcode == Protocol::OP_OBJECT_INDICATION) {
object = broker.handleObjectIndication(buffer, sequence, true, true);
if (object.get() != 0)
- queryResponse->results.push_back(object);
+ queryResponse->impl->results.push_back(object);
}
else {
QPID_LOG(trace, "QueryContext::handleMessage invalid opcode: " << opcode);
@@ -633,7 +644,7 @@
AgentProxy::~AgentProxy() { delete impl; }
const char* AgentProxy::getLabel() const { return impl->getLabel().c_str(); }
-BrokerProxy::BrokerProxy(ConsoleEngine& console) : impl(new BrokerProxyImpl(this, console)) {}
+BrokerProxy::BrokerProxy(ConsoleEngine& console) : impl(new BrokerProxyImpl(*this, console)) {}
BrokerProxy::~BrokerProxy() { delete impl; }
void BrokerProxy::sessionOpened(SessionHandle& sh) { impl->sessionOpened(sh); }
void BrokerProxy::sessionClosed() { impl->sessionClosed(); }
Modified: qpid/trunk/qpid/cpp/src/qmf/BrokerProxyImpl.h
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/cpp/src/qmf/BrokerProxyImpl.h?rev=816770&r1=816769&r2=816770&view=diff
==============================================================================
--- qpid/trunk/qpid/cpp/src/qmf/BrokerProxyImpl.h (original)
+++ qpid/trunk/qpid/cpp/src/qmf/BrokerProxyImpl.h Fri Sep 18 20:15:15 2009
@@ -31,6 +31,7 @@
#include "qpid/framing/Uuid.h"
#include "qpid/sys/Mutex.h"
#include "boost/shared_ptr.hpp"
+#include "boost/noncopyable.hpp"
#include <memory>
#include <string>
#include <deque>
@@ -39,32 +40,36 @@
namespace qmf {
+ typedef boost::shared_ptr<MethodResponse> MethodResponsePtr;
struct MethodResponseImpl {
- typedef boost::shared_ptr<MethodResponseImpl> Ptr;
- MethodResponse* envelope;
uint32_t status;
- SchemaMethodImpl* schema;
- boost::shared_ptr<Value> exception;
- boost::shared_ptr<Value> arguments;
+ const SchemaMethod* schema;
+ std::auto_ptr<Value> exception;
+ std::auto_ptr<Value> arguments;
MethodResponseImpl(const MethodResponseImpl& from);
- MethodResponseImpl(qpid::framing::Buffer& buf, SchemaMethodImpl* schema);
+ MethodResponseImpl(qpid::framing::Buffer& buf, const SchemaMethod* schema);
MethodResponseImpl(uint32_t status, const std::string& text);
- ~MethodResponseImpl() { delete envelope; }
+ static MethodResponse* factory(qpid::framing::Buffer& buf, const SchemaMethod* schema);
+ static MethodResponse* factory(uint32_t status, const std::string& text);
+ ~MethodResponseImpl() {}
uint32_t getStatus() const { return status; }
const Value* getException() const { return exception.get(); }
const Value* getArgs() const { return arguments.get(); }
};
+ typedef boost::shared_ptr<QueryResponse> QueryResponsePtr;
struct QueryResponseImpl {
- typedef boost::shared_ptr<QueryResponseImpl> Ptr;
- QueryResponse *envelope;
uint32_t status;
std::auto_ptr<Value> exception;
- std::vector<ObjectImpl::Ptr> results;
+ std::vector<ObjectPtr> results;
- QueryResponseImpl() : envelope(new QueryResponse(this)), status(0) {}
- ~QueryResponseImpl() { delete envelope; }
+ QueryResponseImpl() : status(0) {}
+ static QueryResponse* factory() {
+ QueryResponseImpl* impl(new QueryResponseImpl());
+ return new QueryResponse(impl);
+ }
+ ~QueryResponseImpl() {}
uint32_t getStatus() const { return status; }
const Value* getException() const { return exception.get(); }
uint32_t getObjectCount() const { return results.size(); }
@@ -78,33 +83,33 @@
std::string exchange;
std::string bindingKey;
void* context;
- QueryResponseImpl::Ptr queryResponse;
- MethodResponseImpl::Ptr methodResponse;
+ QueryResponsePtr queryResponse;
+ MethodResponsePtr methodResponse;
BrokerEventImpl(BrokerEvent::EventKind k) : kind(k), context(0) {}
~BrokerEventImpl() {}
BrokerEvent copy();
};
+ typedef boost::shared_ptr<AgentProxy> AgentProxyPtr;
struct AgentProxyImpl {
- typedef boost::shared_ptr<AgentProxyImpl> Ptr;
- AgentProxy* envelope;
- ConsoleEngineImpl* console;
- BrokerProxyImpl* broker;
+ ConsoleEngine& console;
+ BrokerProxy& broker;
uint32_t agentBank;
std::string label;
- AgentProxyImpl(ConsoleEngineImpl* c, BrokerProxyImpl* b, uint32_t ab, const std::string& l) :
- envelope(new AgentProxy(this)), console(c), broker(b), agentBank(ab), label(l) {}
+ AgentProxyImpl(ConsoleEngine& c, BrokerProxy& b, uint32_t ab, const std::string& l) : console(c), broker(b), agentBank(ab), label(l) {}
+ static AgentProxy* factory(ConsoleEngine& c, BrokerProxy& b, uint32_t ab, const std::string& l) {
+ AgentProxyImpl* impl(new AgentProxyImpl(c, b, ab, l));
+ return new AgentProxy(impl);
+ }
~AgentProxyImpl() {}
const std::string& getLabel() const { return label; }
};
- class BrokerProxyImpl {
+ class BrokerProxyImpl : public boost::noncopyable {
public:
- typedef boost::shared_ptr<BrokerProxyImpl> Ptr;
-
- BrokerProxyImpl(BrokerProxy* e, ConsoleEngine& _console);
+ BrokerProxyImpl(BrokerProxy& pub, ConsoleEngine& _console);
~BrokerProxyImpl() {}
void sessionOpened(SessionHandle& sh);
@@ -122,9 +127,9 @@
uint32_t agentCount() const;
const AgentProxy* getAgent(uint32_t idx) const;
void sendQuery(const Query& query, void* context, const AgentProxy* agent);
- void sendGetRequestLH(SequenceContext::Ptr queryContext, const Query& query, const AgentProxyImpl* agent);
+ void sendGetRequestLH(SequenceContext::Ptr queryContext, const Query& query, const AgentProxy* agent);
std::string encodeMethodArguments(const SchemaMethod* schema, const Value* args, qpid::framing::Buffer& buffer);
- void sendMethodRequest(ObjectIdImpl* oid, const SchemaObjectClass* cls, const std::string& method, const Value* args, void* context);
+ void sendMethodRequest(ObjectId* oid, const SchemaObjectClass* cls, const std::string& method, const Value* args, void* context);
void addBinding(const std::string& exchange, const std::string& key);
void staticRelease() { decOutstanding(); }
@@ -133,15 +138,15 @@
friend class StaticContext;
friend class QueryContext;
friend class MethodContext;
+ BrokerProxy& publicObject;
mutable qpid::sys::Mutex lock;
- BrokerProxy* envelope;
- ConsoleEngineImpl* console;
+ ConsoleEngine& console;
std::string queueName;
qpid::framing::Uuid brokerId;
SequenceManager seqMgr;
uint32_t requestsOutstanding;
bool topicBound;
- std::vector<AgentProxyImpl::Ptr> agentList;
+ std::vector<AgentProxyPtr> agentList;
std::deque<MessageImpl::Ptr> xmtQueue;
std::deque<BrokerEventImpl::Ptr> eventQueue;
@@ -152,18 +157,18 @@
BrokerEventImpl::Ptr eventBind(const std::string& exchange, const std::string& queue, const std::string& key);
BrokerEventImpl::Ptr eventSetupComplete();
BrokerEventImpl::Ptr eventStable();
- BrokerEventImpl::Ptr eventQueryComplete(void* context, QueryResponseImpl::Ptr response);
- BrokerEventImpl::Ptr eventMethodResponse(void* context, MethodResponseImpl::Ptr response);
+ BrokerEventImpl::Ptr eventQueryComplete(void* context, QueryResponsePtr response);
+ BrokerEventImpl::Ptr eventMethodResponse(void* context, MethodResponsePtr response);
void handleBrokerResponse(qpid::framing::Buffer& inBuffer, uint32_t seq);
void handlePackageIndication(qpid::framing::Buffer& inBuffer, uint32_t seq);
void handleCommandComplete(qpid::framing::Buffer& inBuffer, uint32_t seq);
void handleClassIndication(qpid::framing::Buffer& inBuffer, uint32_t seq);
- MethodResponseImpl::Ptr handleMethodResponse(qpid::framing::Buffer& inBuffer, uint32_t seq, SchemaMethodImpl* schema);
+ MethodResponsePtr handleMethodResponse(qpid::framing::Buffer& inBuffer, uint32_t seq, const SchemaMethod* schema);
void handleHeartbeatIndication(qpid::framing::Buffer& inBuffer, uint32_t seq);
void handleEventIndication(qpid::framing::Buffer& inBuffer, uint32_t seq);
void handleSchemaResponse(qpid::framing::Buffer& inBuffer, uint32_t seq);
- ObjectImpl::Ptr handleObjectIndication(qpid::framing::Buffer& inBuffer, uint32_t seq, bool prop, bool stat);
+ ObjectPtr handleObjectIndication(qpid::framing::Buffer& inBuffer, uint32_t seq, bool prop, bool stat);
void incOutstandingLH();
void decOutstanding();
};
@@ -188,7 +193,7 @@
//
struct QueryContext : public SequenceContext {
QueryContext(BrokerProxyImpl& b, void* u) :
- broker(b), userContext(u), requestsOutstanding(0), queryResponse(new QueryResponseImpl()) {}
+ broker(b), userContext(u), requestsOutstanding(0), queryResponse(QueryResponseImpl::factory()) {}
virtual ~QueryContext() {}
void reserve();
void release();
@@ -198,11 +203,11 @@
BrokerProxyImpl& broker;
void* userContext;
uint32_t requestsOutstanding;
- QueryResponseImpl::Ptr queryResponse;
+ QueryResponsePtr queryResponse;
};
struct MethodContext : public SequenceContext {
- MethodContext(BrokerProxyImpl& b, void* u, SchemaMethodImpl* s) : broker(b), userContext(u), schema(s) {}
+ MethodContext(BrokerProxyImpl& b, void* u, const SchemaMethod* s) : broker(b), userContext(u), schema(s) {}
virtual ~MethodContext() {}
void reserve() {}
void release();
@@ -210,8 +215,8 @@
BrokerProxyImpl& broker;
void* userContext;
- SchemaMethodImpl* schema;
- MethodResponseImpl::Ptr methodResponse;
+ const SchemaMethod* schema;
+ MethodResponsePtr methodResponse;
};
Modified: qpid/trunk/qpid/cpp/src/qmf/ConnectionSettingsImpl.cpp
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/cpp/src/qmf/ConnectionSettingsImpl.cpp?rev=816770&r1=816769&r2=816770&view=diff
==============================================================================
--- qpid/trunk/qpid/cpp/src/qmf/ConnectionSettingsImpl.cpp (original)
+++ qpid/trunk/qpid/cpp/src/qmf/ConnectionSettingsImpl.cpp Fri Sep 18 20:15:15 2009
@@ -44,13 +44,13 @@
const string attrRetryDelayMax("retryDelayMax");
const string attrRetryDelayFactor("retryDelayFactor");
-ConnectionSettingsImpl::ConnectionSettingsImpl(ConnectionSettings* e) :
- envelope(e), retryDelayMin(1), retryDelayMax(64), retryDelayFactor(2)
+ConnectionSettingsImpl::ConnectionSettingsImpl() :
+ retryDelayMin(1), retryDelayMax(64), retryDelayFactor(2)
{
}
-ConnectionSettingsImpl::ConnectionSettingsImpl(ConnectionSettings* e, const string& /*url*/) :
- envelope(e), retryDelayMin(1), retryDelayMax(64), retryDelayFactor(2)
+ConnectionSettingsImpl::ConnectionSettingsImpl(const string& /*url*/) :
+ retryDelayMin(1), retryDelayMax(64), retryDelayFactor(2)
{
// TODO: Parse the URL
}
@@ -251,73 +251,18 @@
// Wrappers
//==================================================================
-ConnectionSettings::ConnectionSettings(const ConnectionSettings& from)
-{
- impl = new ConnectionSettingsImpl(*from.impl);
-}
-
-ConnectionSettings::ConnectionSettings()
-{
- impl = new ConnectionSettingsImpl(this);
-}
-
-ConnectionSettings::ConnectionSettings(const char* url)
-{
- impl = new ConnectionSettingsImpl(this, url);
-}
-
-ConnectionSettings::~ConnectionSettings()
-{
- delete impl;
-}
-
-void ConnectionSettings::setAttr(const char* key, const Value& value)
-{
- impl->setAttr(key, value);
-}
-
-Value ConnectionSettings::getAttr(const char* key) const
-{
- return impl->getAttr(key);
-}
-
-const char* ConnectionSettings::getAttrString() const
-{
- return impl->getAttrString().c_str();
-}
-
-void ConnectionSettings::transportTcp(uint16_t port)
-{
- impl->transportTcp(port);
-}
-
-void ConnectionSettings::transportSsl(uint16_t port)
-{
- impl->transportSsl(port);
-}
-
-void ConnectionSettings::transportRdma(uint16_t port)
-{
- impl->transportRdma(port);
-}
-
-void ConnectionSettings::authAnonymous(const char* username)
-{
- impl->authAnonymous(username);
-}
-
-void ConnectionSettings::authPlain(const char* username, const char* password)
-{
- impl->authPlain(username, password);
-}
-
-void ConnectionSettings::authGssapi(const char* serviceName, uint32_t minSsf, uint32_t maxSsf)
-{
- impl->authGssapi(serviceName, minSsf, maxSsf);
-}
-
-void ConnectionSettings::setRetry(int delayMin, int delayMax, int delayFactor)
-{
- impl->setRetry(delayMin, delayMax, delayFactor);
-}
+ConnectionSettings::ConnectionSettings(const ConnectionSettings& from) { impl = new ConnectionSettingsImpl(*from.impl); }
+ConnectionSettings::ConnectionSettings() { impl = new ConnectionSettingsImpl(); }
+ConnectionSettings::ConnectionSettings(const char* url) { impl = new ConnectionSettingsImpl(url); }
+ConnectionSettings::~ConnectionSettings() { delete impl; }
+void ConnectionSettings::setAttr(const char* key, const Value& value) { impl->setAttr(key, value); }
+Value ConnectionSettings::getAttr(const char* key) const { return impl->getAttr(key); }
+const char* ConnectionSettings::getAttrString() const { return impl->getAttrString().c_str(); }
+void ConnectionSettings::transportTcp(uint16_t port) { impl->transportTcp(port); }
+void ConnectionSettings::transportSsl(uint16_t port) { impl->transportSsl(port); }
+void ConnectionSettings::transportRdma(uint16_t port) { impl->transportRdma(port); }
+void ConnectionSettings::authAnonymous(const char* username) { impl->authAnonymous(username); }
+void ConnectionSettings::authPlain(const char* username, const char* password) { impl->authPlain(username, password); }
+void ConnectionSettings::authGssapi(const char* serviceName, uint32_t minSsf, uint32_t maxSsf) { impl->authGssapi(serviceName, minSsf, maxSsf); }
+void ConnectionSettings::setRetry(int delayMin, int delayMax, int delayFactor) { impl->setRetry(delayMin, delayMax, delayFactor); }
Modified: qpid/trunk/qpid/cpp/src/qmf/ConnectionSettingsImpl.h
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/cpp/src/qmf/ConnectionSettingsImpl.h?rev=816770&r1=816769&r2=816770&view=diff
==============================================================================
--- qpid/trunk/qpid/cpp/src/qmf/ConnectionSettingsImpl.h (original)
+++ qpid/trunk/qpid/cpp/src/qmf/ConnectionSettingsImpl.h Fri Sep 18 20:15:15 2009
@@ -29,7 +29,6 @@
namespace qmf {
class ConnectionSettingsImpl {
- ConnectionSettings* envelope;
qpid::client::ConnectionSettings clientSettings;
mutable std::string attrString;
int retryDelayMin;
@@ -37,8 +36,8 @@
int retryDelayFactor;
public:
- ConnectionSettingsImpl(ConnectionSettings* e);
- ConnectionSettingsImpl(ConnectionSettings* e, const std::string& url);
+ ConnectionSettingsImpl();
+ ConnectionSettingsImpl(const std::string& url);
~ConnectionSettingsImpl() {}
void setAttr(const std::string& key, const Value& value);
Value getAttr(const std::string& key) const;
Modified: qpid/trunk/qpid/cpp/src/qmf/ConsoleEngine.h
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/cpp/src/qmf/ConsoleEngine.h?rev=816770&r1=816769&r2=816770&view=diff
==============================================================================
--- qpid/trunk/qpid/cpp/src/qmf/ConsoleEngine.h (original)
+++ qpid/trunk/qpid/cpp/src/qmf/ConsoleEngine.h Fri Sep 18 20:15:15 2009
@@ -45,7 +45,6 @@
*/
class MethodResponse {
public:
- MethodResponse(MethodResponseImpl* impl);
MethodResponse(const MethodResponse& from);
~MethodResponse();
uint32_t getStatus() const;
@@ -53,7 +52,9 @@
const Value* getArgs() const;
private:
+ friend class MethodResponseImpl;
friend class ConsoleEngineImpl;
+ MethodResponse(MethodResponseImpl* impl);
MethodResponseImpl* impl;
};
@@ -62,7 +63,6 @@
*/
class QueryResponse {
public:
- QueryResponse(QueryResponseImpl* impl);
~QueryResponse();
uint32_t getStatus() const;
const Value* getException() const;
@@ -70,7 +70,9 @@
const Object* getObject(uint32_t idx) const;
private:
+ friend class QueryResponseImpl;
friend class QueryContext;
+ QueryResponse(QueryResponseImpl* impl);
QueryResponseImpl *impl;
};
@@ -129,12 +131,13 @@
*/
class AgentProxy {
public:
- AgentProxy(AgentProxyImpl* impl);
~AgentProxy();
const char* getLabel() const;
private:
+ friend class AgentProxyImpl;
friend class BrokerProxyImpl;
+ AgentProxy(AgentProxyImpl* impl);
AgentProxyImpl* impl;
};
@@ -163,6 +166,7 @@
private:
friend class ConsoleEngineImpl;
+ friend class StaticContext;
BrokerProxyImpl* impl;
};
Modified: qpid/trunk/qpid/cpp/src/qmf/ConsoleEngineImpl.cpp
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/cpp/src/qmf/ConsoleEngineImpl.cpp?rev=816770&r1=816769&r2=816770&view=diff
==============================================================================
--- qpid/trunk/qpid/cpp/src/qmf/ConsoleEngineImpl.cpp (original)
+++ qpid/trunk/qpid/cpp/src/qmf/ConsoleEngineImpl.cpp Fri Sep 18 20:15:15 2009
@@ -56,7 +56,7 @@
::memset(&item, 0, sizeof(ConsoleEvent));
item.kind = kind;
- item.agent = agent.get() ? agent->envelope : 0;
+ item.agent = agent.get();
item.classKey = classKey.get();
item.object = object;
item.context = context;
@@ -68,8 +68,7 @@
return item;
}
-ConsoleEngineImpl::ConsoleEngineImpl(ConsoleEngine* e, const ConsoleSettings& s) :
- envelope(e), settings(s)
+ConsoleEngineImpl::ConsoleEngineImpl(const ConsoleSettings& s) : settings(s)
{
bindingList.push_back(pair<string, string>(string(), "schema.#"));
if (settings.rcvObjects && settings.rcvEvents && settings.rcvHeartbeats && !settings.userBindings) {
@@ -192,7 +191,7 @@
return CLASS_OBJECT;
const EventClassList& eList = pIter->second.second;
- if (eList.find(key->impl) != eList.end())
+ if (eList.find(key) != eList.end())
return CLASS_EVENT;
return CLASS_OBJECT;
}
@@ -205,10 +204,10 @@
return 0;
const ObjectClassList& oList = pIter->second.first;
- ObjectClassList::const_iterator iter = oList.find(key->impl);
+ ObjectClassList::const_iterator iter = oList.find(key);
if (iter == oList.end())
return 0;
- return iter->second->envelope;
+ return iter->second;
}
const SchemaEventClass* ConsoleEngineImpl::getEventClass(const SchemaClassKey* key) const
@@ -219,10 +218,10 @@
return 0;
const EventClassList& eList = pIter->second.second;
- EventClassList::const_iterator iter = eList.find(key->impl);
+ EventClassList::const_iterator iter = eList.find(key);
if (iter == eList.end())
return 0;
- return iter->second->envelope;
+ return iter->second;
}
void ConsoleEngineImpl::bindPackage(const char* packageName)
@@ -280,7 +279,7 @@
(packageName, pair<ObjectClassList, EventClassList>(ObjectClassList(), EventClassList())));
}
-void ConsoleEngineImpl::learnClass(SchemaObjectClassImpl::Ptr cls)
+void ConsoleEngineImpl::learnClass(SchemaObjectClass* cls)
{
Mutex::ScopedLock _lock(lock);
const SchemaClassKey* key = cls->getClassKey();
@@ -289,11 +288,11 @@
return;
ObjectClassList& list = pIter->second.first;
- if (list.find(key->impl) == list.end())
- list[key->impl] = cls;
+ if (list.find(key) == list.end())
+ list[key] = cls;
}
-void ConsoleEngineImpl::learnClass(SchemaEventClassImpl::Ptr cls)
+void ConsoleEngineImpl::learnClass(SchemaEventClass* cls)
{
Mutex::ScopedLock _lock(lock);
const SchemaClassKey* key = cls->getClassKey();
@@ -302,34 +301,34 @@
return;
EventClassList& list = pIter->second.second;
- if (list.find(key->impl) == list.end())
- list[key->impl] = cls;
+ if (list.find(key) == list.end())
+ list[key] = cls;
}
-bool ConsoleEngineImpl::haveClass(const SchemaClassKeyImpl& key) const
+bool ConsoleEngineImpl::haveClass(const SchemaClassKey* key) const
{
Mutex::ScopedLock _lock(lock);
- PackageList::const_iterator pIter = packages.find(key.getPackageName());
+ PackageList::const_iterator pIter = packages.find(key->getPackageName());
if (pIter == packages.end())
return false;
const ObjectClassList& oList = pIter->second.first;
const EventClassList& eList = pIter->second.second;
- return oList.find(&key) != oList.end() || eList.find(&key) != eList.end();
+ return oList.find(key) != oList.end() || eList.find(key) != eList.end();
}
-SchemaObjectClassImpl::Ptr ConsoleEngineImpl::getSchema(const SchemaClassKeyImpl& key) const
+SchemaObjectClass* ConsoleEngineImpl::getSchema(const SchemaClassKey* key) const
{
Mutex::ScopedLock _lock(lock);
- PackageList::const_iterator pIter = packages.find(key.getPackageName());
+ PackageList::const_iterator pIter = packages.find(key->getPackageName());
if (pIter == packages.end())
- return SchemaObjectClassImpl::Ptr();
+ return 0;
const ObjectClassList& oList = pIter->second.first;
- ObjectClassList::const_iterator iter = oList.find(&key);
+ ObjectClassList::const_iterator iter = oList.find(key);
if (iter == oList.end())
- return SchemaObjectClassImpl::Ptr();
+ return 0;
return iter->second;
}
@@ -338,7 +337,7 @@
// Wrappers
//==================================================================
-ConsoleEngine::ConsoleEngine(const ConsoleSettings& settings) : impl(new ConsoleEngineImpl(this, settings)) {}
+ConsoleEngine::ConsoleEngine(const ConsoleSettings& settings) : impl(new ConsoleEngineImpl(settings)) {}
ConsoleEngine::~ConsoleEngine() { delete impl; }
bool ConsoleEngine::getEvent(ConsoleEvent& event) const { return impl->getEvent(event); }
void ConsoleEngine::popEvent() { impl->popEvent(); }
Modified: qpid/trunk/qpid/cpp/src/qmf/ConsoleEngineImpl.h
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/cpp/src/qmf/ConsoleEngineImpl.h?rev=816770&r1=816769&r2=816770&view=diff
==============================================================================
--- qpid/trunk/qpid/cpp/src/qmf/ConsoleEngineImpl.h (original)
+++ qpid/trunk/qpid/cpp/src/qmf/ConsoleEngineImpl.h Fri Sep 18 20:15:15 2009
@@ -46,13 +46,14 @@
#include <iostream>
#include <fstream>
#include <boost/shared_ptr.hpp>
+#include <boost/noncopyable.hpp>
namespace qmf {
struct ConsoleEventImpl {
typedef boost::shared_ptr<ConsoleEventImpl> Ptr;
ConsoleEvent::EventKind kind;
- boost::shared_ptr<AgentProxyImpl> agent;
+ boost::shared_ptr<AgentProxy> agent;
std::string name;
boost::shared_ptr<SchemaClassKey> classKey;
Object* object;
@@ -66,9 +67,9 @@
ConsoleEvent copy();
};
- class ConsoleEngineImpl {
+ class ConsoleEngineImpl : public boost::noncopyable {
public:
- ConsoleEngineImpl(ConsoleEngine* e, const ConsoleSettings& settings = ConsoleSettings());
+ ConsoleEngineImpl(const ConsoleSettings& settings = ConsoleSettings());
~ConsoleEngineImpl();
bool getEvent(ConsoleEvent& event) const;
@@ -99,7 +100,6 @@
private:
friend class BrokerProxyImpl;
- ConsoleEngine* envelope;
const ConsoleSettings& settings;
mutable qpid::sys::Mutex lock;
std::deque<ConsoleEventImpl::Ptr> eventQueue;
@@ -110,22 +110,22 @@
// class key pointers. The default behavior would be to compare the pointer
// addresses themselves.
struct KeyCompare {
- bool operator()(const SchemaClassKeyImpl* left, const SchemaClassKeyImpl* right) const {
+ bool operator()(const SchemaClassKey* left, const SchemaClassKey* right) const {
return *left < *right;
}
};
- typedef std::map<const SchemaClassKeyImpl*, SchemaObjectClassImpl::Ptr, KeyCompare> ObjectClassList;
- typedef std::map<const SchemaClassKeyImpl*, SchemaEventClassImpl::Ptr, KeyCompare> EventClassList;
+ typedef std::map<const SchemaClassKey*, SchemaObjectClass*, KeyCompare> ObjectClassList;
+ typedef std::map<const SchemaClassKey*, SchemaEventClass*, KeyCompare> EventClassList;
typedef std::map<std::string, std::pair<ObjectClassList, EventClassList> > PackageList;
PackageList packages;
void learnPackage(const std::string& packageName);
- void learnClass(SchemaObjectClassImpl::Ptr cls);
- void learnClass(SchemaEventClassImpl::Ptr cls);
- bool haveClass(const SchemaClassKeyImpl& key) const;
- SchemaObjectClassImpl::Ptr getSchema(const SchemaClassKeyImpl& key) const;
+ void learnClass(SchemaObjectClass* cls);
+ void learnClass(SchemaEventClass* cls);
+ bool haveClass(const SchemaClassKey* key) const;
+ SchemaObjectClass* getSchema(const SchemaClassKey* key) const;
};
}
Modified: qpid/trunk/qpid/cpp/src/qmf/Object.h
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/cpp/src/qmf/Object.h?rev=816770&r1=816769&r2=816770&view=diff
==============================================================================
--- qpid/trunk/qpid/cpp/src/qmf/Object.h (original)
+++ qpid/trunk/qpid/cpp/src/qmf/Object.h Fri Sep 18 20:15:15 2009
@@ -30,7 +30,6 @@
class Object {
public:
Object(const SchemaObjectClass* type);
- Object(ObjectImpl* impl);
Object(const Object& from);
virtual ~Object();
@@ -41,6 +40,10 @@
Value* getValue(char* key) const;
void invokeMethod(const char* methodName, const Value* inArgs, void* context) const;
+ private:
+ friend class ObjectImpl;
+ friend class AgentEngineImpl;
+ Object(ObjectImpl* impl);
ObjectImpl* impl;
};
}
Modified: qpid/trunk/qpid/cpp/src/qmf/ObjectId.h
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/cpp/src/qmf/ObjectId.h?rev=816770&r1=816769&r2=816770&view=diff
==============================================================================
--- qpid/trunk/qpid/cpp/src/qmf/ObjectId.h (original)
+++ qpid/trunk/qpid/cpp/src/qmf/ObjectId.h Fri Sep 18 20:15:15 2009
@@ -31,7 +31,6 @@
public:
ObjectId();
ObjectId(const ObjectId& from);
- ObjectId(ObjectIdImpl* impl);
~ObjectId();
uint64_t getObjectNum() const;
@@ -45,6 +44,14 @@
bool operator<=(const ObjectId& other) const;
bool operator>=(const ObjectId& other) const;
+ private:
+ friend class ObjectIdImpl;
+ friend class ObjectImpl;
+ friend class BrokerProxyImpl;
+ friend class QueryImpl;
+ friend class ValueImpl;
+ friend class AgentEngineImpl;
+ ObjectId(ObjectIdImpl* impl);
ObjectIdImpl* impl;
};
}
Modified: qpid/trunk/qpid/cpp/src/qmf/ObjectIdImpl.cpp
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/cpp/src/qmf/ObjectIdImpl.cpp?rev=816770&r1=816769&r2=816770&view=diff
==============================================================================
--- qpid/trunk/qpid/cpp/src/qmf/ObjectIdImpl.cpp (original)
+++ qpid/trunk/qpid/cpp/src/qmf/ObjectIdImpl.cpp Fri Sep 18 20:15:15 2009
@@ -32,13 +32,12 @@
((uint64_t) (agent & 0x0fffffff));
}
-ObjectIdImpl::ObjectIdImpl(Buffer& buffer) : envelope(new ObjectId(this)), agent(0)
+ObjectIdImpl::ObjectIdImpl(Buffer& buffer) : agent(0)
{
decode(buffer);
}
-ObjectIdImpl::ObjectIdImpl(AgentAttachment* a, uint8_t flags, uint16_t seq, uint64_t object) :
- envelope(new ObjectId(this)), agent(a)
+ObjectIdImpl::ObjectIdImpl(AgentAttachment* a, uint8_t flags, uint16_t seq, uint64_t object) : agent(a)
{
first =
((uint64_t) (flags & 0x0f)) << 60 |
@@ -46,6 +45,18 @@
second = object;
}
+ObjectId* ObjectIdImpl::factory(Buffer& buffer)
+{
+ ObjectIdImpl* impl(new ObjectIdImpl(buffer));
+ return new ObjectId(impl);
+}
+
+ObjectId* ObjectIdImpl::factory(AgentAttachment* agent, uint8_t flags, uint16_t seq, uint64_t object)
+{
+ ObjectIdImpl* impl(new ObjectIdImpl(agent, flags, seq, object));
+ return new ObjectId(impl);
+}
+
void ObjectIdImpl::decode(Buffer& buffer)
{
first = buffer.getLongLong();
@@ -135,58 +146,17 @@
// Wrappers
//==================================================================
-ObjectId::ObjectId() : impl(new ObjectIdImpl(this)) {}
-
+ObjectId::ObjectId() : impl(new ObjectIdImpl()) {}
ObjectId::ObjectId(const ObjectId& from) : impl(new ObjectIdImpl(*(from.impl))) {}
-
ObjectId::ObjectId(ObjectIdImpl* i) : impl(i) {}
+ObjectId::~ObjectId() { delete impl; }
+uint64_t ObjectId::getObjectNum() const { return impl->getObjectNum(); }
+uint32_t ObjectId::getObjectNumHi() const { return impl->getObjectNumHi(); }
+uint32_t ObjectId::getObjectNumLo() const { return impl->getObjectNumLo(); }
+bool ObjectId::isDurable() const { return impl->isDurable(); }
+bool ObjectId::operator==(const ObjectId& other) const { return *impl == *other.impl; }
+bool ObjectId::operator<(const ObjectId& other) const { return *impl < *other.impl; }
+bool ObjectId::operator>(const ObjectId& other) const { return *impl > *other.impl; }
+bool ObjectId::operator<=(const ObjectId& other) const { return !(*impl > *other.impl); }
+bool ObjectId::operator>=(const ObjectId& other) const { return !(*impl < *other.impl); }
-ObjectId::~ObjectId()
-{
- delete impl;
-}
-
-uint64_t ObjectId::getObjectNum() const
-{
- return impl->getObjectNum();
-}
-
-uint32_t ObjectId::getObjectNumHi() const
-{
- return impl->getObjectNumHi();
-}
-
-uint32_t ObjectId::getObjectNumLo() const
-{
- return impl->getObjectNumLo();
-}
-
-bool ObjectId::isDurable() const
-{
- return impl->isDurable();
-}
-
-bool ObjectId::operator==(const ObjectId& other) const
-{
- return *impl == *other.impl;
-}
-
-bool ObjectId::operator<(const ObjectId& other) const
-{
- return *impl < *other.impl;
-}
-
-bool ObjectId::operator>(const ObjectId& other) const
-{
- return *impl > *other.impl;
-}
-
-bool ObjectId::operator<=(const ObjectId& other) const
-{
- return !(*impl > *other.impl);
-}
-
-bool ObjectId::operator>=(const ObjectId& other) const
-{
- return !(*impl < *other.impl);
-}
Modified: qpid/trunk/qpid/cpp/src/qmf/ObjectIdImpl.h
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/cpp/src/qmf/ObjectIdImpl.h?rev=816770&r1=816769&r2=816770&view=diff
==============================================================================
--- qpid/trunk/qpid/cpp/src/qmf/ObjectIdImpl.h (original)
+++ qpid/trunk/qpid/cpp/src/qmf/ObjectIdImpl.h Fri Sep 18 20:15:15 2009
@@ -34,15 +34,17 @@
};
struct ObjectIdImpl {
- ObjectId* envelope;
AgentAttachment* agent;
uint64_t first;
uint64_t second;
- ObjectIdImpl(ObjectId* e) : envelope(e), agent(0), first(0), second(0) {}
+ ObjectIdImpl() : agent(0), first(0), second(0) {}
ObjectIdImpl(qpid::framing::Buffer& buffer);
ObjectIdImpl(AgentAttachment* agent, uint8_t flags, uint16_t seq, uint64_t object);
+ static ObjectId* factory(qpid::framing::Buffer& buffer);
+ static ObjectId* factory(AgentAttachment* agent, uint8_t flags, uint16_t seq, uint64_t object);
+
void decode(qpid::framing::Buffer& buffer);
void encode(qpid::framing::Buffer& buffer) const;
void fromString(const std::string& repr);
Modified: qpid/trunk/qpid/cpp/src/qmf/ObjectImpl.cpp
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/cpp/src/qmf/ObjectImpl.cpp?rev=816770&r1=816769&r2=816770&view=diff
==============================================================================
--- qpid/trunk/qpid/cpp/src/qmf/ObjectImpl.cpp (original)
+++ qpid/trunk/qpid/cpp/src/qmf/ObjectImpl.cpp Fri Sep 18 20:15:15 2009
@@ -27,9 +27,7 @@
using namespace qpid::sys;
using qpid::framing::Buffer;
-ObjectImpl::ObjectImpl(Object* e, const SchemaObjectClass* type) :
- envelope(e), objectClass(type), broker(0), createTime(uint64_t(Duration(now()))),
- destroyTime(0), lastUpdatedTime(createTime)
+ObjectImpl::ObjectImpl(const SchemaObjectClass* type) : objectClass(type), broker(0), createTime(uint64_t(Duration(now()))), destroyTime(0), lastUpdatedTime(createTime)
{
int propCount = objectClass->getPropertyCount();
int statCount = objectClass->getStatisticCount();
@@ -47,7 +45,7 @@
}
ObjectImpl::ObjectImpl(const SchemaObjectClass* type, BrokerProxyImpl* b, Buffer& buffer, bool prop, bool stat, bool managed) :
- envelope(new Object(this)), objectClass(type), broker(b), createTime(0), destroyTime(0), lastUpdatedTime(0)
+ objectClass(type), broker(b), createTime(0), destroyTime(0), lastUpdatedTime(0)
{
int idx;
@@ -55,7 +53,7 @@
lastUpdatedTime = buffer.getLongLong();
createTime = buffer.getLongLong();
destroyTime = buffer.getLongLong();
- objectId.reset(new ObjectIdImpl(buffer));
+ objectId.reset(ObjectIdImpl::factory(buffer));
}
if (prop) {
@@ -67,8 +65,8 @@
if (excludes.count(prop->getName()) != 0) {
properties[prop->getName()] = ValuePtr(new Value(prop->getType()));
} else {
- ValueImpl* pval = new ValueImpl(prop->getType(), buffer);
- properties[prop->getName()] = ValuePtr(pval->envelope);
+ Value* pval = ValueImpl::factory(prop->getType(), buffer);
+ properties[prop->getName()] = ValuePtr(pval);
}
}
}
@@ -77,12 +75,18 @@
int statCount = objectClass->getStatisticCount();
for (idx = 0; idx < statCount; idx++) {
const SchemaStatistic* stat = objectClass->getStatistic(idx);
- ValueImpl* sval = new ValueImpl(stat->getType(), buffer);
- statistics[stat->getName()] = ValuePtr(sval->envelope);
+ Value* sval = ValueImpl::factory(stat->getType(), buffer);
+ statistics[stat->getName()] = ValuePtr(sval);
}
}
}
+Object* ObjectImpl::factory(const SchemaObjectClass* type, BrokerProxyImpl* b, Buffer& buffer, bool prop, bool stat, bool managed)
+{
+ ObjectImpl* impl(new ObjectImpl(type, b, buffer, prop, stat, managed));
+ return new Object(impl);
+}
+
ObjectImpl::~ObjectImpl()
{
}
@@ -150,7 +154,7 @@
buffer.putLongLong(lastUpdatedTime);
buffer.putLongLong(createTime);
buffer.putLongLong(destroyTime);
- objectId->encode(buffer);
+ objectId->impl->encode(buffer);
}
void ObjectImpl::encodeProperties(qpid::framing::Buffer& buffer) const
@@ -203,7 +207,7 @@
// Wrappers
//==================================================================
-Object::Object(const SchemaObjectClass* type) : impl(new ObjectImpl(this, type)) {}
+Object::Object(const SchemaObjectClass* type) : impl(new ObjectImpl(type)) {}
Object::Object(ObjectImpl* i) : impl(i) {}
Object::Object(const Object& from) : impl(new ObjectImpl(*(from.impl))) {}
Object::~Object() { delete impl; }
Modified: qpid/trunk/qpid/cpp/src/qmf/ObjectImpl.h
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/cpp/src/qmf/ObjectImpl.h?rev=816770&r1=816769&r2=816770&view=diff
==============================================================================
--- qpid/trunk/qpid/cpp/src/qmf/ObjectImpl.h (original)
+++ qpid/trunk/qpid/cpp/src/qmf/ObjectImpl.h Fri Sep 18 20:15:15 2009
@@ -33,27 +33,29 @@
class BrokerProxyImpl;
+ typedef boost::shared_ptr<Object> ObjectPtr;
+
struct ObjectImpl {
- typedef boost::shared_ptr<ObjectImpl> Ptr;
typedef boost::shared_ptr<Value> ValuePtr;
- Object* envelope;
const SchemaObjectClass* objectClass;
BrokerProxyImpl* broker;
- boost::shared_ptr<ObjectIdImpl> objectId;
+ boost::shared_ptr<ObjectId> objectId;
uint64_t createTime;
uint64_t destroyTime;
uint64_t lastUpdatedTime;
mutable std::map<std::string, ValuePtr> properties;
mutable std::map<std::string, ValuePtr> statistics;
- ObjectImpl(Object* e, const SchemaObjectClass* type);
+ ObjectImpl(const SchemaObjectClass* type);
ObjectImpl(const SchemaObjectClass* type, BrokerProxyImpl* b, qpid::framing::Buffer& buffer,
bool prop, bool stat, bool managed);
+ static Object* factory(const SchemaObjectClass* type, BrokerProxyImpl* b, qpid::framing::Buffer& buffer,
+ bool prop, bool stat, bool managed);
~ObjectImpl();
void destroy();
- const ObjectId* getObjectId() const { return objectId.get() ? objectId->envelope : 0; }
- void setObjectId(ObjectId* oid) { objectId.reset(oid->impl); }
+ const ObjectId* getObjectId() const { return objectId.get(); }
+ void setObjectId(ObjectId* oid) { objectId.reset(oid); }
const SchemaObjectClass* getClass() const { return objectClass; }
Value* getValue(const std::string& key) const;
void invokeMethod(const std::string& methodName, const Value* inArgs, void* context) const;
Modified: qpid/trunk/qpid/cpp/src/qmf/Query.h
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/cpp/src/qmf/Query.h?rev=816770&r1=816769&r2=816770&view=diff
==============================================================================
--- qpid/trunk/qpid/cpp/src/qmf/Query.h (original)
+++ qpid/trunk/qpid/cpp/src/qmf/Query.h Fri Sep 18 20:15:15 2009
@@ -77,7 +77,7 @@
Query(const char* className, const char* packageName);
Query(const SchemaClassKey* key);
Query(const ObjectId* oid);
- Query(QueryImpl* impl);
+ Query(const Query& from);
~Query();
void setSelect(const QueryOperand* criterion);
@@ -96,6 +96,10 @@
const char* getOrderBy() const;
bool getDecreasing() const;
+ private:
+ friend class QueryImpl;
+ friend class BrokerProxyImpl;
+ Query(QueryImpl* impl);
QueryImpl* impl;
};
}
Modified: qpid/trunk/qpid/cpp/src/qmf/QueryImpl.cpp
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/cpp/src/qmf/QueryImpl.cpp?rev=816770&r1=816769&r2=816770&view=diff
==============================================================================
--- qpid/trunk/qpid/cpp/src/qmf/QueryImpl.cpp (original)
+++ qpid/trunk/qpid/cpp/src/qmf/QueryImpl.cpp Fri Sep 18 20:15:15 2009
@@ -45,6 +45,12 @@
// TODO
}
+Query* QueryImpl::factory(Buffer& buffer)
+{
+ QueryImpl* impl(new QueryImpl(buffer));
+ return new Query(impl);
+}
+
void QueryImpl::encode(Buffer& buffer) const
{
FieldTable ft;
@@ -69,14 +75,17 @@
QueryElement::QueryElement(QueryElementImpl* i) : impl(i) {}
QueryElement::~QueryElement() { delete impl; }
bool QueryElement::evaluate(const Object* object) const { return impl->evaluate(object); }
+
QueryExpression::QueryExpression(ExprOper oper, const QueryOperand* operand1, const QueryOperand* operand2) : impl(new QueryExpressionImpl(oper, operand1, operand2)) {}
QueryExpression::QueryExpression(QueryExpressionImpl* i) : impl(i) {}
QueryExpression::~QueryExpression() { delete impl; }
bool QueryExpression::evaluate(const Object* object) const { return impl->evaluate(object); }
+
Query::Query(const char* className, const char* packageName) : impl(new QueryImpl(className, packageName)) {}
Query::Query(const SchemaClassKey* key) : impl(new QueryImpl(key)) {}
Query::Query(const ObjectId* oid) : impl(new QueryImpl(oid)) {}
Query::Query(QueryImpl* i) : impl(i) {}
+Query::Query(const Query& from) : impl(new QueryImpl(*(from.impl))) {}
Query::~Query() { delete impl; }
void Query::setSelect(const QueryOperand* criterion) { impl->setSelect(criterion); }
void Query::setLimit(uint32_t maxResults) { impl->setLimit(maxResults); }
Modified: qpid/trunk/qpid/cpp/src/qmf/QueryImpl.h
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/cpp/src/qmf/QueryImpl.h?rev=816770&r1=816769&r2=816770&view=diff
==============================================================================
--- qpid/trunk/qpid/cpp/src/qmf/QueryImpl.h (original)
+++ qpid/trunk/qpid/cpp/src/qmf/QueryImpl.h Fri Sep 18 20:15:15 2009
@@ -34,39 +34,36 @@
namespace qmf {
struct QueryElementImpl {
- QueryElementImpl(const std::string& a, const Value* v, ValueOper o) :
- envelope(new QueryElement(this)), attrName(a), value(v), oper(o) {}
+ QueryElementImpl(const std::string& a, const Value* v, ValueOper o) : attrName(a), value(v), oper(o) {}
~QueryElementImpl() {}
bool evaluate(const Object* object) const;
- QueryElement* envelope;
std::string attrName;
const Value* value;
ValueOper oper;
};
struct QueryExpressionImpl {
- QueryExpressionImpl(ExprOper o, const QueryOperand* operand1, const QueryOperand* operand2) :
- envelope(new QueryExpression(this)), oper(o), left(operand1), right(operand2) {}
+ QueryExpressionImpl(ExprOper o, const QueryOperand* operand1, const QueryOperand* operand2) : oper(o), left(operand1), right(operand2) {}
~QueryExpressionImpl() {}
bool evaluate(const Object* object) const;
- QueryExpression* envelope;
ExprOper oper;
const QueryOperand* left;
const QueryOperand* right;
};
struct QueryImpl {
- QueryImpl(Query* e) : envelope(e), select(0) {}
- QueryImpl(const std::string& c, const std::string& p) :
- envelope(new Query(this)), packageName(p), className(c) {}
- QueryImpl(const SchemaClassKey* key) :
- envelope(new Query(this)), packageName(key->getPackageName()), className(key->getClassName()) {}
- QueryImpl(const ObjectId* oid) :
- envelope(new Query(this)), oid(new ObjectId(*oid)) {}
+ // Constructors mapped to public
+ QueryImpl(const std::string& c, const std::string& p) : packageName(p), className(c), select(0), resultLimit(0) {}
+ QueryImpl(const SchemaClassKey* key) : packageName(key->getPackageName()), className(key->getClassName()), select(0), resultLimit(0) {}
+ QueryImpl(const ObjectId* oid) : oid(new ObjectId(*oid)), select(0), resultLimit(0) {}
+
+ // Factory constructors
QueryImpl(qpid::framing::Buffer& buffer);
+
~QueryImpl() {};
+ static Query* factory(qpid::framing::Buffer& buffer);
void setSelect(const QueryOperand* criterion) { select = criterion; }
void setLimit(uint32_t maxResults) { resultLimit = maxResults; }
@@ -88,7 +85,6 @@
void encode(qpid::framing::Buffer& buffer) const;
- Query* envelope;
std::string packageName;
std::string className;
boost::shared_ptr<ObjectId> oid;
Modified: qpid/trunk/qpid/cpp/src/qmf/ResilientConnection.cpp
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/cpp/src/qmf/ResilientConnection.cpp?rev=816770&r1=816769&r2=816770&view=diff
==============================================================================
--- qpid/trunk/qpid/cpp/src/qmf/ResilientConnection.cpp (original)
+++ qpid/trunk/qpid/cpp/src/qmf/ResilientConnection.cpp Fri Sep 18 20:15:15 2009
@@ -38,6 +38,7 @@
#include <vector>
#include <set>
#include <boost/intrusive_ptr.hpp>
+#include <boost/noncopyable.hpp>
using namespace std;
using namespace qmf;
@@ -77,7 +78,7 @@
void stop();
};
- class ResilientConnectionImpl : public qpid::sys::Runnable {
+ class ResilientConnectionImpl : public qpid::sys::Runnable, public boost::noncopyable {
public:
ResilientConnectionImpl(const ConnectionSettings& settings);
~ResilientConnectionImpl();
Modified: qpid/trunk/qpid/cpp/src/qmf/Schema.h
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/cpp/src/qmf/Schema.h?rev=816770&r1=816769&r2=816770&view=diff
==============================================================================
--- qpid/trunk/qpid/cpp/src/qmf/Schema.h (original)
+++ qpid/trunk/qpid/cpp/src/qmf/Schema.h Fri Sep 18 20:15:15 2009
@@ -42,7 +42,7 @@
class SchemaArgument {
public:
SchemaArgument(const char* name, Typecode typecode);
- SchemaArgument(SchemaArgumentImpl* impl);
+ SchemaArgument(const SchemaArgument& from);
~SchemaArgument();
void setDirection(Direction dir);
void setUnit(const char* val);
@@ -53,6 +53,11 @@
const char* getUnit() const;
const char* getDesc() const;
+ private:
+ friend class SchemaArgumentImpl;
+ friend class SchemaMethodImpl;
+ friend class SchemaEventClassImpl;
+ SchemaArgument(SchemaArgumentImpl* impl);
SchemaArgumentImpl* impl;
};
@@ -61,15 +66,20 @@
class SchemaMethod {
public:
SchemaMethod(const char* name);
- SchemaMethod(SchemaMethodImpl* impl);
+ SchemaMethod(const SchemaMethod& from);
~SchemaMethod();
- void addArgument(const SchemaArgument& argument);
+ void addArgument(const SchemaArgument* argument);
void setDesc(const char* desc);
const char* getName() const;
const char* getDesc() const;
int getArgumentCount() const;
const SchemaArgument* getArgument(int idx) const;
+ private:
+ friend class SchemaMethodImpl;
+ friend class SchemaObjectClassImpl;
+ friend class AgentEngineImpl;
+ SchemaMethod(SchemaMethodImpl* impl);
SchemaMethodImpl* impl;
};
@@ -78,7 +88,7 @@
class SchemaProperty {
public:
SchemaProperty(const char* name, Typecode typecode);
- SchemaProperty(SchemaPropertyImpl* impl);
+ SchemaProperty(const SchemaProperty& from);
~SchemaProperty();
void setAccess(Access access);
void setIndex(bool val);
@@ -93,6 +103,10 @@
const char* getUnit() const;
const char* getDesc() const;
+ private:
+ friend class SchemaPropertyImpl;
+ friend class SchemaObjectClassImpl;
+ SchemaProperty(SchemaPropertyImpl* impl);
SchemaPropertyImpl* impl;
};
@@ -101,7 +115,7 @@
class SchemaStatistic {
public:
SchemaStatistic(const char* name, Typecode typecode);
- SchemaStatistic(SchemaStatisticImpl* impl);
+ SchemaStatistic(const SchemaStatistic& from);
~SchemaStatistic();
void setUnit(const char* val);
void setDesc(const char* desc);
@@ -110,6 +124,10 @@
const char* getUnit() const;
const char* getDesc() const;
+ private:
+ friend class SchemaStatisticImpl;
+ friend class SchemaObjectClassImpl;
+ SchemaStatistic(SchemaStatisticImpl* impl);
SchemaStatisticImpl* impl;
};
@@ -117,13 +135,21 @@
*/
class SchemaClassKey {
public:
- SchemaClassKey(SchemaClassKeyImpl* impl);
+ SchemaClassKey(const SchemaClassKey& from);
~SchemaClassKey();
const char* getPackageName() const;
const char* getClassName() const;
const uint8_t* getHash() const;
+ bool operator==(const SchemaClassKey& other) const;
+ bool operator<(const SchemaClassKey& other) const;
+
+ private:
+ friend class SchemaClassKeyImpl;
+ friend class BrokerProxyImpl;
+ friend class ConsoleEngineImpl;
+ SchemaClassKey(SchemaClassKeyImpl* impl);
SchemaClassKeyImpl* impl;
};
@@ -132,11 +158,11 @@
class SchemaObjectClass {
public:
SchemaObjectClass(const char* package, const char* name);
- SchemaObjectClass(SchemaObjectClassImpl* impl);
+ SchemaObjectClass(const SchemaObjectClass& from);
~SchemaObjectClass();
- void addProperty(const SchemaProperty& property);
- void addStatistic(const SchemaStatistic& statistic);
- void addMethod(const SchemaMethod& method);
+ void addProperty(const SchemaProperty* property);
+ void addStatistic(const SchemaStatistic* statistic);
+ void addMethod(const SchemaMethod* method);
const SchemaClassKey* getClassKey() const;
int getPropertyCount() const;
@@ -146,6 +172,11 @@
const SchemaStatistic* getStatistic(int idx) const;
const SchemaMethod* getMethod(int idx) const;
+ private:
+ friend class SchemaObjectClassImpl;
+ friend class BrokerProxyImpl;
+ friend class AgentEngineImpl;
+ SchemaObjectClass(SchemaObjectClassImpl* impl);
SchemaObjectClassImpl* impl;
};
@@ -154,15 +185,20 @@
class SchemaEventClass {
public:
SchemaEventClass(const char* package, const char* name);
- SchemaEventClass(SchemaEventClassImpl* impl);
+ SchemaEventClass(const SchemaEventClass& from);
~SchemaEventClass();
- void addArgument(const SchemaArgument& argument);
+ void addArgument(const SchemaArgument* argument);
void setDesc(const char* desc);
const SchemaClassKey* getClassKey() const;
int getArgumentCount() const;
const SchemaArgument* getArgument(int idx) const;
+ private:
+ friend class SchemaEventClassImpl;
+ friend class BrokerProxyImpl;
+ friend class AgentEngineImpl;
+ SchemaEventClass(SchemaEventClassImpl* impl);
SchemaEventClassImpl* impl;
};
}
---------------------------------------------------------------------
Apache Qpid - AMQP Messaging Implementation
Project: http://qpid.apache.org
Use/Interact: mailto:commits-subscribe@qpid.apache.org