qpid-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From tr...@apache.org
Subject svn commit: r1057709 - in /qpid/trunk/qpid/cpp: bindings/qmf2/python/qmf2.py bindings/qmf2/ruby/qmf2.rb bindings/swig_python_typemaps.i bindings/swig_ruby_typemaps.i include/qmf/DataAddr.h src/qmf/DataAddr.cpp src/qmf/DataAddrImpl.h
Date Tue, 11 Jan 2011 16:02:23 GMT
Author: tross
Date: Tue Jan 11 16:02:23 2011
New Revision: 1057709

URL: http://svn.apache.org/viewvc?rev=1057709&view=rev
Log:
QMFv2 API change:
  1) Added public constructor for DataAddr(Variant::Map)
  2) Fixed Python and Ruby typemaps to support Variant::Map& and Variant::List& with
const
  3) Added support for building Queries based on object-id maps in both Python and Ruby wrappers

Modified:
    qpid/trunk/qpid/cpp/bindings/qmf2/python/qmf2.py
    qpid/trunk/qpid/cpp/bindings/qmf2/ruby/qmf2.rb
    qpid/trunk/qpid/cpp/bindings/swig_python_typemaps.i
    qpid/trunk/qpid/cpp/bindings/swig_ruby_typemaps.i
    qpid/trunk/qpid/cpp/include/qmf/DataAddr.h
    qpid/trunk/qpid/cpp/src/qmf/DataAddr.cpp
    qpid/trunk/qpid/cpp/src/qmf/DataAddrImpl.h

Modified: qpid/trunk/qpid/cpp/bindings/qmf2/python/qmf2.py
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/cpp/bindings/qmf2/python/qmf2.py?rev=1057709&r1=1057708&r2=1057709&view=diff
==============================================================================
--- qpid/trunk/qpid/cpp/bindings/qmf2/python/qmf2.py (original)
+++ qpid/trunk/qpid/cpp/bindings/qmf2/python/qmf2.py Tue Jan 11 16:02:23 2011
@@ -311,7 +311,7 @@ class Agent(object):
     """
     """
     if q.__class__ == Query:
-      q_arg = Query._impl
+      q_arg = q._impl
     else:
       q_arg = q
     dur = cqpid.Duration(cqpid.Duration.SECOND.getMilliseconds() * timeout)
@@ -366,10 +366,11 @@ class Query(object):
   """
   """
 
-  def __init__(self, *kwargs):
+  def __init__(self, arg1, arg2=None, arg3=None, *kwargs):
     """
     """
-    pass
+    if arg1.__class__ == DataAddr:
+      self._impl = cqmf2.Query(arg1._impl)
 
 #===================================================================================================
 # DATA
@@ -518,8 +519,11 @@ class DataAddr(object):
   """
   """
 
-  def __init__(self, impl):
-    self._impl = impl
+  def __init__(self, arg):
+    if arg.__class__ == dict:
+      self._impl = cqmf2.DataAddr(arg)
+    else:
+      self._impl = arg
 
   def __repr__(self):
     return "%s:%s" % (self.getAgentName(), self.getName())

Modified: qpid/trunk/qpid/cpp/bindings/qmf2/ruby/qmf2.rb
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/cpp/bindings/qmf2/ruby/qmf2.rb?rev=1057709&r1=1057708&r2=1057709&view=diff
==============================================================================
--- qpid/trunk/qpid/cpp/bindings/qmf2/ruby/qmf2.rb (original)
+++ qpid/trunk/qpid/cpp/bindings/qmf2/ruby/qmf2.rb Tue Jan 11 16:02:23 2011
@@ -233,8 +233,10 @@ module Qmf2
 
   class Query
     attr_reader :impl
-    def initialize
-      @impl = nil
+    def initialize(arg1, arg2=nil, arg3=nil)
+      if arg1.class == Qmf2::DataAddr
+        @impl = Cqmf2::Query.new(arg1.impl)
+      end
     end
   end
 
@@ -390,8 +392,12 @@ module Qmf2
   class DataAddr
     attr_reader :impl
 
-    def initialize(impl)
-      @impl = impl
+    def initialize(arg)
+      if arg.class == Hash
+        @impl = Cqmf2::DataAddr.new(arg)
+      else
+        @impl = arg
+      end
     end
 
     def ==(other)

Modified: qpid/trunk/qpid/cpp/bindings/swig_python_typemaps.i
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/cpp/bindings/swig_python_typemaps.i?rev=1057709&r1=1057708&r2=1057709&view=diff
==============================================================================
--- qpid/trunk/qpid/cpp/bindings/swig_python_typemaps.i (original)
+++ qpid/trunk/qpid/cpp/bindings/swig_python_typemaps.i Tue Jan 11 16:02:23 2011
@@ -271,10 +271,6 @@ typedef int Py_ssize_t;
     Py_INCREF($result);
 }
 
-%typemap(typecheck) qpid::types::Variant::Map& {
-    $1 = PyDict_Check($input) ? 1 : 0;
-}
-
 /*
  * Variant types: C++ --> Python
  */
@@ -314,6 +310,16 @@ typedef int Py_ssize_t;
     PyToList($input, $1);
 }
 
+%typemap(in) const qpid::types::Variant::Map const & {
+    $1 = new qpid::types::Variant::Map();
+    PyToMap($input, $1);
+}
+
+%typemap(in) const qpid::types::Variant::List const & {
+    $1 = new qpid::types::Variant::List();
+    PyToList($input, $1);
+}
+
 %typemap(freearg) qpid::types::Variant& {
     delete $1;
 }
@@ -334,7 +340,15 @@ typedef int Py_ssize_t;
     $1 = PyDict_Check($input) ? 1 : 0;
 }
 
