[pytango] 266/483: applied patch for bug #611 on trunk

Sandor Bodo-Merle sbodomerle-guest at moszumanska.debian.org
Thu Sep 28 19:14:48 UTC 2017


This is an automated email from the git hooks/post-receive script.

sbodomerle-guest pushed a commit to annotated tag bliss_8.10
in repository pytango.

commit c9e5198af1ed6f77568d58e624ffad8ea4c1e76b
Author: tiagocoutinho <tiagocoutinho at 4e9c00fd-8f2e-0410-aa12-93ce3db5e235>
Date:   Tue Jul 9 11:56:22 2013 +0000

    applied patch for bug #611 on trunk
    
    git-svn-id: http://svn.code.sf.net/p/tango-cs/code/bindings/PyTango/trunk@23089 4e9c00fd-8f2e-0410-aa12-93ce3db5e235
---
 doc/revision.rst                           |  7 ++-
 src/boost/cpp/defs.h                       |  1 +
 src/boost/cpp/device_data.cpp              |  1 +
 src/boost/cpp/server/encoded_attribute.cpp |  3 ++
 src/boost/cpp/server/wattribute.cpp        | 82 ++++++++++++++++++++++++++++++
 5 files changed, 93 insertions(+), 1 deletion(-)

diff --git a/doc/revision.rst b/doc/revision.rst
index 967dd64..0c2f5a1 100644
--- a/doc/revision.rst
+++ b/doc/revision.rst
@@ -71,7 +71,9 @@ History of modifications:
 +----------+----------------------------------------------------------------------------------+-----------------------------------------------------+-----------------------+
 | 20/05/13 | `8.16 <http://www.tango-controls.org/static/PyTango/v803/doc/html/index.html>`_  | Update to PyTango 8.0.3                             | T\. Coutinho          |
 +----------+----------------------------------------------------------------------------------+-----------------------------------------------------+-----------------------+
-|   /07/13 | `8.17 <http://www.tango-controls.org/static/PyTango/v810/doc/html/index.html>`_  | Update to PyTango 8.1.0                             | T\. Coutinho          |
+| 09/07/13 | `8.17 <http://www.tango-controls.org/static/PyTango/v804/doc/html/index.html>`_  | Update to PyTango 8.0.4                             | T\. Coutinho          |
++----------+----------------------------------------------------------------------------------+-----------------------------------------------------+-----------------------+
+|   /07/13 | `8.18 <http://www.tango-controls.org/static/PyTango/v810/doc/html/index.html>`_  | Update to PyTango 8.1.0                             | T\. Coutinho          |
 +----------+----------------------------------------------------------------------------------+-----------------------------------------------------+-----------------------+
 
 .. _version-history:
@@ -85,6 +87,9 @@ Version history
 | 8.1.0      | Features:                                                                                                                                                                    |
 |            |     - Implemented tango C++ 8.1 API                                                                                                                                          |
 +------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
+| 8.0.4      | Bug fixes:                                                                                                                                                                   |
+|            |         - `598: [pytango][8.0.3] failed to build from source on s390 <https://sourceforge.net/p/tango-cs/bugs/598/>`_                                                        |
++------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
 | 8.0.3      | Features:                                                                                                                                                                    |
 |            |     - from sourceforge:                                                                                                                                                      |
 |            |         - `88: Implement Util::server_set_event_loop method in python <https://sourceforge.net/p/tango-cs/feature-requests/88>`_                                             |
diff --git a/src/boost/cpp/defs.h b/src/boost/cpp/defs.h
index 4f20c7c..8e1e5e2 100644
--- a/src/boost/cpp/defs.h
+++ b/src/boost/cpp/defs.h
@@ -56,6 +56,7 @@ namespace PyTango
         ExtractAsTuple,
         ExtractAsList,
         ExtractAsString,
+        ExtractAsPyTango3,
         ExtractAsNothing
     };
     
diff --git a/src/boost/cpp/device_data.cpp b/src/boost/cpp/device_data.cpp
index 4d0a0bb..63f18ac 100644
--- a/src/boost/cpp/device_data.cpp
+++ b/src/boost/cpp/device_data.cpp
@@ -146,6 +146,7 @@ namespace PyDeviceData {
                     return to_py_numpy<tangoArrayTypeConst>(tmp_ptr, py_self);
 #                 endif
                 case PyTango::ExtractAsList:
+                case PyTango::ExtractAsPyTango3:
                     return to_py_list(tmp_ptr);
                 case PyTango::ExtractAsTuple:
                     return to_py_tuple(tmp_ptr);
diff --git a/src/boost/cpp/server/encoded_attribute.cpp b/src/boost/cpp/server/encoded_attribute.cpp
index bafa5d0..ade7d9c 100644
--- a/src/boost/cpp/server/encoded_attribute.cpp
+++ b/src/boost/cpp/server/encoded_attribute.cpp
@@ -844,6 +844,7 @@ namespace PyEncodedAttribute
                 delete [] buffer;
                 break;
             }
