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/12/30 22:13:32 UTC

[44/50] [abbrv] qpid-proton git commit: PROTON-1085: c++: Rename "atom" type to "scalar".

PROTON-1085: c++: Rename "atom" type to "scalar".

Scalar is the term used in the AMQP standard.


Project: http://git-wip-us.apache.org/repos/asf/qpid-proton/repo
Commit: http://git-wip-us.apache.org/repos/asf/qpid-proton/commit/d2c5a5f2
Tree: http://git-wip-us.apache.org/repos/asf/qpid-proton/tree/d2c5a5f2
Diff: http://git-wip-us.apache.org/repos/asf/qpid-proton/diff/d2c5a5f2

Branch: refs/heads/go1
Commit: d2c5a5f2017ed95102b03b173ad050e616fab30b
Parents: fd52a33
Author: Alan Conway <ac...@redhat.com>
Authored: Mon Dec 28 15:37:23 2015 -0500
Committer: Alan Conway <ac...@redhat.com>
Committed: Tue Dec 29 15:55:38 2015 -0500

----------------------------------------------------------------------
 proton-c/bindings/cpp/CMakeLists.txt            |   4 +-
 proton-c/bindings/cpp/include/proton/atom.hpp   | 122 ------------
 proton-c/bindings/cpp/include/proton/scalar.hpp | 122 ++++++++++++
 proton-c/bindings/cpp/include/proton/types.hpp  |  14 +-
 proton-c/bindings/cpp/src/atom.cpp              | 185 -------------------
 proton-c/bindings/cpp/src/atom_test.cpp         | 105 -----------
 proton-c/bindings/cpp/src/scalar.cpp            | 185 +++++++++++++++++++
 proton-c/bindings/cpp/src/scalar_test.cpp       | 105 +++++++++++
 proton-c/bindings/cpp/src/types.cpp             |  18 +-
 9 files changed, 430 insertions(+), 430 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/d2c5a5f2/proton-c/bindings/cpp/CMakeLists.txt
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/CMakeLists.txt b/proton-c/bindings/cpp/CMakeLists.txt
index 78df0b5..10d40f8 100644
--- a/proton-c/bindings/cpp/CMakeLists.txt
+++ b/proton-c/bindings/cpp/CMakeLists.txt
@@ -26,7 +26,7 @@ include_directories(
 
 set(qpid-proton-cpp-source
   src/acceptor.cpp
-  src/atom.cpp
+  src/scalar.cpp
   src/blocking_connection.cpp
   src/blocking_connection_impl.cpp
   src/blocking_fetcher.cpp
@@ -170,4 +170,4 @@ endmacro(add_cpp_test)
 add_cpp_test(interop_test ${CMAKE_SOURCE_DIR}/tests)
 add_cpp_test(message_test)
 add_cpp_test(encode_decode_test)
-add_cpp_test(atom_test)
+add_cpp_test(scalar_test)

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/d2c5a5f2/proton-c/bindings/cpp/include/proton/atom.hpp
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/include/proton/atom.hpp b/proton-c/bindings/cpp/include/proton/atom.hpp
deleted file mode 100644
index ce2a385..0000000
--- a/proton-c/bindings/cpp/include/proton/atom.hpp
+++ /dev/null
@@ -1,122 +0,0 @@
-#ifndef ATOM_HPP
-#define ATOM_HPP
-/*
- * 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/types.hpp"
-#include <iosfwd>
-
-namespace proton {
-
-class atom;
-
-/** atom holds an instance of an atomic proton type. */
-class atom : public comparable<atom> {
-  public:
-    PN_CPP_EXTERN atom();
-    // Use default assign and copy.
-
-    /// Type for the value in the atom, NULL_TYPE if empty()
-    PN_CPP_EXTERN type_id type() const;
-    /// True if the atom is empty.
-    PN_CPP_EXTERN bool empty() const;
-
-    ///@name Create an atom, type() is deduced from the C++ type of the value.
-    ///@{
-    PN_CPP_EXTERN explicit atom(bool);
-    PN_CPP_EXTERN explicit atom(uint8_t);
-    PN_CPP_EXTERN explicit atom(int8_t);
-    PN_CPP_EXTERN explicit atom(uint16_t);
-    PN_CPP_EXTERN explicit atom(int16_t);
-    PN_CPP_EXTERN explicit atom(uint32_t);
-    PN_CPP_EXTERN explicit atom(int32_t);
-    PN_CPP_EXTERN explicit atom(uint64_t);
-    PN_CPP_EXTERN explicit atom(int64_t);
-    PN_CPP_EXTERN explicit atom(wchar_t);
-    PN_CPP_EXTERN explicit atom(float);
-    PN_CPP_EXTERN explicit atom(double);
-    PN_CPP_EXTERN explicit atom(amqp_timestamp);
-    PN_CPP_EXTERN explicit atom(const amqp_decimal32&);
-    PN_CPP_EXTERN explicit atom(const amqp_decimal64&);
-    PN_CPP_EXTERN explicit atom(const amqp_decimal128&);
-    PN_CPP_EXTERN explicit atom(const amqp_uuid&);
-    PN_CPP_EXTERN explicit atom(const amqp_string&);
-    PN_CPP_EXTERN explicit atom(const amqp_symbol&);
-    PN_CPP_EXTERN explicit atom(const amqp_binary&);
-    PN_CPP_EXTERN explicit atom(const std::string& s); ///< Treated as an AMQP string
-    PN_CPP_EXTERN explicit atom(const char* s);        ///< Treated as an AMQP string
-    ///@}
-
-    /// Assign to an atom using the same rules as construction.
-    template <class T> atom& operator=(T x) { return *this = atom(x); }
-
-    ///@name get(T&) extracts the value if the types match exactly,
-    ///i.e. if `type() == type_id_of<T>::value`
-    /// throws type_mismatch otherwise.
-    ///@{
-    PN_CPP_EXTERN void get(bool&) const;
-    PN_CPP_EXTERN void get(uint8_t&) const;
-    PN_CPP_EXTERN void get(int8_t&) const;
-    PN_CPP_EXTERN void get(uint16_t&) const;
-    PN_CPP_EXTERN void get(int16_t&) const;
-    PN_CPP_EXTERN void get(uint32_t&) const;
-    PN_CPP_EXTERN void get(int32_t&) const;
-    PN_CPP_EXTERN void get(uint64_t&) const;
-    PN_CPP_EXTERN void get(int64_t&) const;
-    PN_CPP_EXTERN void get(wchar_t&) const;
-    PN_CPP_EXTERN void get(float&) const;
-    PN_CPP_EXTERN void get(double&) const;
-    PN_CPP_EXTERN void get(amqp_timestamp&) const;
-    PN_CPP_EXTERN void get(amqp_decimal32&) const;
-    PN_CPP_EXTERN void get(amqp_decimal64&) const;
-    PN_CPP_EXTERN void get(amqp_decimal128&) const;
-    PN_CPP_EXTERN void get(amqp_uuid&) const;
-    PN_CPP_EXTERN void get(amqp_string&) const;
-    PN_CPP_EXTERN void get(amqp_symbol&) const;
-    PN_CPP_EXTERN void get(amqp_binary&) const;
-    PN_CPP_EXTERN void get(std::string&) const; ///< Treated as an AMQP string
-    ///@}
-
-    ///@ get<T>() is like get(T&) but returns the value..
-    template<class T> T get() const { T x; get(x); return x; }
-
-    ///@name as_ methods do "loose" conversion, they will convert the atom's
-    ///value to the requested type if possible, else throw type_mismatch
-    ///@{
-    PN_CPP_EXTERN int64_t as_int() const;     ///< Allowed if type_id_integral(type())
-    PN_CPP_EXTERN uint64_t as_uint() const;   ///< Allowed if type_id_integral(type())
-    PN_CPP_EXTERN double as_double() const;    ///< Allowed if type_id_floating_point(type())
-    PN_CPP_EXTERN std::string as_string() const; ///< Allowed if type_id_string_like(type())
-    ///@}
-
-    PN_CPP_EXTERN bool operator==(const atom& x) const;
-    /// Note if the values are of different type(), operator< will compare the type()
-    PN_CPP_EXTERN bool operator<(const atom& x) const;
-
-  PN_CPP_EXTERN friend std::ostream& operator<<(std::ostream&, const atom&);
-
-  private:
-    void ok(pn_type_t) const;
-    void set(const std::string&);
-    pn_atom_t atom_;
-    std::string str_;           // Owner of string-like data.
-};
-
-}
-#endif // ATOM_HPP

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/d2c5a5f2/proton-c/bindings/cpp/include/proton/scalar.hpp
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/include/proton/scalar.hpp b/proton-c/bindings/cpp/include/proton/scalar.hpp
new file mode 100644
index 0000000..0745281
--- /dev/null
+++ b/proton-c/bindings/cpp/include/proton/scalar.hpp
@@ -0,0 +1,122 @@
+#ifndef SCALAR_HPP
+#define SCALAR_HPP
+/*
+ * 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/types.hpp"
+#include <iosfwd>
+
+namespace proton {
+
+class scalar;
+
+/** scalar holds an instance of an atomic proton type. */
+class scalar : public comparable<scalar> {
+  public:
+    PN_CPP_EXTERN scalar();
+    // Use default assign and copy.
+
+    /// Type for the value in the scalar, NULL_TYPE if empty()
+    PN_CPP_EXTERN type_id type() const;
+    /// True if the scalar is empty.
+    PN_CPP_EXTERN bool empty() const;
+
+    ///@name Create an scalar, type() is deduced from the C++ type of the value.
+    ///@{
+    PN_CPP_EXTERN explicit scalar(bool);
+    PN_CPP_EXTERN explicit scalar(uint8_t);
+    PN_CPP_EXTERN explicit scalar(int8_t);
+    PN_CPP_EXTERN explicit scalar(uint16_t);
+    PN_CPP_EXTERN explicit scalar(int16_t);
+    PN_CPP_EXTERN explicit scalar(uint32_t);
+    PN_CPP_EXTERN explicit scalar(int32_t);
+    PN_CPP_EXTERN explicit scalar(uint64_t);
+    PN_CPP_EXTERN explicit scalar(int64_t);
+    PN_CPP_EXTERN explicit scalar(wchar_t);
+    PN_CPP_EXTERN explicit scalar(float);
+    PN_CPP_EXTERN explicit scalar(double);
+    PN_CPP_EXTERN explicit scalar(amqp_timestamp);
+    PN_CPP_EXTERN explicit scalar(const amqp_decimal32&);
+    PN_CPP_EXTERN explicit scalar(const amqp_decimal64&);
+    PN_CPP_EXTERN explicit scalar(const amqp_decimal128&);
+    PN_CPP_EXTERN explicit scalar(const amqp_uuid&);
+    PN_CPP_EXTERN explicit scalar(const amqp_string&);
+    PN_CPP_EXTERN explicit scalar(const amqp_symbol&);
+    PN_CPP_EXTERN explicit scalar(const amqp_binary&);
+    PN_CPP_EXTERN explicit scalar(const std::string& s); ///< Treated as an AMQP string
+    PN_CPP_EXTERN explicit scalar(const char* s);        ///< Treated as an AMQP string
+    ///@}
+
+    /// Assign to an scalar using the same rules as construction.
+    template <class T> scalar& operator=(T x) { return *this = scalar(x); }
+
+    ///@name get(T&) extracts the value if the types match exactly,
+    ///i.e. if `type() == type_id_of<T>::value`
+    /// throws type_mismatch otherwise.
+    ///@{
+    PN_CPP_EXTERN void get(bool&) const;
+    PN_CPP_EXTERN void get(uint8_t&) const;
+    PN_CPP_EXTERN void get(int8_t&) const;
+    PN_CPP_EXTERN void get(uint16_t&) const;
+    PN_CPP_EXTERN void get(int16_t&) const;
+    PN_CPP_EXTERN void get(uint32_t&) const;
+    PN_CPP_EXTERN void get(int32_t&) const;
+    PN_CPP_EXTERN void get(uint64_t&) const;
+    PN_CPP_EXTERN void get(int64_t&) const;
+    PN_CPP_EXTERN void get(wchar_t&) const;
+    PN_CPP_EXTERN void get(float&) const;
+    PN_CPP_EXTERN void get(double&) const;
+    PN_CPP_EXTERN void get(amqp_timestamp&) const;
+    PN_CPP_EXTERN void get(amqp_decimal32&) const;
+    PN_CPP_EXTERN void get(amqp_decimal64&) const;
+    PN_CPP_EXTERN void get(amqp_decimal128&) const;
+    PN_CPP_EXTERN void get(amqp_uuid&) const;
+    PN_CPP_EXTERN void get(amqp_string&) const;
+    PN_CPP_EXTERN void get(amqp_symbol&) const;
+    PN_CPP_EXTERN void get(amqp_binary&) const;
+    PN_CPP_EXTERN void get(std::string&) const; ///< Treated as an AMQP string
+    ///@}
+
+    ///@ get<T>() is like get(T&) but returns the value..
+    template<class T> T get() const { T x; get(x); return x; }
+
+    ///@name as_ methods do "loose" conversion, they will convert the scalar's
+    ///value to the requested type if possible, else throw type_mismatch
+    ///@{
+    PN_CPP_EXTERN int64_t as_int() const;     ///< Allowed if type_id_integral(type())
+    PN_CPP_EXTERN uint64_t as_uint() const;   ///< Allowed if type_id_integral(type())
+    PN_CPP_EXTERN double as_double() const;    ///< Allowed if type_id_floating_point(type())
+    PN_CPP_EXTERN std::string as_string() const; ///< Allowed if type_id_string_like(type())
+    ///@}
+
+    PN_CPP_EXTERN bool operator==(const scalar& x) const;
+    /// Note if the values are of different type(), operator< will compare the type()
+    PN_CPP_EXTERN bool operator<(const scalar& x) const;
+
+  PN_CPP_EXTERN friend std::ostream& operator<<(std::ostream&, const scalar&);
+
+  private:
+    void ok(pn_type_t) const;
+    void set(const std::string&);
+    pn_atom_t atom_;
+    std::string str_;           // Owner of string-like data.
+};
+
+}
+#endif // SCALAR_HPP

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/d2c5a5f2/proton-c/bindings/cpp/include/proton/types.hpp
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/include/proton/types.hpp b/proton-c/bindings/cpp/include/proton/types.hpp
index 75bb226..645d9da 100644
--- a/proton-c/bindings/cpp/include/proton/types.hpp
+++ b/proton-c/bindings/cpp/include/proton/types.hpp
@@ -198,13 +198,13 @@ PN_CPP_EXTERN std::string type_name(type_id);
 ///@name Attributes of a type_id value, returns same result as the
 /// corresponding std::type_traits tests for the corresponding C++ types.
 ///@{
