diff options
Diffstat (limited to 'cpp/src/qmf')
-rw-r--r-- | cpp/src/qmf/AgentSession.cpp | 25 | ||||
-rw-r--r-- | cpp/src/qmf/AgentSessionImpl.h | 73 | ||||
-rw-r--r-- | cpp/src/qmf/BrokerImportExport.h | 42 | ||||
-rw-r--r-- | cpp/src/qmf/ConsoleSessionImpl.h | 2 | ||||
-rw-r--r-- | cpp/src/qmf/EventNotifierImpl.cpp | 4 | ||||
-rw-r--r-- | cpp/src/qmf/PrivateImplRef.h | 8 |
6 files changed, 62 insertions, 92 deletions
diff --git a/cpp/src/qmf/AgentSession.cpp b/cpp/src/qmf/AgentSession.cpp index 3b5806aea4..4d7be33188 100644 --- a/cpp/src/qmf/AgentSession.cpp +++ b/cpp/src/qmf/AgentSession.cpp @@ -21,6 +21,22 @@ #include "qmf/AgentSessionImpl.h" +#include <iostream> +#include <memory> + +namespace qmf { + +using std::string; +using std::map; + +using qpid::messaging::Address; +using qpid::messaging::Connection; +using qpid::messaging::Duration; +using qpid::messaging::Message; +using qpid::messaging::Receiver; +using qpid::messaging::Sender; +using qpid::types::Variant; + AgentSession::AgentSession(AgentSessionImpl* impl) { PI::ctor(*this, impl); } AgentSession::AgentSession(const AgentSession& s) : qmf::Handle<AgentSessionImpl>() { PI::copy(*this, s); } AgentSession::~AgentSession() { PI::dtor(*this); } @@ -332,7 +348,7 @@ void AgentSessionImpl::delData(const DataAddr& addr) void AgentSessionImpl::authAccept(AgentEvent& authEvent) { - auto_ptr<AgentEventImpl> eventImpl(new AgentEventImpl(AGENT_QUERY)); + std::auto_ptr<AgentEventImpl> eventImpl(new AgentEventImpl(AGENT_QUERY)); eventImpl->setQuery(authEvent.getQuery()); eventImpl->setUserId(authEvent.getUserId()); eventImpl->setReplyTo(AgentEventImplAccess::get(authEvent).getReplyTo()); @@ -593,7 +609,7 @@ void AgentSessionImpl::handleMethodRequest(const Variant::Map& content, const Me // // Construct an AgentEvent to be sent to the application. // - auto_ptr<AgentEventImpl> eventImpl(new AgentEventImpl(AGENT_METHOD)); + std::auto_ptr<AgentEventImpl> eventImpl(new AgentEventImpl(AGENT_METHOD)); eventImpl->setUserId(msg.getUserId()); eventImpl->setReplyTo(msg.getReplyTo()); eventImpl->setCorrelationId(msg.getCorrelationId()); @@ -655,8 +671,8 @@ void AgentSessionImpl::handleQueryRequest(const Variant::Map& content, const Mes // // Construct an AgentEvent to be sent to the application or directly handled by the agent. // - auto_ptr<QueryImpl> queryImpl(new QueryImpl(content)); - auto_ptr<AgentEventImpl> eventImpl(new AgentEventImpl(AGENT_AUTH_QUERY)); + std::auto_ptr<QueryImpl> queryImpl(new QueryImpl(content)); + std::auto_ptr<AgentEventImpl> eventImpl(new AgentEventImpl(AGENT_AUTH_QUERY)); eventImpl->setUserId(msg.getUserId()); eventImpl->setReplyTo(msg.getReplyTo()); eventImpl->setCorrelationId(msg.getCorrelationId()); @@ -1012,3 +1028,4 @@ const AgentSessionImpl& AgentSessionImplAccess::get(const AgentSession& session) return *session.impl; } +} diff --git a/cpp/src/qmf/AgentSessionImpl.h b/cpp/src/qmf/AgentSessionImpl.h index ae512a4054..64a39ab2e8 100644 --- a/cpp/src/qmf/AgentSessionImpl.h +++ b/cpp/src/qmf/AgentSessionImpl.h @@ -57,17 +57,10 @@ #include <queue> #include <map> -#include <iostream> -#include <memory> - -using namespace std; -using namespace qpid::messaging; -using namespace qmf; -using qpid::types::Variant; - -typedef qmf::PrivateImplRef<AgentSession> PI; namespace qmf { + typedef qmf::PrivateImplRef<AgentSession> PI; + class AgentSessionImpl : public virtual qpid::RefCounted, public qpid::sys::Runnable { public: ~AgentSessionImpl(); @@ -75,29 +68,29 @@ namespace qmf { // // Methods from API handle // - AgentSessionImpl(Connection& c, const string& o); - void setDomain(const string& d) { checkOpen(); domain = d; } - void setVendor(const string& v) { checkOpen(); attributes["_vendor"] = v; } - void setProduct(const string& p) { checkOpen(); attributes["_product"] = p; } - void setInstance(const string& i) { checkOpen(); attributes["_instance"] = i; } - void setAttribute(const string& k, const qpid::types::Variant& v) { checkOpen(); attributes[k] = v; } - const string& getName() const { return agentName; } + AgentSessionImpl(qpid::messaging::Connection& c, const std::string& o); + void setDomain(const std::string& d) { checkOpen(); domain = d; } + void setVendor(const std::string& v) { checkOpen(); attributes["_vendor"] = v; } + void setProduct(const std::string& p) { checkOpen(); attributes["_product"] = p; } + void setInstance(const std::string& i) { checkOpen(); attributes["_instance"] = i; } + void setAttribute(const std::string& k, const qpid::types::Variant& v) { checkOpen(); attributes[k] = v; } + const std::string& getName() const { return agentName; } void open(); void closeAsync(); void close(); - bool nextEvent(AgentEvent& e, Duration t); + bool nextEvent(AgentEvent& e, qpid::messaging::Duration t); int pendingEvents() const; void setEventNotifier(EventNotifierImpl* eventNotifier); EventNotifierImpl* getEventNotifier() const; void registerSchema(Schema& s); - DataAddr addData(Data& d, const string& n, bool persist); + DataAddr addData(Data& d, const std::string& n, bool persist); void delData(const DataAddr&); void authAccept(AgentEvent& e); - void authReject(AgentEvent& e, const string& m); - void raiseException(AgentEvent& e, const string& s); + void authReject(AgentEvent& e, const std::string& m); + void raiseException(AgentEvent& e, const std::string& s); void raiseException(AgentEvent& e, const Data& d); void response(AgentEvent& e, const Data& d); void complete(AgentEvent& e); @@ -106,21 +99,21 @@ namespace qmf { void raiseEvent(const Data& d, int s); private: - typedef map<DataAddr, Data, DataAddrCompare> DataIndex; - typedef map<SchemaId, Schema, SchemaIdCompare> SchemaMap; + typedef std::map<DataAddr, Data, DataAddrCompare> DataIndex; + typedef std::map<SchemaId, Schema, SchemaIdCompare> SchemaMap; mutable qpid::sys::Mutex lock; qpid::sys::Condition cond; - Connection connection; - Session session; - Sender directSender; - Sender topicSender; - string domain; - Variant::Map attributes; - Variant::Map options; - string agentName; + qpid::messaging::Connection connection; + qpid::messaging::Session session; + qpid::messaging::Sender directSender; + qpid::messaging::Sender topicSender; + std::string domain; + qpid::types::Variant::Map attributes; + qpid::types::Variant::Map options; + std::string agentName; bool opened; - queue<AgentEvent> eventQueue; + std::queue<AgentEvent> eventQueue; EventNotifierImpl* eventNotifier; qpid::sys::Thread* thread; bool threadCanceled; @@ -140,25 +133,25 @@ namespace qmf { bool strictSecurity; uint32_t maxThreadWaitTime; uint64_t schemaUpdateTime; - string directBase; - string topicBase; + std::string directBase; + std::string topicBase; SchemaMap schemata; DataIndex globalIndex; - map<SchemaId, DataIndex, SchemaIdCompareNoHash> schemaIndex; + std::map<SchemaId, DataIndex, SchemaIdCompareNoHash> schemaIndex; void checkOpen(); void setAgentName(); void enqueueEvent(const AgentEvent&); void alertEventNotifierLH(bool readable); - void handleLocateRequest(const Variant::List& content, const Message& msg); - void handleMethodRequest(const Variant::Map& content, const Message& msg); - void handleQueryRequest(const Variant::Map& content, const Message& msg); + void handleLocateRequest(const qpid::types::Variant::List& content, const qpid::messaging::Message& msg); + void handleMethodRequest(const qpid::types::Variant::Map& content, const qpid::messaging::Message& msg); + void handleQueryRequest(const qpid::types::Variant::Map& content, const qpid::messaging::Message& msg); void handleSchemaRequest(AgentEvent&); - void handleV1SchemaRequest(qpid::management::Buffer&, uint32_t, const Message&); - void dispatch(Message); + void handleV1SchemaRequest(qpid::management::Buffer&, uint32_t, const qpid::messaging::Message&); + void dispatch(qpid::messaging::Message); void sendHeartbeat(); - void send(Message, const Address&); + void send(qpid::messaging::Message, const qpid::messaging::Address&); void flushResponses(AgentEvent&, bool); void periodicProcessing(uint64_t); void run(); diff --git a/cpp/src/qmf/BrokerImportExport.h b/cpp/src/qmf/BrokerImportExport.h deleted file mode 100644 index ee05788063..0000000000 --- a/cpp/src/qmf/BrokerImportExport.h +++ /dev/null @@ -1,42 +0,0 @@ -#ifndef QPID_BROKER_IMPORT_EXPORT_H -#define QPID_BROKER_IMPORT_EXPORT_H - -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -#if defined(WIN32) && !defined(QPID_DECLARE_STATIC) -# if defined(BROKER_EXPORT) || defined (qpidbroker_EXPORTS) -# define QPID_BROKER_EXTERN __declspec(dllexport) -# else -# define QPID_BROKER_EXTERN __declspec(dllimport) -# endif -# ifdef _MSC_VER -# define QPID_BROKER_CLASS_EXTERN -# define QPID_BROKER_INLINE_EXTERN QPID_BROKER_EXTERN -# else -# define QPID_BROKER_CLASS_EXTERN QPID_BROKER_EXTERN -# define QPID_BROKER_INLINE_EXTERN -# endif -#else -# define QPID_BROKER_EXTERN -# define QPID_BROKER_CLASS_EXTERN -# define QPID_BROKER_INLINE_EXTERN -#endif - -#endif diff --git a/cpp/src/qmf/ConsoleSessionImpl.h b/cpp/src/qmf/ConsoleSessionImpl.h index e2b30602fa..2c06df030c 100644 --- a/cpp/src/qmf/ConsoleSessionImpl.h +++ b/cpp/src/qmf/ConsoleSessionImpl.h @@ -47,8 +47,6 @@ #include <map> #include <queue> -using namespace std; - namespace qmf { class ConsoleSessionImpl : public virtual qpid::RefCounted, public qpid::sys::Runnable { public: diff --git a/cpp/src/qmf/EventNotifierImpl.cpp b/cpp/src/qmf/EventNotifierImpl.cpp index 20114aaa5e..81b6d637a3 100644 --- a/cpp/src/qmf/EventNotifierImpl.cpp +++ b/cpp/src/qmf/EventNotifierImpl.cpp @@ -21,6 +21,8 @@ #include "qmf/AgentSessionImpl.h" #include "qmf/ConsoleSessionImpl.h" +namespace qmf { + EventNotifierImpl::EventNotifierImpl(AgentSession& agentSession) : readable(false), agent(agentSession) { @@ -54,3 +56,5 @@ bool EventNotifierImpl::isReadable() const { return this->readable; } + +} diff --git a/cpp/src/qmf/PrivateImplRef.h b/cpp/src/qmf/PrivateImplRef.h index 960cbb2e09..c0c07d7e1b 100644 --- a/cpp/src/qmf/PrivateImplRef.h +++ b/cpp/src/qmf/PrivateImplRef.h @@ -76,15 +76,15 @@ template <class T> class PrivateImplRef { /** Set the implementation pointer in a handle */ static void set(T& t, const intrusive_ptr& p) { if (t.impl == p) return; - if (t.impl) boost::intrusive_ptr_release(t.impl); + if (t.impl) intrusive_ptr_release(t.impl); t.impl = p.get(); - if (t.impl) boost::intrusive_ptr_add_ref(t.impl); + if (t.impl) intrusive_ptr_add_ref(t.impl); } // Helper functions to implement the ctor, dtor, copy, assign - static void ctor(T& t, Impl* p) { t.impl = p; if (p) boost::intrusive_ptr_add_ref(p); } + static void ctor(T& t, Impl* p) { t.impl = p; if (p) intrusive_ptr_add_ref(p); } static void copy(T& t, const T& x) { if (&t == &x) return; t.impl = 0; assign(t, x); } - static void dtor(T& t) { if(t.impl) boost::intrusive_ptr_release(t.impl); } + static void dtor(T& t) { if(t.impl) intrusive_ptr_release(t.impl); } static T& assign(T& t, const T& x) { set(t, get(x)); return t;} }; |