+            case PyTango::ExtractAsPyTango3:
             case PyTango::ExtractAsList:
             {
                 ret = PyList_New(height);
@@ -981,6 +982,7 @@ namespace PyEncodedAttribute
                 delete [] buffer;
                 break;
             }
+            case PyTango::ExtractAsPyTango3:
             case PyTango::ExtractAsList:
             {
                 ret = PyList_New(height);
@@ -1138,6 +1140,7 @@ namespace PyEncodedAttribute
                 delete [] buffer;
                 break;
             }
+            case PyTango::ExtractAsPyTango3:
             case PyTango::ExtractAsList:
             {
                 ret = PyList_New(height);
diff --git a/src/boost/cpp/server/wattribute.cpp b/src/boost/cpp/server/wattribute.cpp
index e12f4be..30edaa2 100644
--- a/src/boost/cpp/server/wattribute.cpp
+++ b/src/boost/cpp/server/wattribute.cpp
@@ -436,6 +436,50 @@ namespace PyWAttribute
 /// @name get_write_value
 /// @{ 
 
+    //
+    // PyTango 3 compatibility
+    //
+
+    template<long tangoTypeConst>
+    void __get_write_value_pytango3(Tango::WAttribute &att, boost::python::list &seq)
+    {
+        typedef typename TANGO_const2type(tangoTypeConst) TangoScalarType;
+
+        const TangoScalarType *ptr;
+
+        long length = att.get_write_value_length();
+
+        att.get_write_value(ptr);
+
+        for (long l = 0; l < length; ++l)
+        {
+            seq.append(ptr[l]);
+        }
+    }
+
+    template<>
+    void __get_write_value_pytango3<Tango::DEV_STRING>(Tango::WAttribute &att,
+                                              boost::python::list &seq)
+    {
+        const Tango::ConstDevString *ptr;
+
+        long length = att.get_write_value_length();
+
+        att.get_write_value(ptr);
+
+        for (long l = 0; l < length; ++l)
+        {
+            seq.append(ptr[l]);
+        }
+    }
+
+    inline void get_write_value_pytango3(Tango::WAttribute &att,
+                                boost::python::list &value)
+    {
+        long type = att.get_data_type();
+        TANGO_CALL_ON_ATTRIBUTE_DATA_TYPE_ID(type, __get_write_value_pytango3, att, value);
+    }
+
     template<long tangoTypeConst>
     void __get_write_value_scalar(Tango::WAttribute &att, boost::python::object* obj)
     {
@@ -455,6 +499,32 @@ namespace PyWAttribute
     }
 
     template<long tangoTypeConst>
+    void __get_write_value_array_pytango3(Tango::WAttribute &att, boost::python::object* obj)
+    {
+        typedef typename TANGO_const2type(tangoTypeConst) TangoScalarType;
+
+        const TangoScalarType * buffer;
+        att.get_write_value(buffer);
+        size_t length = att.get_write_value_length();
+        
+        boost::python::list o;
+        for (size_t n = 0; n < length; ++n)
+            o.append(buffer[n]);
+        *obj = o;
+    }
+
+    template<>
+    void __get_write_value_array_pytango3<Tango::DEV_STRING>(Tango::WAttribute &att, boost::python::object* obj)
+    {
+        const Tango::ConstDevString *ptr;
+        long length = att.get_write_value_length();
+        att.get_write_value(ptr);
+        boost::python::list o;
+        for (long l = 0; l < length; ++l)
+            o.append(ptr[l]);
+    }
+
+    template<long tangoTypeConst>
     void __get_write_value_array_lists(Tango::WAttribute &att, boost::python::object* obj)
     {
         typedef typename TANGO_const2type(tangoTypeConst) TangoScalarType;
@@ -534,6 +604,11 @@ namespace PyWAttribute
             TANGO_CALL_ON_ATTRIBUTE_DATA_TYPE_ID(type, __get_write_value_scalar, att, &value);
         } else {
             switch (extract_as) {
+                case PyTango::ExtractAsPyTango3: {
+                    TANGO_CALL_ON_ATTRIBUTE_DATA_TYPE_ID(type,
+                        __get_write_value_array_pytango3, att, &value);
+                    break;
+                }
                 case PyTango::ExtractAsNumpy: {
 #               ifndef DISABLE_PYTANGO_NUMPY
                     TANGO_CALL_ON_ATTRIBUTE_DATA_TYPE_ID(type,
@@ -587,6 +662,13 @@ void export_wattribute()
         .def("set_write_value",
             (void (*) (Tango::WAttribute &, boost::python::object &, long, long))
             &PyWAttribute::set_write_value)
+
+        // old style get_write_value
+        .def("get_write_value",
+            &PyWAttribute::get_write_value_pytango3,
+            ( arg_("self"), arg_("empty_list")))
+
+        // new style get_write_value
         .def("get_write_value",
             &PyWAttribute::get_write_value,
             ( arg_("self"), arg_("extract_as")=PyTango::ExtractAsNumpy ))

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/debian-science/packages/pytango.git



More information about the debian-science-commits mailing list