diff options
author | Ted Ross <tross@apache.org> | 2010-08-12 22:28:09 +0000 |
---|---|---|
committer | Ted Ross <tross@apache.org> | 2010-08-12 22:28:09 +0000 |
commit | 03b589ce68fd45bdf2634c211b02bdc5f3cbdba5 (patch) | |
tree | 312dde1cd622f372f45e55e0f228c3c0303886c4 /qpid/cpp/include | |
parent | 3c5e6921207ae0ada67184028d4fad2b032ace07 (diff) | |
download | qpid-python-03b589ce68fd45bdf2634c211b02bdc5f3cbdba5.tar.gz |
QPID-2792 - QMF Clients in C++ following the ABI-stable pattern of the new messaging API
git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk@985016 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'qpid/cpp/include')
-rw-r--r-- | qpid/cpp/include/qmf/Agent.h | 84 | ||||
-rw-r--r-- | qpid/cpp/include/qmf/AgentEvent.h | 74 | ||||
-rw-r--r-- | qpid/cpp/include/qmf/AgentSession.h | 93 | ||||
-rw-r--r-- | qpid/cpp/include/qmf/ConsoleEvent.h | 73 | ||||
-rw-r--r-- | qpid/cpp/include/qmf/ConsoleSession.h | 65 | ||||
-rw-r--r-- | qpid/cpp/include/qmf/Data.h | 71 | ||||
-rw-r--r-- | qpid/cpp/include/qmf/DataAddr.h | 62 | ||||
-rw-r--r-- | qpid/cpp/include/qmf/Handle.h | 70 | ||||
-rw-r--r-- | qpid/cpp/include/qmf/ImportExport.h | 33 | ||||
-rw-r--r-- | qpid/cpp/include/qmf/Query.h | 65 | ||||
-rw-r--r-- | qpid/cpp/include/qmf/Schema.h | 76 | ||||
-rw-r--r-- | qpid/cpp/include/qmf/SchemaId.h | 61 | ||||
-rw-r--r-- | qpid/cpp/include/qmf/SchemaMethod.h | 65 | ||||
-rw-r--r-- | qpid/cpp/include/qmf/SchemaProperty.h | 74 | ||||
-rw-r--r-- | qpid/cpp/include/qmf/SchemaTypes.h | 56 | ||||
-rw-r--r-- | qpid/cpp/include/qmf/exceptions.h | 59 |
16 files changed, 1081 insertions, 0 deletions
diff --git a/qpid/cpp/include/qmf/Agent.h b/qpid/cpp/include/qmf/Agent.h new file mode 100644 index 0000000000..8ddea0fae9 --- /dev/null +++ b/qpid/cpp/include/qmf/Agent.h @@ -0,0 +1,84 @@ +#ifndef QMF_AGENT_H +#define QMF_AGENT_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. + * + */ + +#include <qmf/ImportExport.h> +#include "qmf/Handle.h" +#include "qmf/exceptions.h" +#include "qpid/messaging/Duration.h" +#include "qpid/types/Variant.h" +#include <string> + +namespace qmf { + +#ifndef SWIG + template <class> class PrivateImplRef; +#endif + + class AgentImpl; + class ConsoleEvent; + class Query; + class DataAddr; + class SchemaId; + class Schema; + + class Agent : public qmf::Handle<AgentImpl> { + public: + QMF_EXTERN Agent(AgentImpl* impl = 0); + QMF_EXTERN Agent(const Agent&); + QMF_EXTERN Agent& operator=(const Agent&); + QMF_EXTERN ~Agent(); + + QMF_EXTERN std::string getName() const; + QMF_EXTERN uint32_t getEpoch() const; + QMF_EXTERN std::string getVendor() const; + QMF_EXTERN std::string getProduct() const; + QMF_EXTERN std::string getInstance() const; + QMF_EXTERN const qpid::types::Variant& getAttribute(const std::string&) const; + QMF_EXTERN const qpid::types::Variant::Map& getAttributes() const; + + QMF_EXTERN ConsoleEvent query(const Query&, qpid::messaging::Duration timeout=qpid::messaging::Duration::MINUTE); + QMF_EXTERN ConsoleEvent query(const std::string&, qpid::messaging::Duration timeout=qpid::messaging::Duration::MINUTE); + QMF_EXTERN uint32_t queryAsync(const Query&); + QMF_EXTERN uint32_t queryAsync(const std::string&); + + QMF_EXTERN ConsoleEvent callMethod(const std::string&, const qpid::types::Variant::Map&, const DataAddr&, + qpid::messaging::Duration timeout=qpid::messaging::Duration::MINUTE); + QMF_EXTERN uint32_t callMethodAsync(const std::string&, const qpid::types::Variant::Map&, const DataAddr&); + + QMF_EXTERN uint32_t getPackageCount() const; + QMF_EXTERN const std::string& getPackage(uint32_t) const; + QMF_EXTERN uint32_t getSchemaIdCount(const std::string&) const; + QMF_EXTERN SchemaId getSchemaId(const std::string&, uint32_t) const; + QMF_EXTERN Schema getSchema(const SchemaId&, qpid::messaging::Duration timeout=qpid::messaging::Duration::MINUTE); + + +#ifndef SWIG + private: + friend class qmf::PrivateImplRef<Agent>; + friend struct AgentImplAccess; +#endif + }; + +} + +#endif diff --git a/qpid/cpp/include/qmf/AgentEvent.h b/qpid/cpp/include/qmf/AgentEvent.h new file mode 100644 index 0000000000..59a41c3267 --- /dev/null +++ b/qpid/cpp/include/qmf/AgentEvent.h @@ -0,0 +1,74 @@ +#ifndef QMF_AGENT_EVENT_H +#define QMF_AGENT_EVENT_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. + * + */ + +#include <qmf/ImportExport.h> +#include "qmf/Handle.h" +#include "qpid/types/Variant.h" + +namespace qmf { + +#ifndef SWIG + template <class> class PrivateImplRef; +#endif + + class AgentEventImpl; + class Query; + class DataAddr; + + enum AgentEventCode { + AGENT_AUTH_QUERY = 1, + AGENT_AUTH_SUBSCRIBE = 2, + AGENT_QUERY = 3, + AGENT_METHOD = 4, + AGENT_SUBSCRIBE_BEGIN = 5, + AGENT_SUBSCRIBE_TOUCH = 6, + AGENT_SUBSCRIBE_END = 7, + AGENT_THREAD_FAILED = 8 + }; + + class AgentEvent : public qmf::Handle<AgentEventImpl> { + public: + QMF_EXTERN AgentEvent(AgentEventImpl* impl = 0); + QMF_EXTERN AgentEvent(const AgentEvent&); + QMF_EXTERN AgentEvent& operator=(const AgentEvent&); + QMF_EXTERN ~AgentEvent(); + + QMF_EXTERN AgentEventCode getType() const; + QMF_EXTERN const std::string& getUserId() const; + QMF_EXTERN Query getQuery() const; + QMF_EXTERN bool hasDataAddr() const; + QMF_EXTERN DataAddr getDataAddr() const; + QMF_EXTERN const std::string& getMethodName() const; + QMF_EXTERN qpid::types::Variant::Map& getArguments(); + QMF_EXTERN qpid::types::Variant::Map& getArgumentSubtypes(); + QMF_EXTERN void addReturnArgument(const std::string&, const qpid::types::Variant&, const std::string& st=""); + +#ifndef SWIG + private: + friend class qmf::PrivateImplRef<AgentEvent>; + friend struct AgentEventImplAccess; +#endif + }; +} + +#endif diff --git a/qpid/cpp/include/qmf/AgentSession.h b/qpid/cpp/include/qmf/AgentSession.h new file mode 100644 index 0000000000..5259aee360 --- /dev/null +++ b/qpid/cpp/include/qmf/AgentSession.h @@ -0,0 +1,93 @@ +#ifndef QMF_AGENT_SESSION_H +#define QMF_AGENT_SESSION_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. + * + */ + +#include <qmf/ImportExport.h> +#include "qmf/Handle.h" +#include "qpid/messaging/Duration.h" +#include "qpid/messaging/Connection.h" +#include "qpid/types/Variant.h" +#include <string> + +namespace qmf { + +#ifndef SWIG + template <class> class PrivateImplRef; +#endif + + class AgentSessionImpl; + class AgentEvent; + class Schema; + class Data; + class DataAddr; + + class AgentSession : public qmf::Handle<AgentSessionImpl> { + public: + QMF_EXTERN AgentSession(AgentSessionImpl* impl = 0); + QMF_EXTERN AgentSession(const AgentSession&); + QMF_EXTERN AgentSession& operator=(const AgentSession&); + QMF_EXTERN ~AgentSession(); + + /** + * + * The options string is of the form "{key:value,key:value}". The following keys are supported: + * + * interval:N - Heartbeat interval in seconds [default: 60] + * external:{True,False} - Use external data storage (queries are pass-through) [default: False] + * allow-queries:{True,False} - If True: automatically allow all queries [default] + * If False: generate an AUTH_QUERY event to allow per-query authorization + * allow-methods:{True,False} - If True: automatically allow all methods [default] + * If False: generate an AUTH_METHOD event to allow per-method authorization + */ + QMF_EXTERN AgentSession(qpid::messaging::Connection&, const std::string& options=""); + QMF_EXTERN void setDomain(const std::string&); + QMF_EXTERN void setVendor(const std::string&); + QMF_EXTERN void setProduct(const std::string&); + QMF_EXTERN void setInstance(const std::string&); + QMF_EXTERN void setAttribute(const std::string&, const qpid::types::Variant&); + QMF_EXTERN const std::string& getName() const; + QMF_EXTERN void open(); + QMF_EXTERN void close(); + QMF_EXTERN bool nextEvent(AgentEvent&, qpid::messaging::Duration timeout=qpid::messaging::Duration::FOREVER); + + QMF_EXTERN void registerSchema(Schema&); + QMF_EXTERN DataAddr addData(Data&, const std::string& name="", bool persistent=false); + QMF_EXTERN void delData(const DataAddr&); + + QMF_EXTERN void authAccept(AgentEvent&); + QMF_EXTERN void authReject(AgentEvent&, const std::string& diag=""); + QMF_EXTERN void raiseException(AgentEvent&, const std::string&); + QMF_EXTERN void raiseException(AgentEvent&, const Data&); + QMF_EXTERN void response(AgentEvent&, const Data&); + QMF_EXTERN void complete(AgentEvent&); + QMF_EXTERN void methodSuccess(AgentEvent&); + QMF_EXTERN void raiseEvent(const Data&); + +#ifndef SWIG + private: + friend class qmf::PrivateImplRef<AgentSession>; +#endif + }; + +} + +#endif diff --git a/qpid/cpp/include/qmf/ConsoleEvent.h b/qpid/cpp/include/qmf/ConsoleEvent.h new file mode 100644 index 0000000000..61f625b137 --- /dev/null +++ b/qpid/cpp/include/qmf/ConsoleEvent.h @@ -0,0 +1,73 @@ +#ifndef QMF_CONSOLE_EVENT_H +#define QMF_CONSOLE_EVENT_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. + * + */ + +#include <qmf/ImportExport.h> +#include "qmf/Handle.h" +#include "qpid/types/Variant.h" + +namespace qmf { + +#ifndef SWIG + template <class> class PrivateImplRef; +#endif + + class ConsoleEventImpl; + class Agent; + class Data; + + enum ConsoleEventCode { + CONSOLE_AGENT_ADD = 1, + CONSOLE_AGENT_AGE = 2, + CONSOLE_EVENT = 3, + CONSOLE_QUERY_RESPONSE = 4, + CONSOLE_METHOD_RESPONSE = 5, + CONSOLE_EXCEPTION = 6, + CONSOLE_SUBSCRIBE_UPDATE = 7, + CONSOLE_THREAD_FAILED = 8 + }; + + class ConsoleEvent : public qmf::Handle<ConsoleEventImpl> { + public: + QMF_EXTERN ConsoleEvent(ConsoleEventImpl* impl = 0); + QMF_EXTERN ConsoleEvent(const ConsoleEvent&); + QMF_EXTERN ConsoleEvent& operator=(const ConsoleEvent&); + QMF_EXTERN ~ConsoleEvent(); + + QMF_EXTERN ConsoleEventCode getType() const; + QMF_EXTERN uint32_t getCorrelator() const; + QMF_EXTERN Agent getAgent() const; + QMF_EXTERN uint32_t getDataCount() const; + QMF_EXTERN Data getData(uint32_t) const; + QMF_EXTERN bool isFinal() const; + QMF_EXTERN const qpid::types::Variant::Map& getArguments() const; + +#ifndef SWIG + private: + friend class qmf::PrivateImplRef<ConsoleEvent>; + friend struct ConsoleEventImplAccess; +#endif + }; + +} + +#endif diff --git a/qpid/cpp/include/qmf/ConsoleSession.h b/qpid/cpp/include/qmf/ConsoleSession.h new file mode 100644 index 0000000000..0e58a647d6 --- /dev/null +++ b/qpid/cpp/include/qmf/ConsoleSession.h @@ -0,0 +1,65 @@ +#ifndef QMF_CONSOLE_SESSION_H +#define QMF_CONSOLE_SESSION_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. + * + */ + +#include <qmf/ImportExport.h> +#include "qmf/Handle.h" +#include "qmf/Agent.h" +#include "qpid/messaging/Duration.h" +#include "qpid/messaging/Connection.h" +#include <string> + +namespace qmf { + +#ifndef SWIG + template <class> class PrivateImplRef; +#endif + + class ConsoleSessionImpl; + class ConsoleEvent; + + class ConsoleSession : public qmf::Handle<ConsoleSessionImpl> { + public: + QMF_EXTERN ConsoleSession(ConsoleSessionImpl* impl = 0); + QMF_EXTERN ConsoleSession(const ConsoleSession&); + QMF_EXTERN ConsoleSession& operator=(const ConsoleSession&); + QMF_EXTERN ~ConsoleSession(); + + QMF_EXTERN ConsoleSession(qpid::messaging::Connection&, const std::string& options=""); + QMF_EXTERN void setDomain(const std::string&); + QMF_EXTERN void setAgentFilter(const std::string&); + QMF_EXTERN void open(); + QMF_EXTERN void close(); + QMF_EXTERN bool nextEvent(ConsoleEvent&, qpid::messaging::Duration timeout=qpid::messaging::Duration::FOREVER); + QMF_EXTERN uint32_t getAgentCount() const; + QMF_EXTERN Agent getAgent(uint32_t) const; + QMF_EXTERN Agent getConnectedBrokerAgent() const; + +#ifndef SWIG + private: + friend class qmf::PrivateImplRef<ConsoleSession>; +#endif + }; + +} + +#endif diff --git a/qpid/cpp/include/qmf/Data.h b/qpid/cpp/include/qmf/Data.h new file mode 100644 index 0000000000..27af1c4b04 --- /dev/null +++ b/qpid/cpp/include/qmf/Data.h @@ -0,0 +1,71 @@ +#ifndef QMF_DATA_H +#define QMF_DATA_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. + * + */ + +#include <qmf/ImportExport.h> +#include "qmf/Handle.h" +#include "qmf/exceptions.h" +#include "qpid/types/Variant.h" +#include <string> + +namespace qmf { + +#ifndef SWIG + template <class> class PrivateImplRef; +#endif + + class DataImpl; + class SchemaId; + class DataAddr; + class Agent; + + class Data : public qmf::Handle<DataImpl> { + public: + QMF_EXTERN Data(DataImpl* impl = 0); + QMF_EXTERN Data(const Data&); + QMF_EXTERN Data& operator=(const Data&); + QMF_EXTERN ~Data(); + + QMF_EXTERN Data(const SchemaId&); + QMF_EXTERN void setSchema(const SchemaId&); + QMF_EXTERN void setAddr(const DataAddr&); + QMF_EXTERN void setProperty(const std::string&, const qpid::types::Variant&); + QMF_EXTERN void overwriteProperties(const qpid::types::Variant::Map&); + QMF_EXTERN bool hasSchema() const; + QMF_EXTERN bool hasAddr() const; + QMF_EXTERN const SchemaId& getSchemaId() const; + QMF_EXTERN const DataAddr& getAddr() const; + QMF_EXTERN const qpid::types::Variant& getProperty(const std::string&) const; + QMF_EXTERN const qpid::types::Variant::Map& getProperties() const; + QMF_EXTERN bool hasAgent() const; + QMF_EXTERN const Agent& getAgent() const; + +#ifndef SWIG + private: + friend class qmf::PrivateImplRef<Data>; + friend struct DataImplAccess; +#endif + }; + +} + +#endif diff --git a/qpid/cpp/include/qmf/DataAddr.h b/qpid/cpp/include/qmf/DataAddr.h new file mode 100644 index 0000000000..fd8a8599c1 --- /dev/null +++ b/qpid/cpp/include/qmf/DataAddr.h @@ -0,0 +1,62 @@ +#ifndef QMF_DATA_ADDR_H +#define QMF_DATA_ADDR_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. + * + */ + +#include <qmf/ImportExport.h> +#include "qmf/Handle.h" +#include "qpid/types/Variant.h" +#include <string> + +namespace qmf { + +#ifndef SWIG + template <class> class PrivateImplRef; +#endif + + class DataAddrImpl; + + class DataAddr : public qmf::Handle<DataAddrImpl> { + public: + QMF_EXTERN DataAddr(DataAddrImpl* impl = 0); + QMF_EXTERN DataAddr(const DataAddr&); + QMF_EXTERN DataAddr& operator=(const DataAddr&); + QMF_EXTERN ~DataAddr(); + + QMF_EXTERN bool operator==(const DataAddr&); + QMF_EXTERN bool operator<(const DataAddr&); + + QMF_EXTERN DataAddr(const std::string& name, const std::string& agentName, uint32_t agentEpoch=0); + QMF_EXTERN const std::string& getName() const; + QMF_EXTERN const std::string& getAgentName() const; + QMF_EXTERN uint32_t getAgentEpoch() const; + QMF_EXTERN qpid::types::Variant::Map asMap() const; + +#ifndef SWIG + private: + friend class qmf::PrivateImplRef<DataAddr>; + friend struct DataAddrImplAccess; +#endif + }; + +} + +#endif diff --git a/qpid/cpp/include/qmf/Handle.h b/qpid/cpp/include/qmf/Handle.h new file mode 100644 index 0000000000..510e2993aa --- /dev/null +++ b/qpid/cpp/include/qmf/Handle.h @@ -0,0 +1,70 @@ +#ifndef QMF_HANDLE_H +#define QMF_HANDLE_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. + * + */ + +#include "qmf/ImportExport.h" + +namespace qmf { + +template <class> class PrivateImplRef; + +/** \ingroup qmf + * A handle is like a pointer: refers to an underlying implementation object. + * Copying the handle does not copy the object. + * + * Handles can be null, like a 0 pointer. Use isValid(), isNull() or the + * conversion to bool to test for a null handle. + */ +template <class T> class Handle { + public: + + /**@return true if handle is valid, i.e. not null. */ + QMF_EXTERN bool isValid() const { return impl; } + + /**@return true if handle is null. It is an error to call any function on a null handle. */ + QMF_EXTERN bool isNull() const { return !impl; } + + /** Conversion to bool supports idiom if (handle) { handle->... } */ + QMF_EXTERN operator bool() const { return impl; } + + /** Operator ! supports idiom if (!handle) { do_if_handle_is_null(); } */ + QMF_EXTERN bool operator !() const { return !impl; } + + void swap(Handle<T>& h) { T* t = h.impl; h.impl = impl; impl = t; } + + protected: + typedef T Impl; + QMF_EXTERN Handle() :impl() {} + + // Not implemented,subclasses must implement. + QMF_EXTERN Handle(const Handle&); + QMF_EXTERN Handle& operator=(const Handle&); + + Impl* impl; + + friend class PrivateImplRef<T>; +}; + +} // namespace qmf + +#endif /*!QMF_HANDLE_H*/ diff --git a/qpid/cpp/include/qmf/ImportExport.h b/qpid/cpp/include/qmf/ImportExport.h new file mode 100644 index 0000000000..f5e1d9127c --- /dev/null +++ b/qpid/cpp/include/qmf/ImportExport.h @@ -0,0 +1,33 @@ +#ifndef QMF_IMPORT_EXPORT_H +#define QMF_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(QMF_EXPORT) || defined (qmfcommon_EXPORTS) +# define QMF_EXTERN __declspec(dllexport) +# else +# define QMF_EXTERN __declspec(dllimport) +# endif +#else +# define QMF_EXTERN +#endif + +#endif diff --git a/qpid/cpp/include/qmf/Query.h b/qpid/cpp/include/qmf/Query.h new file mode 100644 index 0000000000..71ef31b104 --- /dev/null +++ b/qpid/cpp/include/qmf/Query.h @@ -0,0 +1,65 @@ +#ifndef QMF_QUERY_H +#define QMF_QUERY_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. + * + */ + +#include <qmf/ImportExport.h> +#include "qmf/Handle.h" +#include "qpid/types/Variant.h" +#include <string> + +namespace qmf { + +#ifndef SWIG + template <class> class PrivateImplRef; +#endif + + class QueryImpl; + class SchemaId; + class DataAddr; + + class Query : public qmf::Handle<QueryImpl> { + public: + QMF_EXTERN Query(QueryImpl* impl = 0); + QMF_EXTERN Query(const Query&); + QMF_EXTERN Query& operator=(const Query&); + QMF_EXTERN ~Query(); + + QMF_EXTERN Query(const std::string& className, const std::string& package="", const std::string& predicate=""); + QMF_EXTERN Query(const SchemaId&); + QMF_EXTERN Query(const DataAddr&); + + QMF_EXTERN const DataAddr& getDataAddr() const; + QMF_EXTERN const SchemaId& getSchemaId() const; + QMF_EXTERN const std::string& getClassName() const; + QMF_EXTERN const std::string& getPackageName() const; + QMF_EXTERN void addPredicate(const std::string&, const qpid::types::Variant&); + QMF_EXTERN const qpid::types::Variant::Map& getPredicate() const; + +#ifndef SWIG + private: + friend class qmf::PrivateImplRef<Query>; +#endif + }; + +} + +#endif diff --git a/qpid/cpp/include/qmf/Schema.h b/qpid/cpp/include/qmf/Schema.h new file mode 100644 index 0000000000..cf316138c1 --- /dev/null +++ b/qpid/cpp/include/qmf/Schema.h @@ -0,0 +1,76 @@ +#ifndef QMF_SCHEMA_H +#define QMF_SCHEMA_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. + * + */ + +#include <qmf/ImportExport.h> +#include "qpid/sys/IntegerTypes.h" +#include "qmf/Handle.h" +#include "qmf/SchemaTypes.h" +#include <string> + +namespace qmf { + +#ifndef SWIG + template <class> class PrivateImplRef; +#endif + + class SchemaImpl; + class SchemaId; + class SchemaProperty; + class SchemaMethod; + + class Schema : public qmf::Handle<SchemaImpl> { + public: + QMF_EXTERN Schema(SchemaImpl* impl = 0); + QMF_EXTERN Schema(const Schema&); + QMF_EXTERN Schema& operator=(const Schema&); + QMF_EXTERN ~Schema(); + + QMF_EXTERN Schema(int, const std::string&, const std::string&); + QMF_EXTERN const SchemaId& getSchemaId() const; + + QMF_EXTERN void finalize(); + QMF_EXTERN bool isFinalized() const; + QMF_EXTERN void addProperty(const SchemaProperty&); + QMF_EXTERN void addMethod(const SchemaMethod&); + QMF_EXTERN void setDesc(const std::string&); + QMF_EXTERN const std::string& getDesc() const; + + QMF_EXTERN void setDefaultSeverity(int); + QMF_EXTERN int getDefaultSeverity() const; + + QMF_EXTERN uint32_t getPropertyCount() const; + QMF_EXTERN SchemaProperty getProperty(uint32_t) const; + + QMF_EXTERN uint32_t getMethodCount() const; + QMF_EXTERN SchemaMethod getMethod(uint32_t) const; + +#ifndef SWIG + private: + friend class qmf::PrivateImplRef<Schema>; + friend struct SchemaImplAccess; +#endif + }; + +} + +#endif diff --git a/qpid/cpp/include/qmf/SchemaId.h b/qpid/cpp/include/qmf/SchemaId.h new file mode 100644 index 0000000000..13fb1cb902 --- /dev/null +++ b/qpid/cpp/include/qmf/SchemaId.h @@ -0,0 +1,61 @@ +#ifndef QMF_SCHEMA_ID_H +#define QMF_SCHEMA_ID_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. + * + */ + +#include <qmf/ImportExport.h> +#include "qmf/Handle.h" +#include "qpid/types/Uuid.h" +#include "qmf/SchemaTypes.h" +#include <string> + +namespace qmf { + +#ifndef SWIG + template <class> class PrivateImplRef; +#endif + + class SchemaIdImpl; + + class SchemaId : public qmf::Handle<SchemaIdImpl> { + public: + QMF_EXTERN SchemaId(SchemaIdImpl* impl = 0); + QMF_EXTERN SchemaId(const SchemaId&); + QMF_EXTERN SchemaId& operator=(const SchemaId&); + QMF_EXTERN ~SchemaId(); + + QMF_EXTERN SchemaId(int, const std::string&, const std::string&); + QMF_EXTERN void setHash(const qpid::types::Uuid&); + QMF_EXTERN int getType() const; + QMF_EXTERN const std::string& getPackageName() const; + QMF_EXTERN const std::string& getName() const; + QMF_EXTERN const qpid::types::Uuid& getHash() const; + +#ifndef SWIG + private: + friend class qmf::PrivateImplRef<SchemaId>; + friend struct SchemaIdImplAccess; +#endif + }; + +} + +#endif diff --git a/qpid/cpp/include/qmf/SchemaMethod.h b/qpid/cpp/include/qmf/SchemaMethod.h new file mode 100644 index 0000000000..47302b62b9 --- /dev/null +++ b/qpid/cpp/include/qmf/SchemaMethod.h @@ -0,0 +1,65 @@ +#ifndef QMF_SCHEMA_METHOD_H +#define QMF_SCHEMA_METHOD_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. + * + */ + +#include "qmf/ImportExport.h" +#include "qpid/sys/IntegerTypes.h" +#include "qmf/Handle.h" +#include "qmf/SchemaTypes.h" +#include <string> + +namespace qmf { + +#ifndef SWIG + template <class> class PrivateImplRef; +#endif + + class SchemaMethodImpl; + class SchemaProperty; + + class SchemaMethod : public qmf::Handle<SchemaMethodImpl> { + public: + QMF_EXTERN SchemaMethod(SchemaMethodImpl* impl = 0); + QMF_EXTERN SchemaMethod(const SchemaMethod&); + QMF_EXTERN SchemaMethod& operator=(const SchemaMethod&); + QMF_EXTERN ~SchemaMethod(); + + QMF_EXTERN SchemaMethod(const std::string&, const std::string& o=""); + + QMF_EXTERN void setDesc(const std::string&); + QMF_EXTERN void addArgument(const SchemaProperty&); + + QMF_EXTERN const std::string& getName() const; + QMF_EXTERN const std::string& getDesc() const; + QMF_EXTERN uint32_t getArgumentCount() const; + QMF_EXTERN SchemaProperty getArgument(uint32_t) const; + +#ifndef SWIG + private: + friend class qmf::PrivateImplRef<SchemaMethod>; + friend struct SchemaMethodImplAccess; +#endif + }; + +} + +#endif diff --git a/qpid/cpp/include/qmf/SchemaProperty.h b/qpid/cpp/include/qmf/SchemaProperty.h new file mode 100644 index 0000000000..2e770c2ef1 --- /dev/null +++ b/qpid/cpp/include/qmf/SchemaProperty.h @@ -0,0 +1,74 @@ +#ifndef QMF_SCHEMA_PROPERTY_H +#define QMF_SCHEMA_PROPERTY_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. + * + */ + +#include <qmf/ImportExport.h> +#include "qmf/Handle.h" +#include "qpid/types/Uuid.h" +#include "qpid/types/Variant.h" +#include "qmf/SchemaTypes.h" +#include <string> + +namespace qmf { + +#ifndef SWIG + template <class> class PrivateImplRef; +#endif + + class SchemaPropertyImpl; + + class SchemaProperty : public Handle<SchemaPropertyImpl> { + public: + QMF_EXTERN SchemaProperty(SchemaPropertyImpl* impl = 0); + QMF_EXTERN SchemaProperty(const SchemaProperty&); + QMF_EXTERN SchemaProperty& operator=(const SchemaProperty&); + QMF_EXTERN ~SchemaProperty(); + + QMF_EXTERN SchemaProperty(const std::string&, int, const std::string& o=""); + + QMF_EXTERN void setAccess(int); + QMF_EXTERN void setIndex(bool); + QMF_EXTERN void setOptional(bool); + QMF_EXTERN void setUnit(const std::string&); + QMF_EXTERN void setDesc(const std::string&); + QMF_EXTERN void setSubtype(const std::string&); + QMF_EXTERN void setDirection(int); + + QMF_EXTERN const std::string& getName() const; + QMF_EXTERN int getAccess() const; + QMF_EXTERN bool isIndex() const; + QMF_EXTERN bool isOptional() const; + QMF_EXTERN const std::string& getUnit() const; + QMF_EXTERN const std::string& getDesc() const; + QMF_EXTERN const std::string& getSubtype() const; + QMF_EXTERN int getDirection() const; + +#ifndef SWIG + private: + friend class qmf::PrivateImplRef<SchemaProperty>; + friend struct SchemaPropertyImplAccess; +#endif + }; + +} + +#endif diff --git a/qpid/cpp/include/qmf/SchemaTypes.h b/qpid/cpp/include/qmf/SchemaTypes.h new file mode 100644 index 0000000000..af3da612e5 --- /dev/null +++ b/qpid/cpp/include/qmf/SchemaTypes.h @@ -0,0 +1,56 @@ +#ifndef QMF_SCHEMA_TYPES_H +#define QMF_SCHEMA_TYPES_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. + * + */ + +namespace qmf { + + const int SCHEMA_TYPE_DATA = 1; + const int SCHEMA_TYPE_EVENT = 2; + + const int SCHEMA_DATA_VOID = 1; + const int SCHEMA_DATA_BOOL = 2; + const int SCHEMA_DATA_INT = 3; + const int SCHEMA_DATA_FLOAT = 4; + const int SCHEMA_DATA_STRING = 5; + const int SCHEMA_DATA_MAP = 6; + const int SCHEMA_DATA_LIST = 7; + const int SCHEMA_DATA_UUID = 8; + + const int ACCESS_READ_CREATE = 1; + const int ACCESS_READ_WRITE = 2; + const int ACCESS_READ_ONLY = 3; + + const int DIR_IN = 1; + const int DIR_OUT = 2; + const int DIR_IN_OUT = 3; + + const int SEV_EMERG = 0; + const int SEV_ALERT = 1; + const int SEV_CRIT = 2; + const int SEV_ERROR = 3; + const int SEV_WARN = 4; + const int SEV_NOTICE = 5; + const int SEV_INFORM = 6; + const int SEV_DEBUG = 7; +} + +#endif diff --git a/qpid/cpp/include/qmf/exceptions.h b/qpid/cpp/include/qmf/exceptions.h new file mode 100644 index 0000000000..7959499d63 --- /dev/null +++ b/qpid/cpp/include/qmf/exceptions.h @@ -0,0 +1,59 @@ +#ifndef QMF_EXCEPTIONS_H +#define QMF_EXCEPTIONS_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. + * + */ + +#include "qmf/ImportExport.h" +#include "qpid/types/Exception.h" +#include "qpid/types/Variant.h" + +namespace qmf { + +/** \ingroup qmf + */ + + struct QmfException : public qpid::types::Exception { + QMF_EXTERN QmfException(const std::string& msg); + QMF_EXTERN virtual ~QmfException() throw(); + + qpid::types::Variant::Map detail; + }; + + struct KeyNotFound : public QmfException { + QMF_EXTERN KeyNotFound(const std::string& msg); + QMF_EXTERN virtual ~KeyNotFound() throw(); + }; + + struct IndexOutOfRange : public QmfException { + QMF_EXTERN IndexOutOfRange(); + QMF_EXTERN virtual ~IndexOutOfRange() throw(); + }; + + struct OperationTimedOut : public QmfException { + QMF_EXTERN OperationTimedOut(); + QMF_EXTERN virtual ~OperationTimedOut() throw(); + }; + +} + +#endif + |