-PN_CPP_EXTERN bool type_id_atom(type_id);
-PN_CPP_EXTERN bool type_id_integral(type_id);
-PN_CPP_EXTERN bool type_id_signed(type_id); ///< CHAR and BOOL are not signed.
-PN_CPP_EXTERN bool type_id_floating_point(type_id);
-PN_CPP_EXTERN bool type_id_decimal(type_id);
-PN_CPP_EXTERN bool type_id_string_like(type_id);   ///< STRING, SYMBOL, BINARY
-PN_CPP_EXTERN bool type_id_container(type_id);
+PN_CPP_EXTERN bool type_id_is_scalar(type_id);
+PN_CPP_EXTERN bool type_id_is_integral(type_id);
+PN_CPP_EXTERN bool type_id_is_signed(type_id); ///< CHAR and BOOL are not signed.
+PN_CPP_EXTERN bool type_id_is_floating_point(type_id);
+PN_CPP_EXTERN bool type_id_is_decimal(type_id);
+PN_CPP_EXTERN bool type_id_is_string_like(type_id);   ///< STRING, SYMBOL, BINARY
+PN_CPP_EXTERN bool type_id_is_container(type_id);
 ///@}
 
 /** Print the name of a type. */

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/d2c5a5f2/proton-c/bindings/cpp/src/atom.cpp
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/src/atom.cpp b/proton-c/bindings/cpp/src/atom.cpp
deleted file mode 100644
index 034b22c..0000000
--- a/proton-c/bindings/cpp/src/atom.cpp
+++ /dev/null
@@ -1,185 +0,0 @@
-/*
- * 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/atom.hpp"
-#include "proton/type_traits.hpp"
-
-#include <ostream>
-
-namespace proton {
-
-atom::atom() { atom_.type = PN_NULL; }
-
-type_id atom::type() const { return type_id(atom_.type); }
-bool atom::empty() const { return type() == NULL_TYPE; }
-
-atom::atom(bool x) { atom_.u.as_bool = x; atom_.type = PN_BOOL; }
-atom::atom(uint8_t x) { atom_.u.as_ubyte = x; atom_.type = PN_UBYTE; }
-atom::atom(int8_t x) { atom_.u.as_byte = x; atom_.type = PN_BYTE; }
-atom::atom(uint16_t x) { atom_.u.as_ushort = x; atom_.type = PN_USHORT; }
-atom::atom(int16_t x) { atom_.u.as_short = x; atom_.type = PN_SHORT; }
-atom::atom(uint32_t x) { atom_.u.as_uint = x; atom_.type = PN_UINT; }
-atom::atom(int32_t x) { atom_.u.as_int = x; atom_.type = PN_INT; }
-atom::atom(uint64_t x) { atom_.u.as_ulong = x; atom_.type = PN_ULONG; }
-atom::atom(int64_t x) { atom_.u.as_long = x; atom_.type = PN_LONG; }
-atom::atom(wchar_t x) { atom_.u.as_char = pn_char_t(x); atom_.type = PN_CHAR; }
-atom::atom(float x) { atom_.u.as_float = x; atom_.type = PN_FLOAT; }
-atom::atom(double x) { atom_.u.as_double = x; atom_.type = PN_DOUBLE; }
-atom::atom(amqp_timestamp x) { atom_.u.as_timestamp = x; atom_.type = PN_TIMESTAMP; }
-atom::atom(const amqp_decimal32& x) { atom_.u.as_decimal32 = x; atom_.type = PN_DECIMAL32; }
-atom::atom(const amqp_decimal64& x) { atom_.u.as_decimal64 = x; atom_.type = PN_DECIMAL64; }
-atom::atom(const amqp_decimal128& x) { atom_.u.as_decimal128 = x; atom_.type = PN_DECIMAL128; }
-atom::atom(const amqp_uuid& x) { atom_.u.as_uuid = x; atom_.type = PN_UUID; }
-
-void atom::set(const std::string& x) { str_ = x; atom_.u.as_bytes = pn_bytes(str_); }
-atom::atom(const amqp_string& x) { set(x); atom_.type = PN_STRING; }
-atom::atom(const amqp_symbol& x) { set(x); atom_.type = PN_SYMBOL; }
-atom::atom(const amqp_binary& x) { set(x); atom_.type = PN_BINARY; }
-atom::atom(const std::string& x) { *this = amqp_string(x); }
-atom::atom(const char* x) { *this = amqp_string(x); }
-
-void atom::ok(pn_type_t t) const {
-    if (atom_.type != t) throw type_mismatch(type_id(t), type());
-}
-
-void atom::get(bool& x) const { ok(PN_BOOL); x = atom_.u.as_bool; }
-void atom::get(uint8_t& x) const { ok(PN_UBYTE); x = atom_.u.as_ubyte; }
-void atom::get(int8_t& x) const { ok(PN_BYTE); x = atom_.u.as_byte; }
-void atom::get(uint16_t& x) const { ok(PN_USHORT); x = atom_.u.as_ushort; }
-void atom::get(int16_t& x) const { ok(PN_SHORT); x = atom_.u.as_short; }
-void atom::get(uint32_t& x) const { ok(PN_UINT); x = atom_.u.as_uint; }
-void atom::get(int32_t& x) const { ok(PN_INT); x = atom_.u.as_int; }
-void atom::get(wchar_t& x) const { ok(PN_CHAR); x = wchar_t(atom_.u.as_char); }
-void atom::get(uint64_t& x) const { ok(PN_ULONG); x = atom_.u.as_ulong; }
-void atom::get(int64_t& x) const { ok(PN_LONG); x = atom_.u.as_long; }
-void atom::get(amqp_timestamp& x) const { ok(PN_TIMESTAMP); x = atom_.u.as_timestamp; }
-void atom::get(float& x) const { ok(PN_FLOAT); x = atom_.u.as_float; }
-void atom::get(double& x) const { ok(PN_DOUBLE); x = atom_.u.as_double; }
-void atom::get(amqp_decimal32& x) const { ok(PN_DECIMAL32); x = atom_.u.as_decimal32; }
-void atom::get(amqp_decimal64& x) const { ok(PN_DECIMAL64); x = atom_.u.as_decimal64; }
-void atom::get(amqp_decimal128& x) const { ok(PN_DECIMAL128); x = atom_.u.as_decimal128; }
-void atom::get(amqp_uuid& x) const { ok(PN_UUID); x = atom_.u.as_uuid; }
-void atom::get(amqp_string& x) const { ok(PN_STRING); x = str_; }
-void atom::get(amqp_symbol& x) const { ok(PN_SYMBOL); x = str_; }
-void atom::get(amqp_binary& x) const { ok(PN_BINARY); x = str_; }
-void atom::get(std::string& x) const { x = get<amqp_string>(); }
-
-int64_t atom::as_int() const {
-    if (type_id_floating_point(type()))
-        return int64_t(as_double());
-    switch (atom_.type) {
-      case PN_BOOL: return atom_.u.as_bool;
-      case PN_UBYTE: return atom_.u.as_ubyte;
-      case PN_BYTE: return atom_.u.as_byte;
-      case PN_USHORT: return atom_.u.as_ushort;
-      case PN_SHORT: return atom_.u.as_short;
-      case PN_UINT: return atom_.u.as_uint;
-      case PN_INT: return atom_.u.as_int;
-      case PN_CHAR: return atom_.u.as_char;
-      case PN_ULONG: return int64_t(atom_.u.as_ulong);
-      case PN_LONG: return atom_.u.as_long;
-      default: throw type_mismatch(LONG, type(), "cannot convert");
-    }
-}
-
-uint64_t atom::as_uint() const {
-    if  (!type_id_integral(type()))
-        throw type_mismatch(ULONG, type(), "cannot convert");
-    return uint64_t(as_int());
-}
-
-double atom::as_double() const {
-    if (type_id_integral(type())) {
-        return type_id_signed(type()) ? double(as_int()) : double(as_uint());
-    }
-    switch (atom_.type) {
-      case PN_DOUBLE: return atom_.u.as_double;
-      case PN_FLOAT: return atom_.u.as_float;
-      default: throw type_mismatch(DOUBLE, type(), "cannot convert");
-    }
-}
-
-std::string atom::as_string() const {
-    if (type_id_string_like(type()))
-        return str_;
-    throw type_mismatch(DOUBLE, type(), "cannot convert");
-}
-
-
-namespace {
-template <class T, class F> T type_switch(const atom& a, F f) {
-    switch(a.type()) {
-      case BOOLEAN: return f(a.get<bool>());
-      case UBYTE: return f(a.get<uint8_t>());
-      case BYTE: return f(a.get<int8_t>());
-      case USHORT: return f(a.get<uint16_t>());
-      case SHORT: return f(a.get<int16_t>());
-      case UINT: return f(a.get<uint32_t>());
-      case INT: return f(a.get<int32_t>());
-      case CHAR: return f(a.get<wchar_t>());
-      case ULONG: return f(a.get<uint64_t>());
-      case LONG: return f(a.get<int64_t>());
-      case TIMESTAMP: return f(a.get<amqp_timestamp>());
-      case FLOAT: return f(a.get<float>());
-      case DOUBLE: return f(a.get<double>());
-      case DECIMAL32: return f(a.get<amqp_decimal32>());
-      case DECIMAL64: return f(a.get<amqp_decimal64>());
-      case DECIMAL128: return f(a.get<amqp_decimal128>());
-      case UUID: return f(a.get<amqp_uuid>());
-      case BINARY: return f(a.get<amqp_binary>());
-      case STRING: return f(a.get<amqp_string>());
-      case SYMBOL: return f(a.get<amqp_symbol>());
-      default:
-        throw error("bad atom type");
-    }
-}
-
-struct equal_op {
-    const atom& a;
-    equal_op(const atom& a_) : a(a_) {}
-    template<class T> bool operator()(T x) { return x == a.get<T>(); }
-};
-
-struct less_op {
-    const atom& a;
-    less_op(const atom& a_) : a(a_) {}
-    template<class T> bool operator()(T x) { return x < a.get<T>(); }
-};
-
-struct ostream_op {
-    std::ostream& o;
-    ostream_op(std::ostream& o_) : o(o_) {}
-    template<class T> std::ostream& operator()(T x) { return o << x; }
-};
-
-} // namespace
-
-bool atom::operator==(const atom& x) const {
-    return type_switch<bool>(*this, equal_op(x));
-}
-
-bool atom::operator<(const atom& x) const {
-    return type_switch<bool>(*this, less_op(x));
-}
-
-std::ostream& operator<<(std::ostream& o, const atom& a) {
-    return type_switch<std::ostream&>(a, ostream_op(o));
-}
-
-}

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/d2c5a5f2/proton-c/bindings/cpp/src/atom_test.cpp
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/src/atom_test.cpp b/proton-c/bindings/cpp/src/atom_test.cpp
deleted file mode 100644
index 0d85a36..0000000
--- a/proton-c/bindings/cpp/src/atom_test.cpp
+++ /dev/null
@@ -1,105 +0,0 @@
-/*
- * 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 "test_bits.hpp"
-#include "proton/type_traits.hpp"
-
-#include <proton/atom.hpp>
-
-using namespace std;
-using namespace proton;
-
-// Inserting and extracting simple C++ values.
-template <class T> void type_test(T x, type_id tid, T y) {
-    atom v(x);
-    ASSERT_EQUAL(tid, v.type());
-    ASSERT(!v.empty());
-    ASSERT_EQUAL(x, v.get<T>());
-
-    atom v2;
-    ASSERT(v2.type() == NULL_TYPE);
-    v2 = x;
-    ASSERT_EQUAL(tid, v2.type());
-    ASSERT_EQUAL(x, v2.get<T>());
-    ASSERT_EQUAL(v, v2);
-    ASSERT_EQUAL(str(x), str(v));
-
-    v2 = y;
-    ASSERT(v != v2);
-    ASSERT(v < v2);
-    ASSERT(v2 > v);
-}
-
-#define ASSERT_MISMATCH(EXPR) \
-    try { (void)(EXPR); FAIL("expected type_mismatch: " #EXPR); } catch (type_mismatch) {}
-
-void convert_test() {
-    atom a;
-    ASSERT_EQUAL(NULL_TYPE, a.type());
-    ASSERT(a.empty());
-    ASSERT_MISMATCH(a.get<float>());
-
-    a = amqp_binary("foo");
-    ASSERT_MISMATCH(a.get<int16_t>());
-    ASSERT_MISMATCH(a.as_int());
-    ASSERT_MISMATCH(a.as_double());
-    ASSERT_MISMATCH(a.get<amqp_string>());           // No strict conversion
-    ASSERT_EQUAL(a.as_string(), std::string("foo")); // OK string-like conversion
-
-    a = int16_t(42);
-    ASSERT_MISMATCH(a.get<std::string>());
-    ASSERT_MISMATCH(a.get<amqp_timestamp>());
-    ASSERT_MISMATCH(a.as_string());
-    ASSERT_EQUAL(a.as_int(), 42);
-    ASSERT_EQUAL(a.as_uint(), 42);
-    ASSERT_EQUAL(a.as_double(), 42);
-
-    a = int16_t(-42);
-    ASSERT_EQUAL(a.as_int(), -42);
-    ASSERT_EQUAL(a.as_uint(), uint64_t(-42));
-    ASSERT_EQUAL(a.as_double(), -42);
-}
-
-int main(int, char**) {
-    int failed = 0;
-    RUN_TEST(failed, type_test(false, BOOLEAN, true));
-    RUN_TEST(failed, type_test(amqp_ubyte(42), UBYTE, amqp_ubyte(50)));
-    RUN_TEST(failed, type_test(amqp_byte('x'), BYTE, amqp_byte('y')));
-    RUN_TEST(failed, type_test(amqp_ushort(4242), USHORT, amqp_ushort(5252)));
-    RUN_TEST(failed, type_test(amqp_short(-4242), SHORT, amqp_short(3)));
-    RUN_TEST(failed, type_test(amqp_uint(4242), UINT, amqp_uint(5252)));
-    RUN_TEST(failed, type_test(amqp_int(-4242), INT, amqp_int(3)));
-    RUN_TEST(failed, type_test(amqp_ulong(4242), ULONG, amqp_ulong(5252)));
-    RUN_TEST(failed, type_test(amqp_long(-4242), LONG, amqp_long(3)));
-    RUN_TEST(failed, type_test(wchar_t(23), CHAR, wchar_t(24)));
-    RUN_TEST(failed, type_test(amqp_float(1.234), FLOAT, amqp_float(2.345)));
-    RUN_TEST(failed, type_test(amqp_double(11.2233), DOUBLE, amqp_double(12)));
-    RUN_TEST(failed, type_test(amqp_timestamp(0), TIMESTAMP, amqp_timestamp(1)));
-    RUN_TEST(failed, type_test(amqp_decimal32(0), DECIMAL32, amqp_decimal32(1)));
-    RUN_TEST(failed, type_test(amqp_decimal64(0), DECIMAL64, amqp_decimal64(1)));
-    pn_decimal128_t da = {0}, db = {1};
-    RUN_TEST(failed, type_test(amqp_decimal128(da), DECIMAL128, amqp_decimal128(db)));
-    pn_uuid_t ua = {0}, ub = {1};
-    RUN_TEST(failed, type_test(amqp_uuid(ua), UUID, amqp_uuid(ub)));
-    RUN_TEST(failed, type_test(amqp_string("aaa"), STRING, amqp_string("aaaa")));
-    RUN_TEST(failed, type_test(amqp_symbol("aaa"), SYMBOL, amqp_symbol("aaaa")));
-    RUN_TEST(failed, type_test(amqp_binary("aaa"), BINARY, amqp_binary("aaaa")));
-    RUN_TEST(failed, type_test(std::string("xxx"), STRING, std::string("yyy")));
-    return failed;
-}

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/d2c5a5f2/proton-c/bindings/cpp/src/scalar.cpp
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/src/scalar.cpp b/proton-c/bindings/cpp/src/scalar.cpp
new file mode 100644
index 0000000..13daf32
--- /dev/null
+++ b/proton-c/bindings/cpp/src/scalar.cpp
@@ -0,0 +1,185 @@
+/*
+ * 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/scalar.hpp"
+#include "proton/type_traits.hpp"
+
+#include <ostream>
+
+namespace proton {
+
+scalar::scalar() { atom_.type = PN_NULL; }
+
+type_id scalar::type() const { return type_id(atom_.type); }
+bool scalar::empty() const { return type() == NULL_TYPE; }
+
+scalar::scalar(bool x) { atom_.u.as_bool = x; atom_.type = PN_BOOL; }
+scalar::scalar(uint8_t x) { atom_.u.as_ubyte = x; atom_.type = PN_UBYTE; }
+scalar::scalar(int8_t x) { atom_.u.as_byte = x; atom_.type = PN_BYTE; }
+scalar::scalar(uint16_t x) { atom_.u.as_ushort = x; atom_.type = PN_USHORT; }
+scalar::scalar(int16_t x) { atom_.u.as_short = x; atom_.type = PN_SHORT; }
+scalar::scalar(uint32_t x) { atom_.u.as_uint = x; atom_.type = PN_UINT; }
+scalar::scalar(int32_t x) { atom_.u.as_int = x; atom_.type = PN_INT; }
+scalar::scalar(uint64_t x) { atom_.u.as_ulong = x; atom_.type = PN_ULONG; }
+scalar::scalar(int64_t x) { atom_.u.as_long = x; atom_.type = PN_LONG; }
+scalar::scalar(wchar_t x) { atom_.u.as_char = pn_char_t(x); atom_.type = PN_CHAR; }
+scalar::scalar(float x) { atom_.u.as_float = x; atom_.type = PN_FLOAT; }
+scalar::scalar(double x) { atom_.u.as_double = x; atom_.type = PN_DOUBLE; }
+scalar::scalar(amqp_timestamp x) { atom_.u.as_timestamp = x; atom_.type = PN_TIMESTAMP; }
+scalar::scalar(const amqp_decimal32& x) { atom_.u.as_decimal32 = x; atom_.type = PN_DECIMAL32; }
+scalar::scalar(const amqp_decimal64& x) { atom_.u.as_decimal64 = x; atom_.type = PN_DECIMAL64; }
+scalar::scalar(const amqp_decimal128& x) { atom_.u.as_decimal128 = x; atom_.type = PN_DECIMAL128; }
+scalar::scalar(const amqp_uuid& x) { atom_.u.as_uuid = x; atom_.type = PN_UUID; }
+
+void scalar::set(const std::string& x) { str_ = x; atom_.u.as_bytes = pn_bytes(str_); }
+scalar::scalar(const amqp_string& x) { set(x); atom_.type = PN_STRING; }
+scalar::scalar(const amqp_symbol& x) { set(x); atom_.type = PN_SYMBOL; }
+scalar::scalar(const amqp_binary& x) { set(x); atom_.type = PN_BINARY; }
+scalar::scalar(const std::string& x) { *this = amqp_string(x); }
+scalar::scalar(const char* x) { *this = amqp_string(x); }
+
+void scalar::ok(pn_type_t t) const {
+    if (atom_.type != t) throw type_mismatch(type_id(t), type());
+}
+
+void scalar::get(bool& x) const { ok(PN_BOOL); x = atom_.u.as_bool; }
+void scalar::get(uint8_t& x) const { ok(PN_UBYTE); x = atom_.u.as_ubyte; }
+void scalar::get(int8_t& x) const { ok(PN_BYTE); x = atom_.u.as_byte; }
+void scalar::get(uint16_t& x) const { ok(PN_USHORT); x = atom_.u.as_ushort; }
+void scalar::get(int16_t& x) const { ok(PN_SHORT); x = atom_.u.as_short; }
+void scalar::get(uint32_t& x) const { ok(PN_UINT); x = atom_.u.as_uint; }
+void scalar::get(int32_t& x) const { ok(PN_INT); x = atom_.u.as_int; }
+void scalar::get(wchar_t& x) const { ok(PN_CHAR); x = wchar_t(atom_.u.as_char); }
+void scalar::get(uint64_t& x) const { ok(PN_ULONG); x = atom_.u.as_ulong; }
+void scalar::get(int64_t& x) const { ok(PN_LONG); x = atom_.u.as_long; }
+void scalar::get(amqp_timestamp& x) const { ok(PN_TIMESTAMP); x = atom_.u.as_timestamp; }
+void scalar::get(float& x) const { ok(PN_FLOAT); x = atom_.u.as_float; }
+void scalar::get(double& x) const { ok(PN_DOUBLE); x = atom_.u.as_double; }
+void scalar::get(amqp_decimal32& x) const { ok(PN_DECIMAL32); x = atom_.u.as_decimal32; }
+void scalar::get(amqp_decimal64& x) const { ok(PN_DECIMAL64); x = atom_.u.as_decimal64; }
+void scalar::get(amqp_decimal128& x) const { ok(PN_DECIMAL128); x = atom_.u.as_decimal128; }
+void scalar::get(amqp_uuid& x) const { ok(PN_UUID); x = atom_.u.as_uuid; }
+void scalar::get(amqp_string& x) const { ok(PN_STRING); x = str_; }
+void scalar::get(amqp_symbol& x) const { ok(PN_SYMBOL); x = str_; }
+void scalar::get(amqp_binary& x) const { ok(PN_BINARY); x = str_; }
+void scalar::get(std::string& x) const { x = get<amqp_string>(); }
+
+int64_t scalar::as_int() const {
+    if (type_id_is_floating_point(type()))
+        return int64_t(as_double());
+    switch (atom_.type) {
+      case PN_BOOL: return atom_.u.as_bool;
+      case PN_UBYTE: return atom_.u.as_ubyte;
+      case PN_BYTE: return atom_.u.as_byte;
+      case PN_USHORT: return atom_.u.as_ushort;
+      case PN_SHORT: return atom_.u.as_short;
+      case PN_UINT: return atom_.u.as_uint;
+      case PN_INT: return atom_.u.as_int;
+      case PN_CHAR: return atom_.u.as_char;
+      case PN_ULONG: return int64_t(atom_.u.as_ulong);
+      case PN_LONG: return atom_.u.as_long;
+      default: throw type_mismatch(LONG, type(), "cannot convert");
+    }
+}
+
+uint64_t scalar::as_uint() const {
+    if  (!type_id_is_integral(type()))
+        throw type_mismatch(ULONG, type(), "cannot convert");
+    return uint64_t(as_int());
+}
+
+double scalar::as_double() const {
+    if (type_id_is_integral(type())) {
+        return type_id_is_signed(type()) ? double(as_int()) : double(as_uint());
+    }
+    switch (atom_.type) {
+      case PN_DOUBLE: return atom_.u.as_double;
+      case PN_FLOAT: return atom_.u.as_float;
+      default: throw type_mismatch(DOUBLE, type(), "cannot convert");
+    }
+}
+
+std::string scalar::as_string() const {
+    if (type_id_is_string_like(type()))
+        return str_;
+    throw type_mismatch(DOUBLE, type(), "cannot convert");
+}
+
+
+namespace {
+template <class T, class F> T type_switch(const scalar& a, F f) {
+    switch(a.type()) {
+      case BOOLEAN: return f(a.get<bool>());
+      case UBYTE: return f(a.get<uint8_t>());
+      case BYTE: return f(a.get<int8_t>());
+      case USHORT: return f(a.get<uint16_t>());
+      case SHORT: return f(a.get<int16_t>());
+      case UINT: return f(a.get<uint32_t>());
+      case INT: return f(a.get<int32_t>());
+      case CHAR: return f(a.get<wchar_t>());
+      case ULONG: return f(a.get<uint64_t>());
+      case LONG: return f(a.get<int64_t>());
+      case TIMESTAMP: return f(a.get<amqp_timestamp>());
+      case FLOAT: return f(a.get<float>());
+      case DOUBLE: return f(a.get<double>());
+      case DECIMAL32: return f(a.get<amqp_decimal32>());
+      case DECIMAL64: return f(a.get<amqp_decimal64>());
+      case DECIMAL128: return f(a.get<amqp_decimal128>());
+      case UUID: return f(a.get<amqp_uuid>());
+      case BINARY: return f(a.get<amqp_binary>());
+      case STRING: return f(a.get<amqp_string>());
+      case SYMBOL: return f(a.get<amqp_symbol>());
+      default:
+        throw error("bad scalar type");
+    }
+}
+
+struct equal_op {
+    const scalar& a;
+    equal_op(const scalar& a_) : a(a_) {}
+    template<class T> bool operator()(T x) { return x == a.get<T>(); }
+};
+
+struct less_op {
+    const scalar& a;
+    less_op(const scalar& a_) : a(a_) {}
+    template<class T> bool operator()(T x) { return x < a.get<T>(); }
+};
+
+struct ostream_op {
+    std::ostream& o;
+    ostream_op(std::ostream& o_) : o(o_) {}
+    template<class T> std::ostream& operator()(T x) { return o << x; }
+};
+
+} // namespace
+
+bool scalar::operator==(const scalar& x) const {
+    return type_switch<bool>(*this, equal_op(x));
+}
+
+bool scalar::operator<(const scalar& x) const {
+    return type_switch<bool>(*this, less_op(x));
+}
+
+std::ostream& operator<<(std::ostream& o, const scalar& a) {
+    return type_switch<std::ostream&>(a, ostream_op(o));
+}
+
+}

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/d2c5a5f2/proton-c/bindings/cpp/src/scalar_test.cpp
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/src/scalar_test.cpp b/proton-c/bindings/cpp/src/scalar_test.cpp
new file mode 100644
index 0000000..c7de785
--- /dev/null
+++ b/proton-c/bindings/cpp/src/scalar_test.cpp
@@ -0,0 +1,105 @@
+/*
+ * 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 "test_bits.hpp"
+#include "proton/type_traits.hpp"
+
+#include <proton/scalar.hpp>
+
+using namespace std;
+using namespace proton;
+
+// Inserting and extracting simple C++ values.
+template <class T> void type_test(T x, type_id tid, T y) {
+    scalar v(x);
+    ASSERT_EQUAL(tid, v.type());
+    ASSERT(!v.empty());
+    ASSERT_EQUAL(x, v.get<T>());
+
+    scalar v2;
+    ASSERT(v2.type() == NULL_TYPE);
+    v2 = x;
+    ASSERT_EQUAL(tid, v2.type());
+    ASSERT_EQUAL(x, v2.get<T>());
+    ASSERT_EQUAL(v, v2);
+    ASSERT_EQUAL(str(x), str(v));
+
+    v2 = y;
+    ASSERT(v != v2);
+    ASSERT(v < v2);
+    ASSERT(v2 > v);
+}
+
+#define ASSERT_MISMATCH(EXPR) \
+    try { (void)(EXPR); FAIL("expected type_mismatch: " #EXPR); } catch (type_mismatch) {}
+
+void convert_test() {
+    scalar a;
+    ASSERT_EQUAL(NULL_TYPE, a.type());
+    ASSERT(a.empty());
+    ASSERT_MISMATCH(a.get<float>());
+
+    a = amqp_binary("foo");
+    ASSERT_MISMATCH(a.get<int16_t>());
+    ASSERT_MISMATCH(a.as_int());
+    ASSERT_MISMATCH(a.as_double());
+    ASSERT_MISMATCH(a.get<amqp_string>());           // No strict conversion
+    ASSERT_EQUAL(a.as_string(), std::string("foo")); // OK string-like conversion
+
+    a = int16_t(42);
+    ASSERT_MISMATCH(a.get<std::string>());
+    ASSERT_MISMATCH(a.get<amqp_timestamp>());
+    ASSERT_MISMATCH(a.as_string());
+    ASSERT_EQUAL(a.as_int(), 42);
+    ASSERT_EQUAL(a.as_uint(), 42);
+    ASSERT_EQUAL(a.as_double(), 42);
+
+    a = int16_t(-42);
+    ASSERT_EQUAL(a.as_int(), -42);
+    ASSERT_EQUAL(a.as_uint(), uint64_t(-42));
+    ASSERT_EQUAL(a.as_double(), -42);
+}
+
+int main(int, char**) {
+    int failed = 0;
+    RUN_TEST(failed, type_test(false, BOOLEAN, true));
+    RUN_TEST(failed, type_test(amqp_ubyte(42), UBYTE, amqp_ubyte(50)));
+    RUN_TEST(failed, type_test(amqp_byte('x'), BYTE, amqp_byte('y')));
+    RUN_TEST(failed, type_test(amqp_ushort(4242), USHORT, amqp_ushort(5252)));
+    RUN_TEST(failed, type_test(amqp_short(-4242), SHORT, amqp_short(3)));
+    RUN_TEST(failed, type_test(amqp_uint(4242), UINT, amqp_uint(5252)));
+    RUN_TEST(failed, type_test(amqp_int(-4242), INT, amqp_int(3)));
+    RUN_TEST(failed, type_test(amqp_ulong(4242), ULONG, amqp_ulong(5252)));
+    RUN_TEST(failed, type_test(amqp_long(-4242), LONG, amqp_long(3)));
+    RUN_TEST(failed, type_test(wchar_t(23), CHAR, wchar_t(24)));
+    RUN_TEST(failed, type_test(amqp_float(1.234), FLOAT, amqp_float(2.345)));
+    RUN_TEST(failed, type_test(amqp_double(11.2233), DOUBLE, amqp_double(12)));
+    RUN_TEST(failed, type_test(amqp_timestamp(0), TIMESTAMP, amqp_timestamp(1)));
+    RUN_TEST(failed, type_test(amqp_decimal32(0), DECIMAL32, amqp_decimal32(1)));
+    RUN_TEST(failed, type_test(amqp_decimal64(0), DECIMAL64, amqp_decimal64(1)));
+    pn_decimal128_t da = {0}, db = {1};
+    RUN_TEST(failed, type_test(amqp_decimal128(da), DECIMAL128, amqp_decimal128(db)));
+    pn_uuid_t ua = {0}, ub = {1};
+    RUN_TEST(failed, type_test(amqp_uuid(ua), UUID, amqp_uuid(ub)));
+    RUN_TEST(failed, type_test(amqp_string("aaa"), STRING, amqp_string("aaaa")));
+    RUN_TEST(failed, type_test(amqp_symbol("aaa"), SYMBOL, amqp_symbol("aaaa")));
+    RUN_TEST(failed, type_test(amqp_binary("aaa"), BINARY, amqp_binary("aaaa")));
+    RUN_TEST(failed, type_test(std::string("xxx"), STRING, std::string("yyy")));
+    return failed;
+}

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/d2c5a5f2/proton-c/bindings/cpp/src/types.cpp
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/src/types.cpp b/proton-c/bindings/cpp/src/types.cpp
index d8e40ce..fa7b0bd 100644
--- a/proton-c/bindings/cpp/src/types.cpp
+++ b/proton-c/bindings/cpp/src/types.cpp
@@ -95,15 +95,15 @@ std::string type_name(type_id t) {
     return "unknown";
 }
 
-static bool type_id_signed_int(type_id t) { return t == BYTE || t == SHORT || t == INT || t == LONG; }
-static bool type_id_unsigned_int(type_id t) { return t == UBYTE || t == USHORT || t == UINT || t == ULONG; }
-bool type_id_integral(type_id t) { return t == BOOLEAN || t == CHAR || type_id_unsigned_int(t) || type_id_signed_int(t); }
-bool type_id_floating_point(type_id t) { return t == FLOAT || t == DOUBLE; }
-bool type_id_decimal(type_id t) { return t == DECIMAL32 || t == DECIMAL64 || t == DECIMAL128; }
-bool type_id_signed(type_id t) { return type_id_signed_int(t) || type_id_floating_point(t) || type_id_decimal(t); }
-bool type_id_string_like(type_id t) { return t == BINARY || t == STRING || t == SYMBOL; }
-bool type_id_container(type_id t) { return t == LIST || t == MAP || t == ARRAY || t == DESCRIBED; }
-bool type_id_atom(type_id t) { return type_id_integral(t) || type_id_floating_point(t) || type_id_decimal(t) || type_id_string_like(t) || t == TIMESTAMP || t == UUID; }
+static bool type_id_is_signed_int(type_id t) { return t == BYTE || t == SHORT || t == INT || t == LONG; }
+static bool type_id_is_unsigned_int(type_id t) { return t == UBYTE || t == USHORT || t == UINT || t == ULONG; }
+bool type_id_is_integral(type_id t) { return t == BOOLEAN || t == CHAR || type_id_is_unsigned_int(t) || type_id_is_signed_int(t); }
+bool type_id_is_floating_point(type_id t) { return t == FLOAT || t == DOUBLE; }
+bool type_id_is_decimal(type_id t) { return t == DECIMAL32 || t == DECIMAL64 || t == DECIMAL128; }
+bool type_id_is_signed(type_id t) { return type_id_is_signed_int(t) || type_id_is_floating_point(t) || type_id_is_decimal(t); }
+bool type_id_is_string_like(type_id t) { return t == BINARY || t == STRING || t == SYMBOL; }
+bool type_id_is_container(type_id t) { return t == LIST || t == MAP || t == ARRAY || t == DESCRIBED; }
+bool type_id_is_scalar(type_id t) { return type_id_is_integral(t) || type_id_is_floating_point(t) || type_id_is_decimal(t) || type_id_is_string_like(t) || t == TIMESTAMP || t == UUID; }
 
 
 std::ostream& operator<<(std::ostream& o,type_id t) { return o << type_name(t); }


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@qpid.apache.org
For additional commands, e-mail: commits-help@qpid.apache.org