-%typemap(typecheck) qpid::types::Variant::List& {
+%typemap(typecheck)  qpid::types::Variant::List& {
+    $1 = PyList_Check($input) ? 1 : 0;
+}
+
+%typemap(typecheck) const qpid::types::Variant::Map const & {
+    $1 = PyDict_Check($input) ? 1 : 0;
+}
+
+%typemap(typecheck) const qpid::types::Variant::List const & {
     $1 = PyList_Check($input) ? 1 : 0;
 }
 

Modified: qpid/trunk/qpid/cpp/bindings/swig_ruby_typemaps.i
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/cpp/bindings/swig_ruby_typemaps.i?rev=1057709&r1=1057708&r2=1057709&view=diff
==============================================================================
--- qpid/trunk/qpid/cpp/bindings/swig_ruby_typemaps.i (original)
+++ qpid/trunk/qpid/cpp/bindings/swig_ruby_typemaps.i Tue Jan 11 16:02:23 2011
@@ -267,6 +267,16 @@
     RbToList($input, $1);
 }
 
+%typemap(in) const qpid::types::Variant::Map const & {
+    $1 = new qpid::types::Variant::Map();
+    RbToMap($input, $1);
+}
+
+%typemap(in) const qpid::types::Variant::List const & {
+    $1 = new qpid::types::Variant::List();
+    RbToList($input, $1);
+}
+
 %typemap(freearg) qpid::types::Variant& {
     delete $1;
 }
@@ -291,6 +301,14 @@
     $1 = (TYPE($input) == T_ARRAY) ? 1 : 0;
 }
 
+%typemap(typecheck) qpid::types::Variant::Map const & {
+    $1 = (TYPE($input) == T_HASH) ? 1 : 0;
+}
+
+%typemap(typecheck) qpid::types::Variant::List const & {
+    $1 = (TYPE($input) == T_ARRAY) ? 1 : 0;
+}
+
 %typemap(typecheck) qpid::types::Variant& {
     $1 = (TYPE($input) == T_FLOAT  ||
           TYPE($input) == T_STRING ||

Modified: qpid/trunk/qpid/cpp/include/qmf/DataAddr.h
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/cpp/include/qmf/DataAddr.h?rev=1057709&r1=1057708&r2=1057709&view=diff
==============================================================================
--- qpid/trunk/qpid/cpp/include/qmf/DataAddr.h (original)
+++ qpid/trunk/qpid/cpp/include/qmf/DataAddr.h Tue Jan 11 16:02:23 2011
@@ -44,6 +44,7 @@ namespace qmf {
         QMF_EXTERN bool operator==(const DataAddr&);
         QMF_EXTERN bool operator<(const DataAddr&);
 
+        QMF_EXTERN DataAddr(const qpid::types::Variant::Map&);
         QMF_EXTERN DataAddr(const std::string& name, const std::string& agentName,
uint32_t agentEpoch=0);
         QMF_EXTERN const std::string& getName() const;
         QMF_EXTERN const std::string& getAgentName() const;

Modified: qpid/trunk/qpid/cpp/src/qmf/DataAddr.cpp
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/cpp/src/qmf/DataAddr.cpp?rev=1057709&r1=1057708&r2=1057709&view=diff
==============================================================================
--- qpid/trunk/qpid/cpp/src/qmf/DataAddr.cpp (original)
+++ qpid/trunk/qpid/cpp/src/qmf/DataAddr.cpp Tue Jan 11 16:02:23 2011
@@ -38,6 +38,7 @@ DataAddr& DataAddr::operator=(const Data
 bool DataAddr::operator==(const DataAddr& o) { return *impl == *o.impl; }
 bool DataAddr::operator<(const DataAddr& o) { return *impl < *o.impl; }
 
+DataAddr::DataAddr(const qpid::types::Variant::Map& m) { PI::ctor(*this, new DataAddrImpl(m));
}
 DataAddr::DataAddr(const string& n, const string& a, uint32_t e) { PI::ctor(*this,
new DataAddrImpl(n, a, e)); }
 const string& DataAddr::getName() const { return impl->getName(); }
 const string& DataAddr::getAgentName() const { return impl->getAgentName(); }

Modified: qpid/trunk/qpid/cpp/src/qmf/DataAddrImpl.h
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/cpp/src/qmf/DataAddrImpl.h?rev=1057709&r1=1057708&r2=1057709&view=diff
==============================================================================
--- qpid/trunk/qpid/cpp/src/qmf/DataAddrImpl.h (original)
+++ qpid/trunk/qpid/cpp/src/qmf/DataAddrImpl.h Tue Jan 11 16:02:23 2011
@@ -32,7 +32,6 @@ namespace qmf {
         //
         // Impl-only methods
         //
-        DataAddrImpl(const qpid::types::Variant::Map&);
         void setName(const std::string& n) { name = n; }
         void setAgent(const std::string& n, uint32_t e=0) { agentName = n; agentEpoch
= e; }
 
@@ -41,6 +40,7 @@ namespace qmf {
         //
         bool operator==(const DataAddrImpl&);
         bool operator<(const DataAddrImpl&);
+        DataAddrImpl(const qpid::types::Variant::Map&);
         DataAddrImpl(const std::string& _name, const std::string& _agentName, uint32_t
_agentEpoch=0) :
             agentName(_agentName), name(_name), agentEpoch(_agentEpoch) {}
         const std::string& getName() const { return name; }



---------------------------------------------------------------------
Apache Qpid - AMQP Messaging Implementation
Project:      http://qpid.apache.org
Use/Interact: mailto:commits-subscribe@qpid.apache.org


Mime
View raw message