You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@qpid.apache.org by ac...@apache.org on 2015/06/18 23:58:17 UTC
[39/50] [abbrv] qpid-proton git commit: PROTON-865: Stream like
Encoder/Decoder and AMQP Value type for C++ binding.
PROTON-865: Stream like Encoder/Decoder and AMQP Value type for C++ binding.
See Encoder.h, Decoder.h, Value.h for details.
Encoder/Decoder use operator << and >> to encode/decode AMQP values.
Value is a variant-like type that can hold an arbitrary AMQP value.
Simple types are implemented, complex types coming next.
Project: http://git-wip-us.apache.org/repos/asf/qpid-proton/repo
Commit: http://git-wip-us.apache.org/repos/asf/qpid-proton/commit/ea258831
Tree: http://git-wip-us.apache.org/repos/asf/qpid-proton/tree/ea258831
Diff: http://git-wip-us.apache.org/repos/asf/qpid-proton/diff/ea258831
Branch: refs/heads/cjansen-cpp-client
Commit: ea2588316da215ce7c1b8fe336e97ab9e94ad30c
Parents: f6d6dc7
Author: Alan Conway <ac...@redhat.com>
Authored: Fri Jun 5 14:56:17 2015 -0400
Committer: Alan Conway <ac...@redhat.com>
Committed: Thu Jun 18 17:28:44 2015 -0400
----------------------------------------------------------------------
proton-c/CMakeLists.txt | 5 +-
proton-c/bindings/CMakeLists.txt | 170 +++++-----
proton-c/bindings/cpp/CMakeLists.txt | 44 ++-
proton-c/bindings/cpp/README.md | 10 +-
.../bindings/cpp/include/proton/cpp/Acceptor.h | 12 +-
.../bindings/cpp/include/proton/cpp/Acking.h | 8 +-
.../cpp/include/proton/cpp/BlockingConnection.h | 20 +-
.../cpp/include/proton/cpp/BlockingLink.h | 6 +-
.../cpp/include/proton/cpp/BlockingSender.h | 6 +-
.../cpp/include/proton/cpp/Connection.h | 32 +-
.../bindings/cpp/include/proton/cpp/Container.h | 44 +--
proton-c/bindings/cpp/include/proton/cpp/Data.h | 55 ++++
.../bindings/cpp/include/proton/cpp/Decoder.h | 165 ++++++++++
.../bindings/cpp/include/proton/cpp/Delivery.h | 16 +-
.../bindings/cpp/include/proton/cpp/Duration.h | 20 +-
.../bindings/cpp/include/proton/cpp/Encoder.h | 108 +++++++
.../bindings/cpp/include/proton/cpp/Endpoint.h | 4 +-
.../bindings/cpp/include/proton/cpp/Event.h | 24 +-
.../bindings/cpp/include/proton/cpp/Exception.h | 49 +++
.../bindings/cpp/include/proton/cpp/Handle.h | 2 +
.../bindings/cpp/include/proton/cpp/Handler.h | 14 +-
.../cpp/include/proton/cpp/ImportExport.h | 4 +-
proton-c/bindings/cpp/include/proton/cpp/Link.h | 36 +--
.../bindings/cpp/include/proton/cpp/Message.h | 104 ++++---
.../cpp/include/proton/cpp/MessagingAdapter.h | 62 ++--
.../cpp/include/proton/cpp/MessagingEvent.h | 14 +-
.../cpp/include/proton/cpp/MessagingHandler.h | 6 +-
.../cpp/include/proton/cpp/ProtonEvent.h | 18 +-
.../cpp/include/proton/cpp/ProtonHandler.h | 2 +-
.../bindings/cpp/include/proton/cpp/Receiver.h | 6 +-
.../bindings/cpp/include/proton/cpp/Sender.h | 8 +-
.../bindings/cpp/include/proton/cpp/Session.h | 18 +-
.../bindings/cpp/include/proton/cpp/Terminus.h | 32 +-
.../bindings/cpp/include/proton/cpp/Transport.h | 6 +-
.../bindings/cpp/include/proton/cpp/Value.h | 103 +++++++
.../cpp/include/proton/cpp/WaitCondition.h | 2 +-
.../bindings/cpp/include/proton/cpp/types.h | 162 ++++++++++
proton-c/bindings/cpp/src/ConnectionImpl.h | 26 +-
proton-c/bindings/cpp/src/ContainerImpl.h | 28 +-
proton-c/bindings/cpp/src/Data.cpp | 48 +++
proton-c/bindings/cpp/src/Decoder.cpp | 265 ++++++++++++++++
proton-c/bindings/cpp/src/Encoder.cpp | 104 +++++++
proton-c/bindings/cpp/src/Msg.h | 2 +-
proton-c/bindings/cpp/src/Url.h | 14 +-
proton-c/bindings/cpp/src/Value.cpp | 71 +++++
.../cpp/src/blocking/BlockingConnectionImpl.h | 12 +-
proton-c/bindings/cpp/src/grep | 50 +++
proton-c/bindings/cpp/src/interop_test.cpp | 147 +++++++++
proton-c/bindings/cpp/src/platform.cpp | 2 +
proton-c/bindings/cpp/src/pn_data.h | 30 ++
proton-c/bindings/cpp/src/proton_bits.cpp | 48 +++
proton-c/bindings/cpp/src/proton_bits.h | 39 +++
proton-c/bindings/cpp/src/types.cpp | 82 +++++
.../proton/go/amqp/interop_test.go | 308 +++++++++++++++++++
54 files changed, 2277 insertions(+), 396 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/ea258831/proton-c/CMakeLists.txt
----------------------------------------------------------------------
diff --git a/proton-c/CMakeLists.txt b/proton-c/CMakeLists.txt
index 288e694..049755e 100644
--- a/proton-c/CMakeLists.txt
+++ b/proton-c/CMakeLists.txt
@@ -258,10 +258,7 @@ macro (pn_absolute_install_dir NAME VALUE PREFIX)
get_filename_component(${NAME} ${${NAME}} ABSOLUTE)
endmacro()
-if (SWIG_FOUND)
- add_subdirectory(bindings)
-endif (SWIG_FOUND)
-
+add_subdirectory(bindings)
add_subdirectory(docs/api)
add_subdirectory(docs/man)
add_subdirectory(../tests/tools/apps/c ../tests/tools/apps/c)
http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/ea258831/proton-c/bindings/CMakeLists.txt
----------------------------------------------------------------------
diff --git a/proton-c/bindings/CMakeLists.txt b/proton-c/bindings/CMakeLists.txt
index e976bc7..c735ea0 100644
--- a/proton-c/bindings/CMakeLists.txt
+++ b/proton-c/bindings/CMakeLists.txt
@@ -17,91 +17,13 @@
# under the License.
#
-include(UseSWIG)
+# Add bindings that do not require swig here - the directory name must be the same as the binding name
+# See below for swig bindings
+set(BINDINGS javascript cpp)
-# Add any new bindings here - the directory name must be the same as the binding name
-set (BINDINGS python ruby php perl javascript cpp)
-
-# All swig modules should include ${PROTON_HEADERS} in SWIG_MODULE_<name>_EXTRA_DEPS
-file(GLOB PROTON_HEADERS "${CMAKE_SOURCE_DIR}/proton-c/include/proton/*.h")
-
-# If swig version is 3.0 or greater then we can build some additional bindings
-if (${SWIG_VERSION} VERSION_GREATER 3.0 OR ${SWIG_VERSION} VERSION_EQUAL 3.0)
- set (BINDINGS
- ${BINDINGS}
- node
- )
-endif()
-
-set (BINDING_DEPS qpid-proton)
-
-# Add a block here to detect the prerequisites to build each language binding:
+# Prerequisites for javascript.
#
-# If the prerequisites for the binding are present set a variable called
-# DEFAULT_{uppercase name of binding} to ON
-
-# Prerequisites for Python wrapper:
-find_package (PythonLibs)
-if (PYTHONLIBS_FOUND)
- set (DEFAULT_PYTHON ON)
-endif (PYTHONLIBS_FOUND)
-
-# Prerequisites for Ruby:
-find_program(GEM_EXE "gem")
-mark_as_advanced(GEM_EXE)
-macro(CheckRubyGem varname gemname)
- execute_process(COMMAND ${GEM_EXE} list --local ${gemname}
- OUTPUT_VARIABLE CHECK_OUTPUT)
-
- set (${varname} OFF)
-
- if (CHECK_OUTPUT MATCHES "${gemname}[ ]+\(.*\)")
- message(STATUS "Found Ruby gem: ${gemname}")
- set (${varname} ON)
- else()
- message(STATUS "Missing Ruby gem dependency: ${gemname}")
- set (${varname} OFF)
- endif()
-endmacro()
-
-find_package(Ruby)
-if (RUBY_FOUND)
- set (DEFAULT_RUBY ON)
-
- CheckRubyGem("HAS_RUBY_GEM_RSPEC" "rspec")
- CheckRubyGem("HAS_RUBY_GEM_SIMPLECOV" "simplecov")
-
- if (HAS_RUBY_GEM_RSPEC AND HAS_RUBY_GEM_SIMPLECOV)
- set (DEFAULT_RUBY_TESTING ON CACHE INTERNAL "")
- else()
- message(STATUS "Skipping Ruby bindings due to missing dependencies...")
- set (DEFAULT_RUBY_TESTING OFF CACHE INTERNAL "")
- set (DEFAULT_RUBY OFF)
- endif (HAS_RUBY_GEM_RSPEC AND HAS_RUBY_GEM_SIMPLECOV)
-endif (RUBY_FOUND)
-
-# Prerequites for PHP:
-# For now, assume PHP support if the 'php-config' tool is present.
-# @todo: allow user to specify which php-config if multiple PHP sources installed!
-find_program(PHP_CONFIG_EXE php-config)
-if (PHP_CONFIG_EXE)
- find_program(PHP_EXE php)
- mark_as_advanced (PHP_EXE)
- if (PHP_EXE)
- set (DEFAULT_PHP ON)
- endif (PHP_EXE)
-endif (PHP_CONFIG_EXE)
-mark_as_advanced (PHP_CONFIG_EXE)
-
-# Prerequisites for Perl:
-include(ProtonFindPerl)
-if (PERLLIBS_FOUND)
- set (DEFAULT_PERL ON)
-endif (PERLLIBS_FOUND)
-
-# Prerequisites for the javascript "binding":
-# This is somewhat different to the other language bindings in that it does not use swig. It uses a C/C++ to
-# JavaScript cross-compiler called emscripten (https://github.com/kripken/emscripten). Emscripten takes C/C++
+# It uses a C/C++ to JavaScript cross-compiler called emscripten (https://github.com/kripken/emscripten). Emscripten takes C/C++
# and compiles it into a highly optimisable subset of JavaScript called asm.js (http://asmjs.org/) that can be
# aggressively optimised and run at near-native speed (usually between 1.5 to 10 times slower than native C/C++).
find_package(Emscripten)
@@ -114,6 +36,88 @@ if (CMAKE_CXX_COMPILER)
set (DEFAULT_CPP ON)
endif (CMAKE_CXX_COMPILER)
+if(SWIG_FOUND)
+ # Add any new swig bindings here - the directory name must be the same as the binding name
+ list(APPEND BINDINGS python ruby php perl)
+
+ include(UseSWIG)
+
+ # All swig modules should include ${PROTON_HEADERS} in SWIG_MODULE_<name>_EXTRA_DEPS
+ file(GLOB PROTON_HEADERS "${CMAKE_SOURCE_DIR}/proton-c/include/proton/*.h")
+ # All swig modules should include ${BINDING_DEPS} in swig_link_libraries
+ set (BINDING_DEPS qpid-proton)
+
+ # If swig version is 3.0 or greater then we can build some additional bindings
+ if (${SWIG_VERSION} VERSION_GREATER 3.0 OR ${SWIG_VERSION} VERSION_EQUAL 3.0)
+ list(APPEND SWIG_BINDINGS node)
+ endif()
+
+ # Add a block here to detect the prerequisites to build each language binding:
+ #
+ # If the prerequisites for the binding are present set a variable called
+ # DEFAULT_{uppercase name of binding} to ON
+
+ # Prerequisites for Python wrapper:
+ find_package (PythonLibs)
+ if (PYTHONLIBS_FOUND)
+ set (DEFAULT_PYTHON ON)
+ endif (PYTHONLIBS_FOUND)
+
+ # Prerequisites for Ruby:
+ find_program(GEM_EXE "gem")
+ mark_as_advanced(GEM_EXE)
+ macro(CheckRubyGem varname gemname)
+ execute_process(COMMAND ${GEM_EXE} list --local ${gemname}
+ OUTPUT_VARIABLE CHECK_OUTPUT)
+
+ set (${varname} OFF)
+
+ if (CHECK_OUTPUT MATCHES "${gemname}[ ]+\(.*\)")
+ message(STATUS "Found Ruby gem: ${gemname}")
+ set (${varname} ON)
+ else()
+ message(STATUS "Missing Ruby gem dependency: ${gemname}")
+ set (${varname} OFF)
+ endif()
+ endmacro()
+
+ find_package(Ruby)
+ if (RUBY_FOUND)
+ set (DEFAULT_RUBY ON)
+
+ CheckRubyGem("HAS_RUBY_GEM_RSPEC" "rspec")
+ CheckRubyGem("HAS_RUBY_GEM_SIMPLECOV" "simplecov")
+
+ if (HAS_RUBY_GEM_RSPEC AND HAS_RUBY_GEM_SIMPLECOV)
+ set (DEFAULT_RUBY_TESTING ON CACHE INTERNAL "")
+ else()
+ message(STATUS "Skipping Ruby bindings due to missing dependencies...")
+ set (DEFAULT_RUBY_TESTING OFF CACHE INTERNAL "")
+ set (DEFAULT_RUBY OFF)
+ endif (HAS_RUBY_GEM_RSPEC AND HAS_RUBY_GEM_SIMPLECOV)
+ endif (RUBY_FOUND)
+
+ # Prerequites for PHP:
+ # For now, assume PHP support if the 'php-config' tool is present.
+ # @todo: allow user to specify which php-config if multiple PHP sources installed!
+ find_program(PHP_CONFIG_EXE php-config)
+ if (PHP_CONFIG_EXE)
+ find_program(PHP_EXE php)
+ mark_as_advanced (PHP_EXE)
+ if (PHP_EXE)
+ set (DEFAULT_PHP ON)
+ endif (PHP_EXE)
+ endif (PHP_CONFIG_EXE)
+ mark_as_advanced (PHP_CONFIG_EXE)
+
+ # Prerequisites for Perl:
+ include(ProtonFindPerl)
+ if (PERLLIBS_FOUND)
+ set (DEFAULT_PERL ON)
+ endif (PERLLIBS_FOUND)
+
+endif()
+
# Shouldn't need to modify below here when adding new language binding
foreach(BINDING ${BINDINGS})
string(TOUPPER ${BINDING} UBINDING)
http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/ea258831/proton-c/bindings/cpp/CMakeLists.txt
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/CMakeLists.txt b/proton-c/bindings/cpp/CMakeLists.txt
index f9e747c..6cad69f 100644
--- a/proton-c/bindings/cpp/CMakeLists.txt
+++ b/proton-c/bindings/cpp/CMakeLists.txt
@@ -17,6 +17,8 @@
# under the License.
#
+## Build
+
include_directories ("${CMAKE_CURRENT_SOURCE_DIR}/src")
include_directories ("${CMAKE_CURRENT_SOURCE_DIR}/include")
@@ -25,20 +27,23 @@ set (qpid-proton-cpp-platform
)
set (qpid-proton-cpp-core
+ src/Acceptor.cpp
+ src/Acking.cpp
src/Connection.cpp
src/ConnectionImpl.cpp
src/Connector.cpp
src/Connector.h
src/Container.cpp
src/ContainerImpl.cpp
+ src/Data.cpp
+ src/Decoder.cpp
+ src/Delivery.cpp
+ src/Duration.cpp
+ src/Encoder.cpp
src/Endpoint.cpp
src/Event.cpp
src/Handler.cpp
src/Link.cpp
- src/Terminus.cpp
- src/Acceptor.cpp
- src/Url.cpp
- src/Duration.cpp
src/Message.cpp
src/MessagingAdapter.cpp
src/MessagingEvent.cpp
@@ -48,14 +53,17 @@ set (qpid-proton-cpp-core
src/Receiver.cpp
src/Sender.cpp
src/Session.cpp
- src/Delivery.cpp
- src/Acking.cpp
+ src/Terminus.cpp
src/Transport.cpp
- src/contexts.cpp
+ src/Url.cpp
+ src/Value.cpp
+ src/proton_bits.cpp
src/blocking/BlockingConnection.cpp
src/blocking/BlockingConnectionImpl.cpp
src/blocking/BlockingLink.cpp
src/blocking/BlockingSender.cpp
+ src/contexts.cpp
+ src/types.cpp
)
set_source_files_properties (${qpid-proton-cpp-platform} PROPERTIES LANGUAGE CXX)
@@ -85,6 +93,28 @@ set_target_properties (
LINK_FLAGS "${CATCH_UNDEFINED}"
)
+## Test
+if (ENABLE_VALGRIND AND VALGRIND_EXE)
+ set(memcheck-cmd ${VALGRIND_EXE} --error-exitcode=1 --quiet --leak-check=full --trace-children=yes)
+endif ()
+
+macro(add_cpp_test test)
+ add_executable (${test} src/${test}.cpp)
+ target_link_libraries (${test} qpid-proton qpid-proton-cpp)
+ if (CMAKE_SYSTEM_NAME STREQUAL Windows)
+ add_test (NAME cpp_${test}
+ COMMAND ${env_py}
+ "PATH=$<TARGET_FILE_DIR:qpid-proton>"
+ ${test}> ${ARGN})
+ else ()
+ add_test (NAME cpp_${test} COMMAND ${memcheck-cmd} ${test} ${ARGN})
+ endif ()
+endmacro(add_cpp_test)
+
+add_cpp_test(interop_test ${CMAKE_SOURCE_DIR}/tests)
+
+## Install
+
install (TARGETS qpid-proton-cpp
EXPORT proton
ARCHIVE DESTINATION ${LIB_INSTALL_DIR}
http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/ea258831/proton-c/bindings/cpp/README.md
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/README.md b/proton-c/bindings/cpp/README.md
index 5e35874..9a30e35 100644
--- a/proton-c/bindings/cpp/README.md
+++ b/proton-c/bindings/cpp/README.md
@@ -9,7 +9,7 @@ API documentation in doxygen format.
There are a number of things that remain to be done.
-- Type mapping between AMQP and C++ types, e.g. encoding std::map as map message.
+- Mapping of complex types.
- Finish blocking API & demos.
- API documentation, HTML docs on website.
@@ -20,3 +20,11 @@ There are a number of things that remain to be done.
- Security: SASL/SSL support.
- Reconnection
+
+
+# Nice to have
+
+Subclasses of Encoder/Decoder that push to/pull from a std::ostream/istream as
+values are inserted/extracted.
+
+Better support for Decimal type.
http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/ea258831/proton-c/bindings/cpp/include/proton/cpp/Acceptor.h
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/include/proton/cpp/Acceptor.h b/proton-c/bindings/cpp/include/proton/cpp/Acceptor.h
index 852ca97..e4b690c 100644
--- a/proton-c/bindings/cpp/include/proton/cpp/Acceptor.h
+++ b/proton-c/bindings/cpp/include/proton/cpp/Acceptor.h
@@ -33,13 +33,13 @@ namespace reactor {
class Acceptor : public ProtonHandle<pn_acceptor_t>
{
public:
- PROTON_CPP_EXTERN Acceptor();
- PROTON_CPP_EXTERN Acceptor(pn_acceptor_t *);
- PROTON_CPP_EXTERN Acceptor(const Acceptor&);
- PROTON_CPP_EXTERN Acceptor& operator=(const Acceptor&);
- PROTON_CPP_EXTERN ~Acceptor();
+ PN_CPP_EXTERN Acceptor();
+ PN_CPP_EXTERN Acceptor(pn_acceptor_t *);
+ PN_CPP_EXTERN Acceptor(const Acceptor&);
+ PN_CPP_EXTERN Acceptor& operator=(const Acceptor&);
+ PN_CPP_EXTERN ~Acceptor();
- PROTON_CPP_EXTERN void close();
+ PN_CPP_EXTERN void close();
private:
friend class ProtonImplRef<Acceptor>;
};
http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/ea258831/proton-c/bindings/cpp/include/proton/cpp/Acking.h
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/include/proton/cpp/Acking.h b/proton-c/bindings/cpp/include/proton/cpp/Acking.h
index d40d7d4..cfe168c 100644
--- a/proton-c/bindings/cpp/include/proton/cpp/Acking.h
+++ b/proton-c/bindings/cpp/include/proton/cpp/Acking.h
@@ -32,10 +32,10 @@ namespace reactor {
class Acking
{
public:
- PROTON_CPP_EXTERN virtual void accept(Delivery &d);
- PROTON_CPP_EXTERN virtual void reject(Delivery &d);
- PROTON_CPP_EXTERN virtual void release(Delivery &d, bool delivered=true);
- PROTON_CPP_EXTERN virtual void settle(Delivery &d, Delivery::state s = Delivery::REJECTED);
+ PN_CPP_EXTERN virtual void accept(Delivery &d);
+ PN_CPP_EXTERN virtual void reject(Delivery &d);
+ PN_CPP_EXTERN virtual void release(Delivery &d, bool delivered=true);
+ PN_CPP_EXTERN virtual void settle(Delivery &d, Delivery::state s = Delivery::REJECTED);
};
http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/ea258831/proton-c/bindings/cpp/include/proton/cpp/BlockingConnection.h
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/include/proton/cpp/BlockingConnection.h b/proton-c/bindings/cpp/include/proton/cpp/BlockingConnection.h
index aa268db..6b30a20 100644
--- a/proton-c/bindings/cpp/include/proton/cpp/BlockingConnection.h
+++ b/proton-c/bindings/cpp/include/proton/cpp/BlockingConnection.h
@@ -44,19 +44,19 @@ class WaitCondition;
class BlockingConnection : public Handle<BlockingConnectionImpl>
{
public:
- PROTON_CPP_EXTERN BlockingConnection();
- PROTON_CPP_EXTERN BlockingConnection(const BlockingConnection& c);
- PROTON_CPP_EXTERN BlockingConnection& operator=(const BlockingConnection& c);
- PROTON_CPP_EXTERN ~BlockingConnection();
+ PN_CPP_EXTERN BlockingConnection();
+ PN_CPP_EXTERN BlockingConnection(const BlockingConnection& c);
+ PN_CPP_EXTERN BlockingConnection& operator=(const BlockingConnection& c);
+ PN_CPP_EXTERN ~BlockingConnection();
- PROTON_CPP_EXTERN BlockingConnection(std::string &url, Duration = Duration::FOREVER,
+ PN_CPP_EXTERN BlockingConnection(std::string &url, Duration = Duration::FOREVER,
SslDomain *ssld=0, Container *c=0);
- PROTON_CPP_EXTERN void close();
+ PN_CPP_EXTERN void close();
- PROTON_CPP_EXTERN BlockingSender createSender(std::string &address, Handler *h=0);
- PROTON_CPP_EXTERN void wait(WaitCondition &condition);
- PROTON_CPP_EXTERN void wait(WaitCondition &condition, std::string &msg, Duration timeout=Duration::FOREVER);
- PROTON_CPP_EXTERN Duration getTimeout();
+ PN_CPP_EXTERN BlockingSender createSender(std::string &address, Handler *h=0);
+ PN_CPP_EXTERN void wait(WaitCondition &condition);
+ PN_CPP_EXTERN void wait(WaitCondition &condition, std::string &msg, Duration timeout=Duration::FOREVER);
+ PN_CPP_EXTERN Duration getTimeout();
private:
friend class PrivateImplRef<BlockingConnection>;
};
http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/ea258831/proton-c/bindings/cpp/include/proton/cpp/BlockingLink.h
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/include/proton/cpp/BlockingLink.h b/proton-c/bindings/cpp/include/proton/cpp/BlockingLink.h
index 7f84ce8..f3c86e1 100644
--- a/proton-c/bindings/cpp/include/proton/cpp/BlockingLink.h
+++ b/proton-c/bindings/cpp/include/proton/cpp/BlockingLink.h
@@ -39,11 +39,11 @@ class BlockingConnection;
class BlockingLink
{
public:
- PROTON_CPP_EXTERN void close();
+ PN_CPP_EXTERN void close();
~BlockingLink();
protected:
- PROTON_CPP_EXTERN BlockingLink(BlockingConnection *c, pn_link_t *l);
- PROTON_CPP_EXTERN void waitForClosed(Duration timeout=Duration::SECOND);
+ PN_CPP_EXTERN BlockingLink(BlockingConnection *c, pn_link_t *l);
+ PN_CPP_EXTERN void waitForClosed(Duration timeout=Duration::SECOND);
private:
BlockingConnection connection;
Link link;
http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/ea258831/proton-c/bindings/cpp/include/proton/cpp/BlockingSender.h
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/include/proton/cpp/BlockingSender.h b/proton-c/bindings/cpp/include/proton/cpp/BlockingSender.h
index d4ddeae..a72dbb8 100644
--- a/proton-c/bindings/cpp/include/proton/cpp/BlockingSender.h
+++ b/proton-c/bindings/cpp/include/proton/cpp/BlockingSender.h
@@ -41,10 +41,10 @@ class BlockingLink;
class BlockingSender : public BlockingLink
{
public:
- PROTON_CPP_EXTERN Delivery send(Message &msg);
- PROTON_CPP_EXTERN Delivery send(Message &msg, Duration timeout);
+ PN_CPP_EXTERN Delivery send(Message &msg);
+ PN_CPP_EXTERN Delivery send(Message &msg, Duration timeout);
private:
- PROTON_CPP_EXTERN BlockingSender(BlockingConnection &c, Sender &l);
+ PN_CPP_EXTERN BlockingSender(BlockingConnection &c, Sender &l);
friend class BlockingConnection;
};
http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/ea258831/proton-c/bindings/cpp/include/proton/cpp/Connection.h
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/include/proton/cpp/Connection.h b/proton-c/bindings/cpp/include/proton/cpp/Connection.h
index f3397ce..5deea9b 100644
--- a/proton-c/bindings/cpp/include/proton/cpp/Connection.h
+++ b/proton-c/bindings/cpp/include/proton/cpp/Connection.h
@@ -41,23 +41,23 @@ class ConnectionImpl;
class Connection : public Endpoint, public Handle<ConnectionImpl>
{
public:
- PROTON_CPP_EXTERN Connection();
- PROTON_CPP_EXTERN Connection(ConnectionImpl *);
- PROTON_CPP_EXTERN Connection(const Connection& c);
- PROTON_CPP_EXTERN Connection& operator=(const Connection& c);
- PROTON_CPP_EXTERN ~Connection();
+ PN_CPP_EXTERN Connection();
+ PN_CPP_EXTERN Connection(ConnectionImpl *);
+ PN_CPP_EXTERN Connection(const Connection& c);
+ PN_CPP_EXTERN Connection& operator=(const Connection& c);
+ PN_CPP_EXTERN ~Connection();
- PROTON_CPP_EXTERN Connection(Container &c, Handler *h = 0);
- PROTON_CPP_EXTERN Transport &getTransport();
- PROTON_CPP_EXTERN Handler *getOverride();
- PROTON_CPP_EXTERN void setOverride(Handler *h);
- PROTON_CPP_EXTERN void open();
- PROTON_CPP_EXTERN void close();
- PROTON_CPP_EXTERN pn_connection_t *getPnConnection();
- PROTON_CPP_EXTERN Container &getContainer();
- PROTON_CPP_EXTERN std::string getHostname();
- virtual PROTON_CPP_EXTERN Connection &getConnection();
- PROTON_CPP_EXTERN Link getLinkHead(Endpoint::State mask);
+ PN_CPP_EXTERN Connection(Container &c, Handler *h = 0);
+ PN_CPP_EXTERN Transport &getTransport();
+ PN_CPP_EXTERN Handler *getOverride();
+ PN_CPP_EXTERN void setOverride(Handler *h);
+ PN_CPP_EXTERN void open();
+ PN_CPP_EXTERN void close();
+ PN_CPP_EXTERN pn_connection_t *getPnConnection();
+ PN_CPP_EXTERN Container &getContainer();
+ PN_CPP_EXTERN std::string getHostname();
+ virtual PN_CPP_EXTERN Connection &getConnection();
+ PN_CPP_EXTERN Link getLinkHead(Endpoint::State mask);
private:
friend class PrivateImplRef<Connection>;
friend class Connector;
http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/ea258831/proton-c/bindings/cpp/include/proton/cpp/Container.h
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/include/proton/cpp/Container.h b/proton-c/bindings/cpp/include/proton/cpp/Container.h
index 1d7284d..f6fdf68 100644
--- a/proton-c/bindings/cpp/include/proton/cpp/Container.h
+++ b/proton-c/bindings/cpp/include/proton/cpp/Container.h
@@ -45,29 +45,29 @@ class Link;
class Container : public Handle<ContainerImpl>
{
public:
- PROTON_CPP_EXTERN Container(ContainerImpl *);
- PROTON_CPP_EXTERN Container(const Container& c);
- PROTON_CPP_EXTERN Container& operator=(const Container& c);
- PROTON_CPP_EXTERN ~Container();
+ PN_CPP_EXTERN Container(ContainerImpl *);
+ PN_CPP_EXTERN Container(const Container& c);
+ PN_CPP_EXTERN Container& operator=(const Container& c);
+ PN_CPP_EXTERN ~Container();
- PROTON_CPP_EXTERN Container();
- PROTON_CPP_EXTERN Container(MessagingHandler &mhandler);
- PROTON_CPP_EXTERN Connection connect(std::string &host, Handler *h=0);
- PROTON_CPP_EXTERN void run();
- PROTON_CPP_EXTERN void start();
- PROTON_CPP_EXTERN bool process();
- PROTON_CPP_EXTERN void stop();
- PROTON_CPP_EXTERN void wakeup();
- PROTON_CPP_EXTERN bool isQuiesced();
- PROTON_CPP_EXTERN pn_reactor_t *getReactor();
- PROTON_CPP_EXTERN Sender createSender(Connection &connection, std::string &addr, Handler *h=0);
- PROTON_CPP_EXTERN Sender createSender(std::string &url);
- PROTON_CPP_EXTERN Receiver createReceiver(Connection &connection, std::string &addr);
- PROTON_CPP_EXTERN Receiver createReceiver(const std::string &url);
- PROTON_CPP_EXTERN Acceptor listen(const std::string &url);
- PROTON_CPP_EXTERN std::string getContainerId();
- PROTON_CPP_EXTERN Duration getTimeout();
- PROTON_CPP_EXTERN void setTimeout(Duration timeout);
+ PN_CPP_EXTERN Container();
+ PN_CPP_EXTERN Container(MessagingHandler &mhandler);
+ PN_CPP_EXTERN Connection connect(std::string &host, Handler *h=0);
+ PN_CPP_EXTERN void run();
+ PN_CPP_EXTERN void start();
+ PN_CPP_EXTERN bool process();
+ PN_CPP_EXTERN void stop();
+ PN_CPP_EXTERN void wakeup();
+ PN_CPP_EXTERN bool isQuiesced();
+ PN_CPP_EXTERN pn_reactor_t *getReactor();
+ PN_CPP_EXTERN Sender createSender(Connection &connection, std::string &addr, Handler *h=0);
+ PN_CPP_EXTERN Sender createSender(std::string &url);
+ PN_CPP_EXTERN Receiver createReceiver(Connection &connection, std::string &addr);
+ PN_CPP_EXTERN Receiver createReceiver(const std::string &url);
+ PN_CPP_EXTERN Acceptor listen(const std::string &url);
+ PN_CPP_EXTERN std::string getContainerId();
+ PN_CPP_EXTERN Duration getTimeout();
+ PN_CPP_EXTERN void setTimeout(Duration timeout);
private:
friend class PrivateImplRef<Container>;
};
http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/ea258831/proton-c/bindings/cpp/include/proton/cpp/Data.h
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/include/proton/cpp/Data.h b/proton-c/bindings/cpp/include/proton/cpp/Data.h
new file mode 100644
index 0000000..2204e8f
--- /dev/null
+++ b/proton-c/bindings/cpp/include/proton/cpp/Data.h
@@ -0,0 +1,55 @@
+#ifndef DATA_H
+#define 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 "proton/cpp/ImportExport.h"
+#include <iosfwd>
+
+struct pn_data_t;
+
+namespace proton {
+namespace reactor {
+
+/** Base for classes that hold AMQP data. */
+class Data {
+ public:
+ virtual ~Data();
+
+ /** Copies the data */
+ Data& operator=(const Data&);
+
+ /** Clear the data. */
+ PN_CPP_EXTERN void clear();
+
+ /** True if there are no values. */
+ PN_CPP_EXTERN bool empty() const;
+
+ /** Human readable representation of data. */
+ friend std::ostream& operator<<(std::ostream&, const Data&);
+
+ protected:
+ /** Takes ownership of pd */
+ explicit Data(pn_data_t* pd=0);
+ mutable pn_data_t* data;
+};
+
+
+}}
+#endif // DATA_H
http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/ea258831/proton-c/bindings/cpp/include/proton/cpp/Decoder.h
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/include/proton/cpp/Decoder.h b/proton-c/bindings/cpp/include/proton/cpp/Decoder.h
new file mode 100644
index 0000000..542315e
--- /dev/null
+++ b/proton-c/bindings/cpp/include/proton/cpp/Decoder.h
@@ -0,0 +1,165 @@
+#ifndef DECODER_H
+#define DECODER_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 "proton/cpp/Data.h"
+#include "proton/cpp/types.h"
+#include "proton/cpp/exceptions.h"
+#include <iosfwd>
+
+namespace proton {
+namespace reactor {
+
+class Value;
+
+/**
+Stream-like decoder from AMQP bytes to a stream of C++ values.
+
+@see types.h defines C++ typedefs and types for AMQP each type. These types can
+all be extracted from the corresponding AMQP type. In additon operator>> will do
+the following conversions from AMQP to C++ types:
+
++-----------------------------------------+--------------------------------------------------+
+|Target C++ type |Allowed AMQP types |
++=========================================+==================================================+
+|bool |Bool |
+|-----------------------------------------+--------------------------------------------------|
+|signed integer type |Byte,Short,Int,Long [1] |
++-----------------------------------------+--------------------------------------------------+
+|unsigned integer type |UByte,UShort,UInt,ULong [1] |
++-----------------------------------------+--------------------------------------------------+
+|float or double |Float or Double |
++-----------------------------------------+--------------------------------------------------+
+|Value |Any type |
++-----------------------------------------+--------------------------------------------------+
+|std::string |String, Binary, Symbol |
++-----------------------------------------+--------------------------------------------------+
+|wchar_t |Char |
++-----------------------------------------+--------------------------------------------------+
+|std::map<K, T> |Map with keys that convert to K and data that |
+| |converts to T |
++-----------------------------------------+--------------------------------------------------+
+|Map |Map may have mixed keys and data types |
++-----------------------------------------+--------------------------------------------------+
+|std::vector<T> |List or Array if data converts to T |
++-----------------------------------------+--------------------------------------------------+
+|List |List, may have mixed types and datas |
++-----------------------------------------+--------------------------------------------------+
+
+You can disable conversions and force an exact type match using @see exact()
+*/
+class Decoder : public virtual Data {
+ public:
+ /** Raised if a Decoder operation fails */
+ struct Error : public ProtonException {
+ explicit Error(const std::string& msg) throw() : ProtonException(msg) {}
+ };
+
+ PN_CPP_EXTERN Decoder();
+ PN_CPP_EXTERN ~Decoder();
+
+ /** Copy AMQP data from a byte buffer into the Decoder. */
+ PN_CPP_EXTERN Decoder(const char* buffer, size_t size);
+
+ /** Copy AMQP data from a std::string into the Decoder. */
+ PN_CPP_EXTERN Decoder(const std::string&);
+
+ /** Decode AMQP data from a byte buffer onto the end of the value stream. */
+ PN_CPP_EXTERN void decode(const char* buffer, size_t size);
+
+ /** Decode AMQP data from bytes in std::string onto the end of the value stream. */
+ PN_CPP_EXTERN void decode(const std::string&);
+
+ /** Return true if there are more values to read at the current level. */
+ PN_CPP_EXTERN bool more() const;
+
+ /** Type of the next value that will be read by operator>>
+ *@throw Error if empty().
+ */
+ PN_CPP_EXTERN TypeId type() const;
+
+ /** @defgroup decoder_simple_types Extract simple types, @see Decoder for details.
+ *@throw Error if the Decoder is empty or the current value has an incompatible type.
+ *@{
+ */
+ PN_CPP_EXTERN friend Decoder& operator>>(Decoder&, Bool&);
+ PN_CPP_EXTERN friend Decoder& operator>>(Decoder&, Ubyte&);
+ PN_CPP_EXTERN friend Decoder& operator>>(Decoder&, Byte&);
+ PN_CPP_EXTERN friend Decoder& operator>>(Decoder&, Ushort&);
+ PN_CPP_EXTERN friend Decoder& operator>>(Decoder&, Short&);
+ PN_CPP_EXTERN friend Decoder& operator>>(Decoder&, Uint&);
+ PN_CPP_EXTERN friend Decoder& operator>>(Decoder&, Int&);
+ PN_CPP_EXTERN friend Decoder& operator>>(Decoder&, Char&);
+ PN_CPP_EXTERN friend Decoder& operator>>(Decoder&, Ulong&);
+ PN_CPP_EXTERN friend Decoder& operator>>(Decoder&, Long&);
+ PN_CPP_EXTERN friend Decoder& operator>>(Decoder&, Timestamp&);
+ PN_CPP_EXTERN friend Decoder& operator>>(Decoder&, Float&);
+ PN_CPP_EXTERN friend Decoder& operator>>(Decoder&, Double&);
+ PN_CPP_EXTERN friend Decoder& operator>>(Decoder&, Decimal32&);
+ PN_CPP_EXTERN friend Decoder& operator>>(Decoder&, Decimal64&);
+ PN_CPP_EXTERN friend Decoder& operator>>(Decoder&, Decimal128&);
+ PN_CPP_EXTERN friend Decoder& operator>>(Decoder&, Uuid&);
+ PN_CPP_EXTERN friend Decoder& operator>>(Decoder&, std::string&);
+ PN_CPP_EXTERN friend Decoder& operator>>(Decoder&, Value&);
+ ///@}
+
+ ///@internal
+ template <class T> struct ExactRef { T& value; ExactRef(T& ref) : value(ref) {} };
+
+ /** @see exact() */
+ template <class T> friend Decoder& operator>>(Decoder&, ExactRef<T>);
+
+ private:
+ PN_CPP_EXTERN Decoder(pn_data_t*);
+ template <class T> Decoder& extract(T& value);
+ void checkType(TypeId);
+
+ // Not implemented
+ Decoder(const Decoder&);
+ Decoder& operator=(const Decoder&);
+
+ friend class Value;
+ friend class Encoder;
+};
+
+/**
+ * exact() disables the conversions allowed by Decoder operator>> and requires exact type match.
+ *
+ * For example the following will throw Decode::Error unless decoder conntains
+ * an AMQP bool and an AMQP ULong.
+ *
+ * @code
+ * Bool b;
+ * ULong ul;
+ * decoder >> exact(b) >> exact(ul)
+ * @code
+ */
+template <class T> Decoder::ExactRef<T> exact(T& value) {
+ return Decoder::ExactRef<T>(value);
+}
+
+///@see exact()
+template <class T> Decoder& operator>>(Decoder& d, Decoder::ExactRef<T> ref) {
+ d.checkType(TypeIdOf<T>::value);
+ d >> ref.value;
+}
+
+}} // namespace proton::reactor
+#endif // DECODER_H
http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/ea258831/proton-c/bindings/cpp/include/proton/cpp/Delivery.h
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/include/proton/cpp/Delivery.h b/proton-c/bindings/cpp/include/proton/cpp/Delivery.h
index 089ae1b..6df658f 100644
--- a/proton-c/bindings/cpp/include/proton/cpp/Delivery.h
+++ b/proton-c/bindings/cpp/include/proton/cpp/Delivery.h
@@ -43,14 +43,14 @@ class Delivery : public ProtonHandle<pn_delivery_t>
MODIFIED = PN_MODIFIED
}; // AMQP spec 3.4 Delivery State
- PROTON_CPP_EXTERN Delivery(pn_delivery_t *d);
- PROTON_CPP_EXTERN Delivery();
- PROTON_CPP_EXTERN ~Delivery();
- PROTON_CPP_EXTERN Delivery(const Delivery&);
- PROTON_CPP_EXTERN Delivery& operator=(const Delivery&);
- PROTON_CPP_EXTERN bool settled();
- PROTON_CPP_EXTERN void settle();
- PROTON_CPP_EXTERN pn_delivery_t *getPnDelivery();
+ PN_CPP_EXTERN Delivery(pn_delivery_t *d);
+ PN_CPP_EXTERN Delivery();
+ PN_CPP_EXTERN ~Delivery();
+ PN_CPP_EXTERN Delivery(const Delivery&);
+ PN_CPP_EXTERN Delivery& operator=(const Delivery&);
+ PN_CPP_EXTERN bool settled();
+ PN_CPP_EXTERN void settle();
+ PN_CPP_EXTERN pn_delivery_t *getPnDelivery();
private:
friend class ProtonImplRef<Delivery>;
};
http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/ea258831/proton-c/bindings/cpp/include/proton/cpp/Duration.h
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/include/proton/cpp/Duration.h b/proton-c/bindings/cpp/include/proton/cpp/Duration.h
index d5aca03..08aaf3f 100644
--- a/proton-c/bindings/cpp/include/proton/cpp/Duration.h
+++ b/proton-c/bindings/cpp/include/proton/cpp/Duration.h
@@ -34,22 +34,22 @@ namespace reactor {
class Duration
{
public:
- PROTON_CPP_EXTERN explicit Duration(uint64_t milliseconds);
- PROTON_CPP_EXTERN uint64_t getMilliseconds() const;
- PROTON_CPP_EXTERN static const Duration FOREVER;
- PROTON_CPP_EXTERN static const Duration IMMEDIATE;
- PROTON_CPP_EXTERN static const Duration SECOND;
- PROTON_CPP_EXTERN static const Duration MINUTE;
+ PN_CPP_EXTERN explicit Duration(uint64_t milliseconds);
+ PN_CPP_EXTERN uint64_t getMilliseconds() const;
+ PN_CPP_EXTERN static const Duration FOREVER;
+ PN_CPP_EXTERN static const Duration IMMEDIATE;
+ PN_CPP_EXTERN static const Duration SECOND;
+ PN_CPP_EXTERN static const Duration MINUTE;
private:
uint64_t milliseconds;
};
-PROTON_CPP_EXTERN Duration operator*(const Duration& duration,
+PN_CPP_EXTERN Duration operator*(const Duration& duration,
uint64_t multiplier);
-PROTON_CPP_EXTERN Duration operator*(uint64_t multiplier,
+PN_CPP_EXTERN Duration operator*(uint64_t multiplier,
const Duration& duration);
-PROTON_CPP_EXTERN bool operator==(const Duration& a, const Duration& b);
-PROTON_CPP_EXTERN bool operator!=(const Duration& a, const Duration& b);
+PN_CPP_EXTERN bool operator==(const Duration& a, const Duration& b);
+PN_CPP_EXTERN bool operator!=(const Duration& a, const Duration& b);
}} // namespace proton::reactor
http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/ea258831/proton-c/bindings/cpp/include/proton/cpp/Encoder.h
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/include/proton/cpp/Encoder.h b/proton-c/bindings/cpp/include/proton/cpp/Encoder.h
new file mode 100644
index 0000000..460bea4
--- /dev/null
+++ b/proton-c/bindings/cpp/include/proton/cpp/Encoder.h
@@ -0,0 +1,108 @@
+#ifndef ENCODER_H
+#define ENCODER_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 "proton/cpp/Data.h"
+#include "proton/cpp/types.h"
+#include "proton/cpp/exceptions.h"
+#include <iosfwd>
+
+struct pn_data_t;
+
+namespace proton {
+namespace reactor {
+
+class Value;
+
+/**
+Stream-like encoder from C++ values to AMQP bytes.
+
+@see types.h defines C++ typedefs and types for AMQP each type. These types
+insert as the corresponding AMQP type. Normal C++ conversion rules apply if you
+insert any other type.
+
+*/
+class Encoder : public virtual Data {
+ public:
+ /** Raised if a Encoder operation fails */
+ struct Error : public ProtonException {
+ explicit Error(const std::string& msg) throw() : ProtonException(msg) {}
+ };
+
+ PN_CPP_EXTERN Encoder();
+ PN_CPP_EXTERN ~Encoder();
+
+ /**
+ * Encode the current values into buffer and update size to reflect the number of bytes encoded.
+ *
+ * Clears the encoder.
+ *
+ *@return if buffer==0 or size is too small then return false and size to the required size.
+ *Otherwise return true and set size to the number of bytes encoded.
+ */
+ PN_CPP_EXTERN bool encode(char* buffer, size_t& size);
+
+ /** Encode the current values into a std::string, resize the string if necessary.
+ *
+ * Clears the encoder.
+ */
+ PN_CPP_EXTERN void encode(std::string&);
+
+ /** Encode the current values into a std::string. Clears the encoder. */
+ PN_CPP_EXTERN std::string encode();
+
+ /** @defgroup encoder_simple_types Insert simple types.
+ *@{
+ */
+ PN_CPP_EXTERN friend Encoder& operator<<(Encoder&, Bool);
+ PN_CPP_EXTERN friend Encoder& operator<<(Encoder&, Ubyte);
+ PN_CPP_EXTERN friend Encoder& operator<<(Encoder&, Byte);
+ PN_CPP_EXTERN friend Encoder& operator<<(Encoder&, Ushort);
+ PN_CPP_EXTERN friend Encoder& operator<<(Encoder&, Short);
+ PN_CPP_EXTERN friend Encoder& operator<<(Encoder&, Uint);
+ PN_CPP_EXTERN friend Encoder& operator<<(Encoder&, Int);
+ PN_CPP_EXTERN friend Encoder& operator<<(Encoder&, Char);
+ PN_CPP_EXTERN friend Encoder& operator<<(Encoder&, Ulong);
+ PN_CPP_EXTERN friend Encoder& operator<<(Encoder&, Long);
+ PN_CPP_EXTERN friend Encoder& operator<<(Encoder&, Timestamp);
+ PN_CPP_EXTERN friend Encoder& operator<<(Encoder&, Float);
+ PN_CPP_EXTERN friend Encoder& operator<<(Encoder&, Double);
+ PN_CPP_EXTERN friend Encoder& operator<<(Encoder&, Decimal32);
+ PN_CPP_EXTERN friend Encoder& operator<<(Encoder&, Decimal64);
+ PN_CPP_EXTERN friend Encoder& operator<<(Encoder&, Decimal128);
+ PN_CPP_EXTERN friend Encoder& operator<<(Encoder&, Uuid);
+ PN_CPP_EXTERN friend Encoder& operator<<(Encoder&, String);
+ PN_CPP_EXTERN friend Encoder& operator<<(Encoder&, Symbol);
+ PN_CPP_EXTERN friend Encoder& operator<<(Encoder&, Binary);
+ PN_CPP_EXTERN friend Encoder& operator<<(Encoder&, const Value&);
+ ///@}
+
+ private:
+ PN_CPP_EXTERN Encoder(pn_data_t* pd); // Does not own.
+
+ // Not implemented
+ Encoder(const Encoder&);
+ Encoder& operator=(const Encoder&);
+
+ friend class Value;
+};
+
+}}
+#endif // ENCODER_H
http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/ea258831/proton-c/bindings/cpp/include/proton/cpp/Endpoint.h
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/include/proton/cpp/Endpoint.h b/proton-c/bindings/cpp/include/proton/cpp/Endpoint.h
index fc1a712..c3edb59 100644
--- a/proton-c/bindings/cpp/include/proton/cpp/Endpoint.h
+++ b/proton-c/bindings/cpp/include/proton/cpp/Endpoint.h
@@ -45,8 +45,8 @@ class Endpoint
typedef int State;
// TODO: getCondition, getRemoteCondition, updateCondition, get/setHandler
- virtual PROTON_CPP_EXTERN Connection &getConnection() = 0;
- Transport PROTON_CPP_EXTERN &getTransport();
+ virtual PN_CPP_EXTERN Connection &getConnection() = 0;
+ Transport PN_CPP_EXTERN &getTransport();
protected:
Endpoint();
~Endpoint();
http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/ea258831/proton-c/bindings/cpp/include/proton/cpp/Event.h
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/include/proton/cpp/Event.h b/proton-c/bindings/cpp/include/proton/cpp/Event.h
index 47aee2d..c0a3388 100644
--- a/proton-c/bindings/cpp/include/proton/cpp/Event.h
+++ b/proton-c/bindings/cpp/include/proton/cpp/Event.h
@@ -38,20 +38,20 @@ class Connection;
class Event
{
public:
- virtual PROTON_CPP_EXTERN void dispatch(Handler &h) = 0;
- virtual PROTON_CPP_EXTERN Container &getContainer();
- virtual PROTON_CPP_EXTERN Connection &getConnection();
- virtual PROTON_CPP_EXTERN Sender getSender();
- virtual PROTON_CPP_EXTERN Receiver getReceiver();
- virtual PROTON_CPP_EXTERN Link getLink();
- virtual PROTON_CPP_EXTERN Message getMessage();
- virtual PROTON_CPP_EXTERN void setMessage(Message &);
- virtual PROTON_CPP_EXTERN ~Event();
+ virtual PN_CPP_EXTERN void dispatch(Handler &h) = 0;
+ virtual PN_CPP_EXTERN Container &getContainer();
+ virtual PN_CPP_EXTERN Connection &getConnection();
+ virtual PN_CPP_EXTERN Sender getSender();
+ virtual PN_CPP_EXTERN Receiver getReceiver();
+ virtual PN_CPP_EXTERN Link getLink();
+ virtual PN_CPP_EXTERN Message getMessage();
+ virtual PN_CPP_EXTERN void setMessage(Message &);
+ virtual PN_CPP_EXTERN ~Event();
protected:
- PROTON_CPP_EXTERN PROTON_CPP_EXTERN Event();
+ PN_CPP_EXTERN PN_CPP_EXTERN Event();
private:
- PROTON_CPP_EXTERN Event(const Event&);
- PROTON_CPP_EXTERN Event& operator=(const Event&);
+ PN_CPP_EXTERN Event(const Event&);
+ PN_CPP_EXTERN Event& operator=(const Event&);
};
http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/ea258831/proton-c/bindings/cpp/include/proton/cpp/Exception.h
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/include/proton/cpp/Exception.h b/proton-c/bindings/cpp/include/proton/cpp/Exception.h
new file mode 100644
index 0000000..d24c8ef
--- /dev/null
+++ b/proton-c/bindings/cpp/include/proton/cpp/Exception.h
@@ -0,0 +1,49 @@
+#ifndef PROTON_CPP_EXCEPTIONS_H
+#define PROTON_CPP_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 <stdexcept>
+
+namespace proton {
+namespace reactor {
+
+class Exception : public std::runtime_error
+{
+ public:
+ explicit Exception(const std::string& msg) throw() : std::runtime_error(msg) {}
+};
+
+class MessageReject : public Exception
+{
+ public:
+ explicit MessageReject(const std::string& msg) throw() : Exception(msg) {}
+};
+
+class MessageRelease : public Exception
+{
+ public:
+ explicit MessageRelease(const std::string& msg) throw() : Exception(msg) {}
+};
+
+}} // namespace proton::reactor
+
+#endif /*!PROTON_CPP_EXCEPTIONS_H*/
http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/ea258831/proton-c/bindings/cpp/include/proton/cpp/Handle.h
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/include/proton/cpp/Handle.h b/proton-c/bindings/cpp/include/proton/cpp/Handle.h
index 2cf3f99..48fe6b9 100644
--- a/proton-c/bindings/cpp/include/proton/cpp/Handle.h
+++ b/proton-c/bindings/cpp/include/proton/cpp/Handle.h
@@ -30,6 +30,8 @@ namespace reactor {
template <class> class PrivateImplRef;
template <class> class ProtonImplRef;
+// FIXME aconway 2015-06-09: don't need handle, get rid of it.
+
/**
* A handle is like a pointer: refers to an underlying implementation object.
* Copying the handle does not copy the object.
http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/ea258831/proton-c/bindings/cpp/include/proton/cpp/Handler.h
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/include/proton/cpp/Handler.h b/proton-c/bindings/cpp/include/proton/cpp/Handler.h
index 231942f..86b5bbf 100644
--- a/proton-c/bindings/cpp/include/proton/cpp/Handler.h
+++ b/proton-c/bindings/cpp/include/proton/cpp/Handler.h
@@ -29,17 +29,17 @@
namespace proton {
namespace reactor {
-class PROTON_CPP_EXTERN Handler
+class PN_CPP_EXTERN Handler
{
public:
- PROTON_CPP_EXTERN Handler();
- PROTON_CPP_EXTERN virtual ~Handler();
+ PN_CPP_EXTERN Handler();
+ PN_CPP_EXTERN virtual ~Handler();
- PROTON_CPP_EXTERN virtual void onUnhandled(Event &e);
+ PN_CPP_EXTERN virtual void onUnhandled(Event &e);
- PROTON_CPP_EXTERN virtual void addChildHandler(Handler &e);
- PROTON_CPP_EXTERN std::vector<Handler *>::iterator childHandlersBegin();
- PROTON_CPP_EXTERN std::vector<Handler *>::iterator childHandlersEnd();
+ PN_CPP_EXTERN virtual void addChildHandler(Handler &e);
+ PN_CPP_EXTERN std::vector<Handler *>::iterator childHandlersBegin();
+ PN_CPP_EXTERN std::vector<Handler *>::iterator childHandlersEnd();
protected:
std::vector<Handler *>childHandlers;
};
http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/ea258831/proton-c/bindings/cpp/include/proton/cpp/ImportExport.h
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/include/proton/cpp/ImportExport.h b/proton-c/bindings/cpp/include/proton/cpp/ImportExport.h
index 4a88576..cbc0626 100644
--- a/proton-c/bindings/cpp/include/proton/cpp/ImportExport.h
+++ b/proton-c/bindings/cpp/include/proton/cpp/ImportExport.h
@@ -39,9 +39,9 @@
// For c++ library symbols
#ifdef protoncpp_EXPORTS
-# define PROTON_CPP_EXTERN PROTON_CPP_EXPORT
+# define PN_CPP_EXTERN PROTON_CPP_EXPORT
#else
-# define PROTON_CPP_EXTERN PROTON_CPP_IMPORT
+# define PN_CPP_EXTERN PROTON_CPP_IMPORT
#endif
// TODO:
http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/ea258831/proton-c/bindings/cpp/include/proton/cpp/Link.h
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/include/proton/cpp/Link.h b/proton-c/bindings/cpp/include/proton/cpp/Link.h
index 391e5fc..f4b9662 100644
--- a/proton-c/bindings/cpp/include/proton/cpp/Link.h
+++ b/proton-c/bindings/cpp/include/proton/cpp/Link.h
@@ -36,24 +36,24 @@ namespace reactor {
class Link : public Endpoint, public ProtonHandle<pn_link_t>
{
public:
- PROTON_CPP_EXTERN Link(pn_link_t *);
- PROTON_CPP_EXTERN Link();
- PROTON_CPP_EXTERN ~Link();
- PROTON_CPP_EXTERN Link(const Link&);
- PROTON_CPP_EXTERN Link& operator=(const Link&);
- PROTON_CPP_EXTERN void open();
- PROTON_CPP_EXTERN void close();
- PROTON_CPP_EXTERN bool isSender();
- PROTON_CPP_EXTERN bool isReceiver();
- PROTON_CPP_EXTERN int getCredit();
- PROTON_CPP_EXTERN Terminus getSource();
- PROTON_CPP_EXTERN Terminus getTarget();
- PROTON_CPP_EXTERN Terminus getRemoteSource();
- PROTON_CPP_EXTERN Terminus getRemoteTarget();
- PROTON_CPP_EXTERN std::string getName();
- PROTON_CPP_EXTERN pn_link_t *getPnLink() const;
- virtual PROTON_CPP_EXTERN Connection &getConnection();
- PROTON_CPP_EXTERN Link getNext(Endpoint::State mask);
+ PN_CPP_EXTERN Link(pn_link_t *);
+ PN_CPP_EXTERN Link();
+ PN_CPP_EXTERN ~Link();
+ PN_CPP_EXTERN Link(const Link&);
+ PN_CPP_EXTERN Link& operator=(const Link&);
+ PN_CPP_EXTERN void open();
+ PN_CPP_EXTERN void close();
+ PN_CPP_EXTERN bool isSender();
+ PN_CPP_EXTERN bool isReceiver();
+ PN_CPP_EXTERN int getCredit();
+ PN_CPP_EXTERN Terminus getSource();
+ PN_CPP_EXTERN Terminus getTarget();
+ PN_CPP_EXTERN Terminus getRemoteSource();
+ PN_CPP_EXTERN Terminus getRemoteTarget();
+ PN_CPP_EXTERN std::string getName();
+ PN_CPP_EXTERN pn_link_t *getPnLink() const;
+ virtual PN_CPP_EXTERN Connection &getConnection();
+ PN_CPP_EXTERN Link getNext(Endpoint::State mask);
protected:
virtual void verifyType(pn_link_t *l);
private:
http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/ea258831/proton-c/bindings/cpp/include/proton/cpp/Message.h
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/include/proton/cpp/Message.h b/proton-c/bindings/cpp/include/proton/cpp/Message.h
index 590fdd8..d24cc1b 100644
--- a/proton-c/bindings/cpp/include/proton/cpp/Message.h
+++ b/proton-c/bindings/cpp/include/proton/cpp/Message.h
@@ -33,74 +33,78 @@ namespace reactor {
class Message : public ProtonHandle<pn_message_t>
{
public:
- PROTON_CPP_EXTERN Message();
- PROTON_CPP_EXTERN Message(pn_message_t *);
- PROTON_CPP_EXTERN Message(const Message&);
- PROTON_CPP_EXTERN Message& operator=(const Message&);
- PROTON_CPP_EXTERN ~Message();
+ PN_CPP_EXTERN Message();
+ PN_CPP_EXTERN Message(pn_message_t *);
+ PN_CPP_EXTERN Message(const Message&);
+ PN_CPP_EXTERN Message& operator=(const Message&);
+ PN_CPP_EXTERN ~Message();
- PROTON_CPP_EXTERN pn_message_t *getPnMessage() const;
+ PN_CPP_EXTERN pn_message_t *getPnMessage() const;
- PROTON_CPP_EXTERN void setId(uint64_t id);
- PROTON_CPP_EXTERN uint64_t getId();
- PROTON_CPP_EXTERN void setId(const std::string &id);
- PROTON_CPP_EXTERN std::string getStringId();
- PROTON_CPP_EXTERN void setId(const char *p, size_t len);
- PROTON_CPP_EXTERN size_t getId(const char **p);
- // TODO: UUID version
- PROTON_CPP_EXTERN pn_type_t getIdType();
+ // FIXME aconway 2015-06-11: get rid of get/set prefixes
- PROTON_CPP_EXTERN void setUserId(const std::string &id);
- PROTON_CPP_EXTERN std::string getUserId();
+ // FIXME aconway 2015-06-11: use Value not string to allow full range of AMQP types.
+ PN_CPP_EXTERN void setId(uint64_t id);
+ PN_CPP_EXTERN uint64_t getId();
+ PN_CPP_EXTERN void setId(const std::string &id);
+ PN_CPP_EXTERN std::string getStringId();
+ PN_CPP_EXTERN void setId(const char *p, size_t len);
+ PN_CPP_EXTERN size_t getId(const char **p);
+ PN_CPP_EXTERN pn_type_t getIdType();
- PROTON_CPP_EXTERN void setAddress(const std::string &addr);
- PROTON_CPP_EXTERN std::string getAddress();
+ PN_CPP_EXTERN void setUserId(const std::string &id);
+ PN_CPP_EXTERN std::string getUserId();
- PROTON_CPP_EXTERN void setSubject(const std::string &s);
- PROTON_CPP_EXTERN std::string getSubject();
+ PN_CPP_EXTERN void setAddress(const std::string &addr);
+ PN_CPP_EXTERN std::string getAddress();
- PROTON_CPP_EXTERN void setReplyTo(const std::string &s);
- PROTON_CPP_EXTERN std::string getReplyTo();
+ PN_CPP_EXTERN void setSubject(const std::string &s);
+ PN_CPP_EXTERN std::string getSubject();
- PROTON_CPP_EXTERN void setCorrelationId(uint64_t id);
- PROTON_CPP_EXTERN uint64_t getCorrelationId();
- PROTON_CPP_EXTERN void setCorrelationId(const std::string &id);
- PROTON_CPP_EXTERN std::string getStringCorrelationId();
- PROTON_CPP_EXTERN void setCorrelationId(const char *p, size_t len);
- PROTON_CPP_EXTERN size_t getCorrelationId(const char **p);
- // TODO: UUID version
- PROTON_CPP_EXTERN pn_type_t getCorrelationIdType();
+ PN_CPP_EXTERN void setReplyTo(const std::string &s);
+ PN_CPP_EXTERN std::string getReplyTo();
- PROTON_CPP_EXTERN void setContentType(const std::string &s);
- PROTON_CPP_EXTERN std::string getContentType();
+ PN_CPP_EXTERN void setCorrelationId(uint64_t id);
+ PN_CPP_EXTERN uint64_t getCorrelationId();
+ PN_CPP_EXTERN void setCorrelationId(const std::string &id);
+ PN_CPP_EXTERN std::string getStringCorrelationId();
+ PN_CPP_EXTERN void setCorrelationId(const char *p, size_t len);
+ PN_CPP_EXTERN size_t getCorrelationId(const char **p);
- PROTON_CPP_EXTERN void setContentEncoding(const std::string &s);
- PROTON_CPP_EXTERN std::string getContentEncoding();
+ // FIXME aconway 2015-06-11: use Value not string to allow full range of AMQP types.
+ PN_CPP_EXTERN pn_type_t getCorrelationIdType();
- PROTON_CPP_EXTERN void setExpiry(pn_timestamp_t t);
- PROTON_CPP_EXTERN pn_timestamp_t getExpiry();
+ PN_CPP_EXTERN void setContentType(const std::string &s);
+ PN_CPP_EXTERN std::string getContentType();
- PROTON_CPP_EXTERN void setCreationTime(pn_timestamp_t t);
- PROTON_CPP_EXTERN pn_timestamp_t getCreationTime();
+ PN_CPP_EXTERN void setContentEncoding(const std::string &s);
+ PN_CPP_EXTERN std::string getContentEncoding();
- PROTON_CPP_EXTERN void setGroupId(const std::string &s);
- PROTON_CPP_EXTERN std::string getGroupId();
+ PN_CPP_EXTERN void setExpiry(pn_timestamp_t t);
+ PN_CPP_EXTERN pn_timestamp_t getExpiry();
- PROTON_CPP_EXTERN void setReplyToGroupId(const std::string &s);
- PROTON_CPP_EXTERN std::string getReplyToGroupId();
+ PN_CPP_EXTERN void setCreationTime(pn_timestamp_t t);
+ PN_CPP_EXTERN pn_timestamp_t getCreationTime();
- PROTON_CPP_EXTERN void setBody(const std::string &data);
- PROTON_CPP_EXTERN std::string getBody();
+ PN_CPP_EXTERN void setGroupId(const std::string &s);
+ PN_CPP_EXTERN std::string getGroupId();
- PROTON_CPP_EXTERN void getBody(std::string &str);
+ PN_CPP_EXTERN void setReplyToGroupId(const std::string &s);
+ PN_CPP_EXTERN std::string getReplyToGroupId();
- PROTON_CPP_EXTERN void setBody(const char *, size_t len);
- PROTON_CPP_EXTERN size_t getBody(char *, size_t len);
- PROTON_CPP_EXTERN size_t getBinaryBodySize();
+ // FIXME aconway 2015-06-11: use Values for body.
+ PN_CPP_EXTERN void setBody(const std::string &data);
+ PN_CPP_EXTERN std::string getBody();
+ PN_CPP_EXTERN void getBody(std::string &str);
- PROTON_CPP_EXTERN void encode(std::string &data);
- PROTON_CPP_EXTERN void decode(const std::string &data);
+ PN_CPP_EXTERN void setBody(const char *, size_t len);
+ PN_CPP_EXTERN size_t getBody(char *, size_t len);
+ PN_CPP_EXTERN size_t getBinaryBodySize();
+
+
+ PN_CPP_EXTERN void encode(std::string &data);
+ PN_CPP_EXTERN void decode(const std::string &data);
private:
friend class ProtonImplRef<Message>;
http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/ea258831/proton-c/bindings/cpp/include/proton/cpp/MessagingAdapter.h
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/include/proton/cpp/MessagingAdapter.h b/proton-c/bindings/cpp/include/proton/cpp/MessagingAdapter.h
index 280df5b..9cf4347 100644
--- a/proton-c/bindings/cpp/include/proton/cpp/MessagingAdapter.h
+++ b/proton-c/bindings/cpp/include/proton/cpp/MessagingAdapter.h
@@ -38,37 +38,37 @@ namespace reactor {
class MessagingAdapter : public MessagingHandler
{
public:
- PROTON_CPP_EXTERN MessagingAdapter(MessagingHandler &delegate);
- PROTON_CPP_EXTERN virtual ~MessagingAdapter();
- PROTON_CPP_EXTERN virtual void onReactorInit(Event &e);
- PROTON_CPP_EXTERN virtual void onLinkFlow(Event &e);
- PROTON_CPP_EXTERN virtual void onDelivery(Event &e);
- PROTON_CPP_EXTERN virtual void onUnhandled(Event &e);
- PROTON_CPP_EXTERN virtual void onConnectionClosed(Event &e);
- PROTON_CPP_EXTERN virtual void onConnectionClosing(Event &e);
- PROTON_CPP_EXTERN virtual void onConnectionError(Event &e);
- PROTON_CPP_EXTERN virtual void onConnectionLocalOpen(Event &e);
- PROTON_CPP_EXTERN virtual void onConnectionRemoteOpen(Event &e);
- PROTON_CPP_EXTERN virtual void onConnectionRemoteClose(Event &e);
- PROTON_CPP_EXTERN virtual void onConnectionOpened(Event &e);
- PROTON_CPP_EXTERN virtual void onConnectionOpening(Event &e);
- PROTON_CPP_EXTERN virtual void onSessionClosed(Event &e);
- PROTON_CPP_EXTERN virtual void onSessionClosing(Event &e);
- PROTON_CPP_EXTERN virtual void onSessionError(Event &e);
- PROTON_CPP_EXTERN virtual void onSessionLocalOpen(Event &e);
- PROTON_CPP_EXTERN virtual void onSessionRemoteOpen(Event &e);
- PROTON_CPP_EXTERN virtual void onSessionRemoteClose(Event &e);
- PROTON_CPP_EXTERN virtual void onSessionOpened(Event &e);
- PROTON_CPP_EXTERN virtual void onSessionOpening(Event &e);
- PROTON_CPP_EXTERN virtual void onLinkClosed(Event &e);
- PROTON_CPP_EXTERN virtual void onLinkClosing(Event &e);
- PROTON_CPP_EXTERN virtual void onLinkError(Event &e);
- PROTON_CPP_EXTERN virtual void onLinkLocalOpen(Event &e);
- PROTON_CPP_EXTERN virtual void onLinkRemoteOpen(Event &e);
- PROTON_CPP_EXTERN virtual void onLinkRemoteClose(Event &e);
- PROTON_CPP_EXTERN virtual void onLinkOpened(Event &e);
- PROTON_CPP_EXTERN virtual void onLinkOpening(Event &e);
- PROTON_CPP_EXTERN virtual void onTransportTailClosed(Event &e);
+ PN_CPP_EXTERN MessagingAdapter(MessagingHandler &delegate);
+ PN_CPP_EXTERN virtual ~MessagingAdapter();
+ PN_CPP_EXTERN virtual void onReactorInit(Event &e);
+ PN_CPP_EXTERN virtual void onLinkFlow(Event &e);
+ PN_CPP_EXTERN virtual void onDelivery(Event &e);
+ PN_CPP_EXTERN virtual void onUnhandled(Event &e);
+ PN_CPP_EXTERN virtual void onConnectionClosed(Event &e);
+ PN_CPP_EXTERN virtual void onConnectionClosing(Event &e);
+ PN_CPP_EXTERN virtual void onConnectionError(Event &e);
+ PN_CPP_EXTERN virtual void onConnectionLocalOpen(Event &e);
+ PN_CPP_EXTERN virtual void onConnectionRemoteOpen(Event &e);
+ PN_CPP_EXTERN virtual void onConnectionRemoteClose(Event &e);
+ PN_CPP_EXTERN virtual void onConnectionOpened(Event &e);
+ PN_CPP_EXTERN virtual void onConnectionOpening(Event &e);
+ PN_CPP_EXTERN virtual void onSessionClosed(Event &e);
+ PN_CPP_EXTERN virtual void onSessionClosing(Event &e);
+ PN_CPP_EXTERN virtual void onSessionError(Event &e);
+ PN_CPP_EXTERN virtual void onSessionLocalOpen(Event &e);
+ PN_CPP_EXTERN virtual void onSessionRemoteOpen(Event &e);
+ PN_CPP_EXTERN virtual void onSessionRemoteClose(Event &e);
+ PN_CPP_EXTERN virtual void onSessionOpened(Event &e);
+ PN_CPP_EXTERN virtual void onSessionOpening(Event &e);
+ PN_CPP_EXTERN virtual void onLinkClosed(Event &e);
+ PN_CPP_EXTERN virtual void onLinkClosing(Event &e);
+ PN_CPP_EXTERN virtual void onLinkError(Event &e);
+ PN_CPP_EXTERN virtual void onLinkLocalOpen(Event &e);
+ PN_CPP_EXTERN virtual void onLinkRemoteOpen(Event &e);
+ PN_CPP_EXTERN virtual void onLinkRemoteClose(Event &e);
+ PN_CPP_EXTERN virtual void onLinkOpened(Event &e);
+ PN_CPP_EXTERN virtual void onLinkOpening(Event &e);
+ PN_CPP_EXTERN virtual void onTransportTailClosed(Event &e);
private:
MessagingHandler &delegate; // The handler for generated MessagingEvent's
};
http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/ea258831/proton-c/bindings/cpp/include/proton/cpp/MessagingEvent.h
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/include/proton/cpp/MessagingEvent.h b/proton-c/bindings/cpp/include/proton/cpp/MessagingEvent.h
index de79618..f71cace 100644
--- a/proton-c/bindings/cpp/include/proton/cpp/MessagingEvent.h
+++ b/proton-c/bindings/cpp/include/proton/cpp/MessagingEvent.h
@@ -79,13 +79,13 @@ class MessagingEvent : public ProtonEvent
MessagingEvent(pn_event_t *ce, pn_event_type_t t, Container &c);
MessagingEvent(MessagingEventType_t t, ProtonEvent &parent);
~MessagingEvent();
- virtual PROTON_CPP_EXTERN void dispatch(Handler &h);
- virtual PROTON_CPP_EXTERN Connection &getConnection();
- virtual PROTON_CPP_EXTERN Sender getSender();
- virtual PROTON_CPP_EXTERN Receiver getReceiver();
- virtual PROTON_CPP_EXTERN Link getLink();
- virtual PROTON_CPP_EXTERN Message getMessage();
- virtual PROTON_CPP_EXTERN void setMessage(Message &);
+ virtual PN_CPP_EXTERN void dispatch(Handler &h);
+ virtual PN_CPP_EXTERN Connection &getConnection();
+ virtual PN_CPP_EXTERN Sender getSender();
+ virtual PN_CPP_EXTERN Receiver getReceiver();
+ virtual PN_CPP_EXTERN Link getLink();
+ virtual PN_CPP_EXTERN Message getMessage();
+ virtual PN_CPP_EXTERN void setMessage(Message &);
private:
MessagingEventType_t messagingType;
ProtonEvent *parentEvent;
http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/ea258831/proton-c/bindings/cpp/include/proton/cpp/MessagingHandler.h
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/include/proton/cpp/MessagingHandler.h b/proton-c/bindings/cpp/include/proton/cpp/MessagingHandler.h
index c6d8f72..e6c0341 100644
--- a/proton-c/bindings/cpp/include/proton/cpp/MessagingHandler.h
+++ b/proton-c/bindings/cpp/include/proton/cpp/MessagingHandler.h
@@ -32,10 +32,10 @@ namespace reactor {
class Event;
class MessagingAdapter;
-class PROTON_CPP_EXTERN MessagingHandler : public ProtonHandler , public Acking
+class PN_CPP_EXTERN MessagingHandler : public ProtonHandler , public Acking
{
public:
- PROTON_CPP_EXTERN MessagingHandler(int prefetch=10, bool autoAccept=true, bool autoSettle=true,
+ PN_CPP_EXTERN MessagingHandler(int prefetch=10, bool autoAccept=true, bool autoSettle=true,
bool peerCloseIsError=false);
virtual ~MessagingHandler();
@@ -83,7 +83,7 @@ class PROTON_CPP_EXTERN MessagingHandler : public ProtonHandler , public Acking
bool peerCloseIsError;
MessagingAdapter *messagingAdapter;
Handler *flowController;
- PROTON_CPP_EXTERN MessagingHandler(bool rawHandler, int prefetch=10, bool autoAccept=true, bool autoSettle=true,
+ PN_CPP_EXTERN MessagingHandler(bool rawHandler, int prefetch=10, bool autoAccept=true, bool autoSettle=true,
bool peerCloseIsError=false);
private:
friend class ContainerImpl;
http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/ea258831/proton-c/bindings/cpp/include/proton/cpp/ProtonEvent.h
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/include/proton/cpp/ProtonEvent.h b/proton-c/bindings/cpp/include/proton/cpp/ProtonEvent.h
index 9e5e9f3..be26d83 100644
--- a/proton-c/bindings/cpp/include/proton/cpp/ProtonEvent.h
+++ b/proton-c/bindings/cpp/include/proton/cpp/ProtonEvent.h
@@ -35,16 +35,16 @@ class Container;
class ProtonEvent : public Event
{
public:
- virtual PROTON_CPP_EXTERN void dispatch(Handler &h);
- virtual PROTON_CPP_EXTERN Container &getContainer();
- virtual PROTON_CPP_EXTERN Connection &getConnection();
- virtual PROTON_CPP_EXTERN Sender getSender();
- virtual PROTON_CPP_EXTERN Receiver getReceiver();
- virtual PROTON_CPP_EXTERN Link getLink();
- PROTON_CPP_EXTERN int getType();
- PROTON_CPP_EXTERN pn_event_t* getPnEvent();
+ virtual PN_CPP_EXTERN void dispatch(Handler &h);
+ virtual PN_CPP_EXTERN Container &getContainer();
+ virtual PN_CPP_EXTERN Connection &getConnection();
+ virtual PN_CPP_EXTERN Sender getSender();
+ virtual PN_CPP_EXTERN Receiver getReceiver();
+ virtual PN_CPP_EXTERN Link getLink();
+ PN_CPP_EXTERN int getType();
+ PN_CPP_EXTERN pn_event_t* getPnEvent();
protected:
- PROTON_CPP_EXTERN ProtonEvent(pn_event_t *ce, pn_event_type_t t, Container &c);
+ PN_CPP_EXTERN ProtonEvent(pn_event_t *ce, pn_event_type_t t, Container &c);
private:
pn_event_t *pnEvent;
int type;
http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/ea258831/proton-c/bindings/cpp/include/proton/cpp/ProtonHandler.h
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/include/proton/cpp/ProtonHandler.h b/proton-c/bindings/cpp/include/proton/cpp/ProtonHandler.h
index b639cc3..4142a2d 100644
--- a/proton-c/bindings/cpp/include/proton/cpp/ProtonHandler.h
+++ b/proton-c/bindings/cpp/include/proton/cpp/ProtonHandler.h
@@ -32,7 +32,7 @@ class ProtonEvent;
class ProtonHandler : public Handler
{
public:
- PROTON_CPP_EXTERN ProtonHandler();
+ PN_CPP_EXTERN ProtonHandler();
virtual void onReactorInit(Event &e);
virtual void onReactorQuiesced(Event &e);
virtual void onReactorFinal(Event &e);
http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/ea258831/proton-c/bindings/cpp/include/proton/cpp/Receiver.h
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/include/proton/cpp/Receiver.h b/proton-c/bindings/cpp/include/proton/cpp/Receiver.h
index c904dc9..a0f45e7 100644
--- a/proton-c/bindings/cpp/include/proton/cpp/Receiver.h
+++ b/proton-c/bindings/cpp/include/proton/cpp/Receiver.h
@@ -35,9 +35,9 @@ namespace reactor {
class Receiver : public Link
{
public:
- PROTON_CPP_EXTERN Receiver(pn_link_t *lnk);
- PROTON_CPP_EXTERN Receiver();
- PROTON_CPP_EXTERN Receiver(const Link& c);
+ PN_CPP_EXTERN Receiver(pn_link_t *lnk);
+ PN_CPP_EXTERN Receiver();
+ PN_CPP_EXTERN Receiver(const Link& c);
protected:
virtual void verifyType(pn_link_t *l);
};
http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/ea258831/proton-c/bindings/cpp/include/proton/cpp/Sender.h
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/include/proton/cpp/Sender.h b/proton-c/bindings/cpp/include/proton/cpp/Sender.h
index c63161c..1205f7f 100644
--- a/proton-c/bindings/cpp/include/proton/cpp/Sender.h
+++ b/proton-c/bindings/cpp/include/proton/cpp/Sender.h
@@ -38,10 +38,10 @@ namespace reactor {
class Sender : public Link
{
public:
- PROTON_CPP_EXTERN Sender(pn_link_t *lnk);
- PROTON_CPP_EXTERN Sender();
- PROTON_CPP_EXTERN Sender(const Link& c);
- PROTON_CPP_EXTERN Delivery send(Message &m);
+ PN_CPP_EXTERN Sender(pn_link_t *lnk);
+ PN_CPP_EXTERN Sender();
+ PN_CPP_EXTERN Sender(const Link& c);
+ PN_CPP_EXTERN Delivery send(Message &m);
protected:
virtual void verifyType(pn_link_t *l);
};
http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/ea258831/proton-c/bindings/cpp/include/proton/cpp/Session.h
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/include/proton/cpp/Session.h b/proton-c/bindings/cpp/include/proton/cpp/Session.h
index 68f5e40..8d2f02a 100644
--- a/proton-c/bindings/cpp/include/proton/cpp/Session.h
+++ b/proton-c/bindings/cpp/include/proton/cpp/Session.h
@@ -42,15 +42,15 @@ class Transport;
class Session : public Endpoint, public ProtonHandle<pn_session_t>
{
public:
- PROTON_CPP_EXTERN Session(pn_session_t *s);
- PROTON_CPP_EXTERN Session();
- PROTON_CPP_EXTERN ~Session();
- PROTON_CPP_EXTERN void open();
- PROTON_CPP_EXTERN Session(const Session&);
- PROTON_CPP_EXTERN Session& operator=(const Session&);
- PROTON_CPP_EXTERN void close();
- PROTON_CPP_EXTERN pn_session_t *getPnSession();
- virtual PROTON_CPP_EXTERN Connection &getConnection();
+ PN_CPP_EXTERN Session(pn_session_t *s);
+ PN_CPP_EXTERN Session();
+ PN_CPP_EXTERN ~Session();
+ PN_CPP_EXTERN void open();
+ PN_CPP_EXTERN Session(const Session&);
+ PN_CPP_EXTERN Session& operator=(const Session&);
+ PN_CPP_EXTERN void close();
+ PN_CPP_EXTERN pn_session_t *getPnSession();
+ virtual PN_CPP_EXTERN Connection &getConnection();
Receiver createReceiver(std::string name);
Sender createSender(std::string name);
private:
http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/ea258831/proton-c/bindings/cpp/include/proton/cpp/Terminus.h
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/include/proton/cpp/Terminus.h b/proton-c/bindings/cpp/include/proton/cpp/Terminus.h
index 092fcc1..6f93cf4 100644
--- a/proton-c/bindings/cpp/include/proton/cpp/Terminus.h
+++ b/proton-c/bindings/cpp/include/proton/cpp/Terminus.h
@@ -52,25 +52,25 @@ class Terminus : public ProtonHandle<pn_terminus_t>
};
public:
- PROTON_CPP_EXTERN Terminus();
- PROTON_CPP_EXTERN ~Terminus();
- PROTON_CPP_EXTERN Terminus(const Terminus&);
- PROTON_CPP_EXTERN Terminus& operator=(const Terminus&);
- PROTON_CPP_EXTERN pn_terminus_t *getPnTerminus();
- PROTON_CPP_EXTERN Type getType();
- PROTON_CPP_EXTERN void setType(Type);
- PROTON_CPP_EXTERN ExpiryPolicy getExpiryPolicy();
- PROTON_CPP_EXTERN void setExpiryPolicy(ExpiryPolicy);
- PROTON_CPP_EXTERN DistributionMode getDistributionMode();
- PROTON_CPP_EXTERN void setDistributionMode(DistributionMode);
- PROTON_CPP_EXTERN std::string getAddress();
- PROTON_CPP_EXTERN void setAddress(std::string &);
- PROTON_CPP_EXTERN bool isDynamic();
- PROTON_CPP_EXTERN void setDynamic(bool);
+ PN_CPP_EXTERN Terminus();
+ PN_CPP_EXTERN ~Terminus();
+ PN_CPP_EXTERN Terminus(const Terminus&);
+ PN_CPP_EXTERN Terminus& operator=(const Terminus&);
+ PN_CPP_EXTERN pn_terminus_t *getPnTerminus();
+ PN_CPP_EXTERN Type getType();
+ PN_CPP_EXTERN void setType(Type);
+ PN_CPP_EXTERN ExpiryPolicy getExpiryPolicy();
+ PN_CPP_EXTERN void setExpiryPolicy(ExpiryPolicy);
+ PN_CPP_EXTERN DistributionMode getDistributionMode();
+ PN_CPP_EXTERN void setDistributionMode(DistributionMode);
+ PN_CPP_EXTERN std::string getAddress();
+ PN_CPP_EXTERN void setAddress(std::string &);
+ PN_CPP_EXTERN bool isDynamic();
+ PN_CPP_EXTERN void setDynamic(bool);
private:
Link *link;
- PROTON_CPP_EXTERN Terminus(pn_terminus_t *, Link *);
+ PN_CPP_EXTERN Terminus(pn_terminus_t *, Link *);
friend class Link;
friend class ProtonImplRef<Terminus>;
};
http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/ea258831/proton-c/bindings/cpp/include/proton/cpp/Transport.h
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/include/proton/cpp/Transport.h b/proton-c/bindings/cpp/include/proton/cpp/Transport.h
index 141e0a3..cd8bf91 100644
--- a/proton-c/bindings/cpp/include/proton/cpp/Transport.h
+++ b/proton-c/bindings/cpp/include/proton/cpp/Transport.h
@@ -35,9 +35,9 @@ class Connection;
class Transport
{
public:
- PROTON_CPP_EXTERN Transport();
- PROTON_CPP_EXTERN ~Transport();
- PROTON_CPP_EXTERN void bind(Connection &c);
+ PN_CPP_EXTERN Transport();
+ PN_CPP_EXTERN ~Transport();
+ PN_CPP_EXTERN void bind(Connection &c);
Connection *connection;
pn_transport_t *pnTransport;
};
http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/ea258831/proton-c/bindings/cpp/include/proton/cpp/Value.h
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/include/proton/cpp/Value.h b/proton-c/bindings/cpp/include/proton/cpp/Value.h
new file mode 100644
index 0000000..65ca7ec
--- /dev/null
+++ b/proton-c/bindings/cpp/include/proton/cpp/Value.h
@@ -0,0 +1,103 @@
+#ifndef VALUE_H
+#define VALUE_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 "proton/cpp/Encoder.h"
+#include "proton/cpp/Decoder.h"
+#include <iosfwd>
+
+namespace proton {
+namespace reactor {
+
+/** Holds a sequence of AMQP values, allows inserting and extracting.
+ *
+ * After inserting values, call rewind() to extract them.
+ */
+class Values : public Encoder, public Decoder {
+ public:
+ Values();
+ Values(const Values&);
+ ~Values();
+
+ /** Copy data from another Values */
+ Values& operator=(const Values&);
+
+ PN_CPP_EXTERN void rewind();
+
+ private:
+ friend class Value;
+};
+
+/** Holds a single AMQP value. */
+class Value {
+ public:
+ PN_CPP_EXTERN Value();
+ PN_CPP_EXTERN Value(const Value&);
+ PN_CPP_EXTERN ~Value();
+
+ PN_CPP_EXTERN Value& operator=(const Value&);
+
+ TypeId type() const;
+
+ /** Set the value */
+ template<class T> void set(const T& value);
+ /** Get the value */
+ template<class T> void get(T& value) const;
+ /** Get the value */
+ template<class T> T get() const;
+
+ /** Assignment sets the value */
+ template<class T> Value& operator=(const T& value);
+ /** Conversion operator gets the value */
+ template<class T> operator T() const;
+
+ /** Insert a value into an Encoder. */
+ PN_CPP_EXTERN friend Encoder& operator<<(Encoder&, const Value&);
+
+ /** Extract a value from a decoder. */
+ PN_CPP_EXTERN friend Decoder& operator>>(Decoder&, const Value&);
+
+ friend Decoder& operator>>(Decoder&, Value&);
+ friend Encoder& operator<<(Encoder&, const Value&);
+
+ private:
+ Values values;
+};
+
+template<class T> void Value::set(const T& value) {
+ values.clear();
+ values << value;
+}
+
+template<class T> void Value::get(T& value) const {
+ Values& v = const_cast<Values&>(values);
+ v.rewind();
+ v >> value;
+}
+
+template<class T> T Value::get() const { T value; get(value); return value; }
+
+template<class T> Value& Value::operator=(const T& value) { set(value); return *this; }
+
+template<class T> Value::operator T() const { return get<T>(); }
+
+}}
+
+#endif // VALUE_H
http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/ea258831/proton-c/bindings/cpp/include/proton/cpp/WaitCondition.h
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/include/proton/cpp/WaitCondition.h b/proton-c/bindings/cpp/include/proton/cpp/WaitCondition.h
index f4c7cb5..f973fa7 100644
--- a/proton-c/bindings/cpp/include/proton/cpp/WaitCondition.h
+++ b/proton-c/bindings/cpp/include/proton/cpp/WaitCondition.h
@@ -32,7 +32,7 @@ namespace reactor {
class WaitCondition
{
public:
- PROTON_CPP_EXTERN virtual ~WaitCondition();
+ PN_CPP_EXTERN virtual ~WaitCondition();
// Overide this member function to indicate whether an expected
// condition is achieved and requires no further waiting.
http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/ea258831/proton-c/bindings/cpp/include/proton/cpp/types.h
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/include/proton/cpp/types.h b/proton-c/bindings/cpp/include/proton/cpp/types.h
new file mode 100644
index 0000000..963a330
--- /dev/null
+++ b/proton-c/bindings/cpp/include/proton/cpp/types.h
@@ -0,0 +1,162 @@
+#ifndef TYPES_H
+#define 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.
+ */
+
+#include <string>
+#include <stdint.h>
+#include <proton/codec.h>
+
+namespace proton {
+namespace reactor {
+
+/**@file
+ *
+ * C++ types representing simple AMQP types.
+ *
+ */
+
+
+/** Convert pn_bytes_t to string */
+std::string str(const pn_bytes_t&);
+
+/** Convert string to pn_bytes_t */
+pn_bytes_t bytes(const std::string&);
+
+/** Identifies an AMQP type */
+enum TypeId {
+ NULL_=PN_NULL,
+ BOOL=PN_BOOL,
+ UBYTE=PN_UBYTE,
+ BYTE=PN_BYTE,
+ USHORT=PN_USHORT,
+ SHORT=PN_SHORT,
+ UINT=PN_UINT,
+ INT=PN_INT,
+ CHAR=PN_CHAR,
+ ULONG=PN_ULONG,
+ LONG=PN_LONG,
+ TIMESTAMP=PN_TIMESTAMP,
+ FLOAT=PN_FLOAT,
+ DOUBLE=PN_DOUBLE,
+ DECIMAL32=PN_DECIMAL32,
+ DECIMAL64=PN_DECIMAL64,
+ DECIMAL128=PN_DECIMAL128,
+ UUID=PN_UUID,
+ BINARY=PN_BINARY,
+ STRING=PN_STRING,
+ SYMBOL=PN_SYMBOL,
+ DESCRIBED=PN_DESCRIBED,
+ ARRAY=PN_ARRAY,
+ LIST=PN_LIST,
+ MAP=PN_MAP
+};
+
+/** @defgroup types C++ type definitions for AMQP types.
+ *
+ * These types are all distinct for overloading purposes and will insert as the
+ * corresponding AMQP type with Encoder operator<<.
+ *
+ * @{
+ */
+struct Null {};
+typedef bool Bool;
+typedef uint8_t Ubyte;
+typedef int8_t Byte;
+typedef uint16_t Ushort;
+typedef int16_t Short;
+typedef uint32_t Uint;
+typedef int32_t Int;
+typedef wchar_t Char;
+typedef uint64_t Ulong;
+typedef int64_t Long;
+typedef float Float;
+typedef double Double;
+
+///@internal
+#define STRING_LIKE(NAME) \
+ struct NAME : public std::string{ \
+ NAME(const std::string& s=std::string()) : std::string(s) {} \
+ NAME(const pn_bytes_t& b) : std::string(str(b)) {} \
+ operator pn_bytes_t() const { return bytes(*this); } \
+ }
+
+/** UTF-8 encoded string */
+STRING_LIKE(String);
+/** ASCII encoded symbolic name */
+STRING_LIKE(Symbol);
+/** Binary data */
+STRING_LIKE(Binary);
+
+// TODO aconway 2015-06-11: alternative representation of variable-length data
+// as pointer to existing buffers.
+
+template <class T> struct Decimal {
+ T value;
+ Decimal(T v) : value(v) {}
+ Decimal& operator=(T v) { value = v; }
+ operator T() const { return value; }
+};
+typedef Decimal<pn_decimal32_t> Decimal32;
+typedef Decimal<pn_decimal64_t> Decimal64;
+typedef Decimal<pn_decimal128_t> Decimal128;
+
+struct Timestamp {
+ pn_timestamp_t milliseconds; ///< Since the epoch 00:00:00 (UTC), 1 January 1970.
+ Timestamp(int64_t ms) : milliseconds(ms) {}
+ operator pn_timestamp_t() const { return milliseconds; }
+};
+
+typedef pn_uuid_t Uuid;
+
+///@}
+
+/** Meta-function to get the type-id from a class */
+template <class T> struct TypeIdOf {};
+template<> struct TypeIdOf<Null> { static const TypeId value; };
+template<> struct TypeIdOf<Bool> { static const TypeId value; };
+template<> struct TypeIdOf<Ubyte> { static const TypeId value; };
+template<> struct TypeIdOf<Byte> { static const TypeId value; };
+template<> struct TypeIdOf<Ushort> { static const TypeId value; };
+template<> struct TypeIdOf<Short> { static const TypeId value; };
+template<> struct TypeIdOf<Uint> { static const TypeId value; };
+template<> struct TypeIdOf<Int> { static const TypeId value; };
+template<> struct TypeIdOf<Char> { static const TypeId value; };
+template<> struct TypeIdOf<Ulong> { static const TypeId value; };
+template<> struct TypeIdOf<Long> { static const TypeId value; };
+template<> struct TypeIdOf<Timestamp> { static const TypeId value; };
+template<> struct TypeIdOf<Float> { static const TypeId value; };
+template<> struct TypeIdOf<Double> { static const TypeId value; };
+template<> struct TypeIdOf<Decimal32> { static const TypeId value; };
+template<> struct TypeIdOf<Decimal64> { static const TypeId value; };
+template<> struct TypeIdOf<Decimal128> { static const TypeId value; };
+template<> struct TypeIdOf<Uuid> { static const TypeId value; };
+template<> struct TypeIdOf<Binary> { static const TypeId value; };
+template<> struct TypeIdOf<String> { static const TypeId value; };
+template<> struct TypeIdOf<Symbol> { static const TypeId value; };
+
+/** Return the name of a type. */
+std::string typeName(TypeId);
+
+/** Return the name of a type from a class. */
+template<class T> std::string typeName() { return typeName(TypeIdOf<T>::value); }
+
+}}
+
+#endif // TYPES_H
http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/ea258831/proton-c/bindings/cpp/src/ConnectionImpl.h
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/src/ConnectionImpl.h b/proton-c/bindings/cpp/src/ConnectionImpl.h
index 48210a3..7add9a0 100644
--- a/proton-c/bindings/cpp/src/ConnectionImpl.h
+++ b/proton-c/bindings/cpp/src/ConnectionImpl.h
@@ -39,19 +39,19 @@ class Container;
class ConnectionImpl : public Endpoint
{
public:
- PROTON_CPP_EXTERN ConnectionImpl(Container &c, pn_connection_t &pnConn);
- PROTON_CPP_EXTERN ConnectionImpl(Container &c, Handler *h = 0);
- PROTON_CPP_EXTERN ~ConnectionImpl();
- PROTON_CPP_EXTERN Transport &getTransport();
- PROTON_CPP_EXTERN Handler *getOverride();
- PROTON_CPP_EXTERN void setOverride(Handler *h);
- PROTON_CPP_EXTERN void open();
- PROTON_CPP_EXTERN void close();
- PROTON_CPP_EXTERN pn_connection_t *getPnConnection();
- PROTON_CPP_EXTERN Container &getContainer();
- PROTON_CPP_EXTERN std::string getHostname();
- PROTON_CPP_EXTERN Link getLinkHead(Endpoint::State mask);
- virtual PROTON_CPP_EXTERN Connection &getConnection();
+ PN_CPP_EXTERN ConnectionImpl(Container &c, pn_connection_t &pnConn);
+ PN_CPP_EXTERN ConnectionImpl(Container &c, Handler *h = 0);
+ PN_CPP_EXTERN ~ConnectionImpl();
+ PN_CPP_EXTERN Transport &getTransport();
+ PN_CPP_EXTERN Handler *getOverride();
+ PN_CPP_EXTERN void setOverride(Handler *h);
+ PN_CPP_EXTERN void open();
+ PN_CPP_EXTERN void close();
+ PN_CPP_EXTERN pn_connection_t *getPnConnection();
+ PN_CPP_EXTERN Container &getContainer();
+ PN_CPP_EXTERN std::string getHostname();
+ PN_CPP_EXTERN Link getLinkHead(Endpoint::State mask);
+ virtual PN_CPP_EXTERN Connection &getConnection();
static Connection &getReactorReference(pn_connection_t *);
static ConnectionImpl *getImpl(const Connection &c) { return c.impl; }
void reactorDetach();
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@qpid.apache.org
For additional commands, e-mail: commits-help@qpid.apache.org