[pytango] 21/37: First implementation of Tango pipe on client side (has memory leak!)

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


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

sbodomerle-guest pushed a commit to annotated tag v9.2.0b
in repository pytango.

commit 6ea6704d3be2da44b6e7b6ba933f1b5467fa7826
Author: Jose Tiago Coutinho Macara <tiago.coutinho at esrf.fr>
Date:   Thu Dec 10 08:48:49 2015 +0100

    First implementation of Tango pipe on client side (has memory leak!)
---
 Makefile                                 |   1 +
 src/boost/cpp/base_types.cpp             |   2 +
 src/boost/cpp/device_attribute.cpp       |  38 ++++++
 src/boost/cpp/device_attribute_numpy.hpp |   6 +
 src/boost/cpp/device_data.cpp            |  23 ++++
 src/boost/cpp/device_pipe.cpp            | 220 +++++++++++++++++++++++++++++++
 src/boost/cpp/device_pipe.h              |  51 +++++++
 src/boost/cpp/device_proxy.cpp           |  23 +++-
 src/boost/cpp/server/command.cpp         |  25 ++++
 src/boost/cpp/tgutils.h                  |  12 +-
 src/boost/cpp/to_py_numpy.hpp            |   6 +
 src/boost/python/device_proxy.py         |  10 ++
 src/boost/python/pytango_pprint.py       |   8 +-
 13 files changed, 417 insertions(+), 8 deletions(-)

diff --git a/Makefile b/Makefile
index c465d95..f2711f1 100644
--- a/Makefile
+++ b/Makefile
@@ -154,6 +154,7 @@ $(OBJS_DIR)/attribute_dimension.o \
 $(OBJS_DIR)/attribute_event_info.o \
 $(OBJS_DIR)/attribute_info.o \
 $(OBJS_DIR)/attribute_info_ex.o \
+$(OBJS_DIR)/device_pipe.o \
 $(OBJS_DIR)/pipe_info.o \
 $(OBJS_DIR)/attribute_proxy.o \
 $(OBJS_DIR)/base_types.o \
diff --git a/src/boost/cpp/base_types.cpp b/src/boost/cpp/base_types.cpp
index 90c9f2c..0016b1a 100644
--- a/src/boost/cpp/base_types.cpp
+++ b/src/boost/cpp/base_types.cpp
@@ -39,6 +39,7 @@ void export_device_data();
 void export_device_attribute();
 void export_device_data_history();
 void export_device_attribute_history();
+void export_device_pipe();
 void export_pipe_info();
 
 void export_dev_error();
@@ -421,6 +422,7 @@ void export_base_types()
     export_device_attribute();
     export_device_data_history();
     export_device_attribute_history();
+    export_device_pipe();
     export_pipe_info();
 
     export_dev_error();
diff --git a/src/boost/cpp/device_attribute.cpp b/src/boost/cpp/device_attribute.cpp
index 01d6390..c6aff59 100644
--- a/src/boost/cpp/device_attribute.cpp
+++ b/src/boost/cpp/device_attribute.cpp
@@ -195,6 +195,14 @@ namespace PyDeviceAttribute
         }
     }
 
+    template<> inline void
+    _update_value_as_bin<Tango::DEV_PIPE_BLOB>(Tango::DeviceAttribute &self,
+					       bopy::object py_value,
+					       bool read_only)
+    {
+	assert(false);
+    }
+
     template<long tangoTypeConst> static inline void
     _update_value_as_string(Tango::DeviceAttribute &self,
                             bopy::object py_value)
@@ -271,6 +279,13 @@ namespace PyDeviceAttribute
         }
     }
 
+    template<> inline void
+    _update_value_as_string<Tango::DEV_PIPE_BLOB>(Tango::DeviceAttribute &self,
+						  bopy::object py_value)
+    {
+	assert(false);
+    }
+
     template<long tangoTypeConst> static inline void
     _update_scalar_values(Tango::DeviceAttribute &self, bopy::object py_value)
     {
@@ -325,6 +340,13 @@ namespace PyDeviceAttribute
         }
     }
 
+    template<> inline void 
+    _update_scalar_values<Tango::DEV_PIPE_BLOB>(Tango::DeviceAttribute &self,
+						bopy::object py_value)
+    {
+	assert(false);
+    }
+
     template<long tangoTypeConst> static inline void
     _update_array_values_as_lists(Tango::DeviceAttribute &self, bool isImage,
                                   bopy::object py_value)
@@ -388,6 +410,14 @@ namespace PyDeviceAttribute
         }
     }
 
+    template<> inline void
+    _update_array_values_as_lists<Tango::DEV_PIPE_BLOB>(Tango::DeviceAttribute &self,
+							bool isImage,
+							bopy::object py_value)
+    {
+	assert(false);
+    }
+
     template<long tangoTypeConst> static void
     _update_array_values_as_tuples(Tango::DeviceAttribute &self, bool isImage,
                                    bopy::object py_value)
@@ -472,6 +502,14 @@ namespace PyDeviceAttribute
         }
     }
 
+    template<> inline void
+    _update_array_values_as_tuples<Tango::DEV_PIPE_BLOB>(Tango::DeviceAttribute &self,
+                                                         bool isImage,
+                                                         bopy::object py_value)
+    {
+	assert(false);
+    }
+
     void
     update_values(Tango::DeviceAttribute &self, bopy::object& py_value,
                   PyTango::ExtractAs extract_as/*=ExtractAsNumpy*/)
diff --git a/src/boost/cpp/device_attribute_numpy.hpp b/src/boost/cpp/device_attribute_numpy.hpp
index 6ccd9e3..2c09517 100644
--- a/src/boost/cpp/device_attribute_numpy.hpp
+++ b/src/boost/cpp/device_attribute_numpy.hpp
@@ -40,6 +40,12 @@ namespace PyDeviceAttribute {
             delete static_cast<TANGO_const2arraytype(tangoTypeConst)*>(ptr_);
         );
     }
+    template<> inline void 
+    _dev_var_x_array_deleter<Tango::DEV_PIPE_BLOB>(PyObject* obj)
+    {
+	// Unsupported
+        assert(false);
+    }
 #endif
 
     template<long tangoTypeConst>
diff --git a/src/boost/cpp/device_data.cpp b/src/boost/cpp/device_data.cpp
index cad32f1..0282df3 100644
--- a/src/boost/cpp/device_data.cpp
+++ b/src/boost/cpp/device_data.cpp
@@ -71,11 +71,19 @@ namespace PyDeviceData {
             val.encoded_data = arr;
             self << val;
         }
+
         template <>
         void insert_scalar<Tango::DEV_VOID>(Tango::DeviceData &self, object py_value)
         {
             raise_(PyExc_TypeError, "Trying to insert a value in a DEV_VOID DeviceData!");
         }
+
+        template <>
+        void insert_scalar<Tango::DEV_PIPE_BLOB>(Tango::DeviceData &self, object py_value)
+        {
+            assert(false);
+        }
+
     /// @}
     // ~Scalar Insertion
     // -----------------------------------------------------------------------
@@ -127,6 +135,14 @@ namespace PyDeviceData {
             self >> val;
             return boost::python::object(val);
         }
+
+        template <>
+        object extract_scalar<Tango::DEV_PIPE_BLOB>(Tango::DeviceData &self)
+        {
+            assert(false);
+	    return bopy::object();
+        }
+
     /// @}
     // ~Scalar Extraction
     // -----------------------------------------------------------------------
@@ -162,6 +178,13 @@ namespace PyDeviceData {
                     return object();
             }
         }
+
+        template <>
+        object extract_array<Tango::DEVVAR_STATEARRAY>(Tango::DeviceData &self, object &py_self, PyTango::ExtractAs extract_as)
+        {
+            assert(False);
+            return object();
+        }
     /// @}
     // ~Array Extraction
     // -----------------------------------------------------------------------
diff --git a/src/boost/cpp/device_pipe.cpp b/src/boost/cpp/device_pipe.cpp
new file mode 100644
index 0000000..b6ba64d
--- /dev/null
+++ b/src/boost/cpp/device_pipe.cpp
@@ -0,0 +1,220 @@
+/******************************************************************************
+  This file is part of PyTango (http://www.tinyurl.com/PyTango)
+
+  Copyright 2006-2012 CELLS / ALBA Synchrotron, Bellaterra, Spain
+  Copyright 2013-2014 European Synchrotron Radiation Facility, Grenoble, France
+
+  Distributed under the terms of the GNU Lesser General Public License,
+  either version 3 of the License, or (at your option) any later version.
+  See LICENSE.txt for more info.
+******************************************************************************/
+
+#include "precompiled_header.hpp"
+#include "device_pipe.h"
+#include "tgutils.h"
+#include "pytgutils.h"
+#include "tango_numpy.h"
+#include "fast_from_py.h"
+
+#ifndef DISABLE_PYTANGO_NUMPY
+#   include "to_py_numpy.hpp"
+#endif
+
+namespace PyTango 
+{ 
+    namespace DevicePipe 
+    {
+        template<long tangoTypeConst>
+        bopy::object
+        __update_scalar_values(Tango::DevicePipe& self, size_t elt_idx)
+        {
+            typedef typename TANGO_const2type(tangoTypeConst) TangoScalarType;
+            TangoScalarType val;
+            bopy::str name(self.get_data_elt_name(elt_idx));
+            self >> val;
+            bopy::object data(val);
+            return bopy::make_tuple(name, data);
+        }
+
+        template<>
+        bopy::object
+        __update_scalar_values<Tango::DEV_VOID>(Tango::DevicePipe& self,
+                                          size_t elt_idx)
+        {
+            bopy::str name(self.get_data_elt_name(elt_idx));
+            return bopy::make_tuple(name, bopy::object());
+        }
+
+        template<>
+        bopy::object
+        __update_scalar_values<Tango::DEV_STRING>(Tango::DevicePipe& self,
+                                            size_t elt_idx)
+        {
+            typedef std::string TangoScalarType;
+            TangoScalarType val;
+            bopy::str name(self.get_data_elt_name(elt_idx));
+            self >> val;
+            bopy::object data(val);
+            return bopy::make_tuple(name, data);
+        }        
+
+        template<>
+        bopy::object
+        __update_scalar_values<Tango::DEV_PIPE_BLOB>(Tango::DevicePipe& self,
+                                               size_t elt_idx)
+        {
+            typedef std::string TangoScalarType;
+            TangoScalarType val;
+            bopy::str name(self.get_data_elt_name(elt_idx));
+            self >> val;
+            bopy::object data(val);
+            return bopy::make_tuple(name, data);
+        }        
+
+        template <long tangoArrayTypeConst>
+        bopy::object
+        __update_array_values(Tango::DevicePipe &self, bopy::object &py_self,
+                        size_t elt_idx, PyTango::ExtractAs extract_as)
+        {
+            typedef typename TANGO_const2type(tangoArrayTypeConst) TangoArrayType;
+
+            TangoArrayType tmp_arr;
+            self >> (&tmp_arr);
+            bopy::list result;
+            bopy::object data;
+            switch (extract_as)
+            {
+                default:
+                case PyTango::ExtractAsNumpy:
+#                 ifndef DISABLE_PYTANGO_NUMPY
+                    data = to_py_numpy<tangoArrayTypeConst>(&tmp_arr, py_self);
+                    tmp_arr.get_buffer(1);
+                    break;
+#                 endif
+                case PyTango::ExtractAsList:
+                case PyTango::ExtractAsPyTango3:
+                    data = to_py_list(&tmp_arr);
+                    break;
+                case PyTango::ExtractAsTuple:
+                    data = to_py_tuple(&tmp_arr);
+                    break;
+                case PyTango::ExtractAsString: /// @todo
+                case PyTango::ExtractAsNothing:
+                    data = bopy::object();
+                    break;
+            }
+
+//            bopy::str name(self.get_data_elt_name(elt_idx));
+//            result.append(name);
+//            result.append(data);
+//            return result;
+            return data;
+        }
+
+        template <>
+        bopy::object
+        __update_array_values<Tango::DEVVAR_LONGSTRINGARRAY>(Tango::DevicePipe &self,
+                                                       bopy::object &py_self,
+                                                       size_t elt_idx, 
+                                                       PyTango::ExtractAs extract_as)
+        {
+            assert(false);
+            return bopy::object();
+        }
+
+        template <>
+        bopy::object
+        __update_array_values<Tango::DEVVAR_DOUBLESTRINGARRAY>(Tango::DevicePipe &self,
+                                                         bopy::object &py_self,
+                                                         size_t elt_idx, 
+                                                         PyTango::ExtractAs extract_as)
+        {
+            assert(false);
+            return bopy::object();
+        }
+
+        bopy::object
+        update_value(Tango::DevicePipe &self, bopy::object& py_self,
+                  size_t elt_idx, PyTango::ExtractAs extract_as)
+        {
+            const int elt_type = self.get_data_elt_type(elt_idx);
+
+            TANGO_DO_ON_DEVICE_DATA_TYPE_ID(elt_type,
+                return __update_scalar_values<tangoTypeConst>(self, elt_idx);
+            ,
+                return __update_array_values<tangoTypeConst>(self, py_self, elt_idx, extract_as);
+            );
+            return bopy::object();
+        }
+
+        /*
+        bopy::object
+        extract(bopy::object py_dev_pipe, 
+                PyTango::ExtractAs extract_as=PyTango::ExtractAsNumpy)
+        {
+            Tango::DevicePipe &self = \
+                bopy::extract<Tango::DevicePipe &>(py_dev_pipe);
+
+            py_value.attr("name") = self.get_name();
+            bopy::list data;
+            py_value.attr("data") = data;
+
+            size_t elt_nb = self.get_data_elt_nb();
+            for(size_t elt_idx = 0; elt_idx < elt_nb; ++elt_idx)
+            {
+                data.append(__extract(self, elt_idx, extract_as));
+            }            
+        }
+        */
+
+        void
+        update_values(Tango::DevicePipe& self, bopy::object& py_self,
+                      PyTango::ExtractAs extract_as /*=PyTango::ExtractAsNumpy*/)
+        {
+            // We do not want is_empty to launch an exception!!
+            //self.reset_exceptions(Tango::DevicePipe::isempty_flag);
+
+            //py_self.attr("name") = self.get_name();
+            bopy::list data;
+            py_self.attr("data") = data;
+
+            size_t elt_nb = self.get_data_elt_nb();
+            for(size_t elt_idx = 0; elt_idx < elt_nb; ++elt_idx)
+            {
+                data.append(update_value(self, py_self, elt_idx, extract_as));
+            }
+        }
+    } 
+}
+
+void export_device_pipe()
+{
+    bopy::class_<Tango::DevicePipe> DevicePipe("DevicePipe");
+
+    bopy::scope dp_scope = DevicePipe;
+
+    DevicePipe
+        .def(bopy::init<>())
+        .def(bopy::init<const std::string &>())
+        .def(bopy::init<const std::string &, const std::string &>())
+        .def(bopy::init<const Tango::DevicePipe &>())
+        .add_property("name", 
+                      bopy::make_function(&Tango::DevicePipe::get_name,
+                                          bopy::return_value_policy
+                                          <bopy::copy_const_reference>()),
+                      &Tango::DevicePipe::set_name)
+        .add_property("root_blob_name",
+                      bopy::make_function(&Tango::DevicePipe::get_root_blob_name,
+                                          bopy::return_value_policy
+                                          <bopy::copy_const_reference>()),
+                      &Tango::DevicePipe::set_root_blob_name)
+        .add_property("data_elt_nb",
+                      &Tango::DevicePipe::get_data_elt_nb, 
+                      &Tango::DevicePipe::set_data_elt_nb)        
+        .add_property("data_elt_names",
+                      &Tango::DevicePipe::get_data_elt_names, 
+                      &Tango::DevicePipe::set_data_elt_names)        
+        .def("get_data_elt_name", &Tango::DevicePipe::get_data_elt_name)
+        .def("get_data_elt_type", &Tango::DevicePipe::get_data_elt_type)
+    ;
+}
diff --git a/src/boost/cpp/device_pipe.h b/src/boost/cpp/device_pipe.h
new file mode 100644
index 0000000..7bb86c6
--- /dev/null
+++ b/src/boost/cpp/device_pipe.h
@@ -0,0 +1,51 @@
+/******************************************************************************
+  This file is part of PyTango (http://www.tinyurl.com/PyTango)
+
+  Copyright 2006-2012 CELLS / ALBA Synchrotron, Bellaterra, Spain
+  Copyright 2013-2014 European Synchrotron Radiation Facility, Grenoble, France
+
+  Distributed under the terms of the GNU Lesser General Public License,
+  either version 3 of the License, or (at your option) any later version.
+  See LICENSE.txt for more info.
+******************************************************************************/
+
+#pragma once
+
+#include <boost/python.hpp>
+#include <tango.h>
+
+#include "defs.h"
+#include "pyutils.h"
+
+namespace PyTango
+{ 
+    namespace DevicePipe 
+    {
+        void
+        update_values(Tango::DevicePipe& self, bopy::object& py_value,
+                      PyTango::ExtractAs extract_as=PyTango::ExtractAsNumpy);
+
+        template<typename TDevicePipe>
+        bopy::object
+        convert_to_python(TDevicePipe* self, PyTango::ExtractAs extract_as)
+        {
+            bopy::object py_value;
+            try 
+            {
+                py_value = bopy::object(
+                               bopy::handle<>(
+                                   bopy::to_python_indirect<
+                                       TDevicePipe*, 
+                                       bopy::detail::make_owning_holder>() (self)));
+            } 
+            catch (...)
+            {
+                delete self;
+                throw;
+            }
+
+            update_values(*self, py_value, extract_as);
+            return py_value;            
+        }
+    } 
+}
diff --git a/src/boost/cpp/device_proxy.cpp b/src/boost/cpp/device_proxy.cpp
index da3311d..c2d93fa 100644
--- a/src/boost/cpp/device_proxy.cpp
+++ b/src/boost/cpp/device_proxy.cpp
@@ -11,6 +11,7 @@
 
 #include "precompiled_header.hpp"
 #include "device_attribute.h"
+#include "device_pipe.h"
 #include "callback.h"
 #include "defs.h"
 #include "pytgutils.h"
@@ -81,7 +82,23 @@ namespace PyDeviceProxy
         }
     }
 
-    static inline bopy::object read_attribute(Tango::DeviceProxy& self, const string & attr_name, PyTango::ExtractAs extract_as)
+    static bopy::object
+    read_pipe(Tango::DeviceProxy& self, const std::string & pipe_name,
+              PyTango::ExtractAs extract_as)
+    {
+        Tango::DevicePipe* dev_pipe_result;
+        {
+            AutoPythonAllowThreads guard;
+            Tango::DevicePipe dev_pipe_read = self.read_pipe(pipe_name);
+            dev_pipe_result = new Tango::DevicePipe;
+            (*dev_pipe_result) = std::move(dev_pipe_read);
+
+        }
+
+        return PyTango::DevicePipe::convert_to_python(dev_pipe_result, extract_as);
+    }
+
+    static bopy::object read_attribute(Tango::DeviceProxy& self, const std::string & attr_name, PyTango::ExtractAs extract_as)
     {
         // Even if there's an exception in convert_to_python, the
         // DeviceAttribute will be deleted there, so we don't need to worry.
@@ -578,6 +595,10 @@ void export_device_proxy()
 	     &Tango::DeviceProxy::set_pipe_config,
 	     ( arg_("self"), arg_("seq") ) )
 
+	.def("_read_pipe", &PyDeviceProxy::read_pipe,
+	     ( arg_("self"), arg_("pipe_name"),
+	       arg_("extract_as")=PyTango::ExtractAsNumpy ) )
+
         //
         // attribute methods
         //
diff --git a/src/boost/cpp/server/command.cpp b/src/boost/cpp/server/command.cpp
index ff6e55b..7865994 100644
--- a/src/boost/cpp/server/command.cpp
+++ b/src/boost/cpp/server/command.cpp
@@ -138,6 +138,12 @@ void insert_scalar<Tango::DEV_ENCODED>(boost::python::object &o, CORBA::Any &any
     PyBuffer_Release(&view);
 }
 
+template<>
+void insert_scalar<Tango::DEV_PIPE_BLOB>(boost::python::object &o, CORBA::Any &any)
+{
+    assert(false);
+}
+
 template<long tangoArrayTypeConst>
 void insert_array(boost::python::object &o, CORBA::Any &any)
 {   
@@ -151,6 +157,12 @@ void insert_array(boost::python::object &o, CORBA::Any &any)
     any <<= data;
 }
 
+template<>
+void insert_array<Tango::DEV_PIPE_BLOB>(boost::python::object &o, CORBA::Any &any)
+{
+    assert(false);
+}
+
 template<long tangoTypeConst>
 void extract_scalar(const CORBA::Any &any, boost::python::object &o)
 {
@@ -180,6 +192,12 @@ void extract_scalar<Tango::DEV_VOID>(const CORBA::Any &any, boost::python::objec
 {}
 
 template<>
+void extract_scalar<Tango::DEV_PIPE_BLOB>(const CORBA::Any &any, boost::python::object &o)
+{
+    assert(false);
+}
+
+template<>
 void extract_scalar<Tango::DEV_ENCODED>(const CORBA::Any &any, boost::python::object &o)
 {
     Tango::DevEncoded* data;
@@ -261,6 +279,13 @@ void extract_array(const CORBA::Any &any, boost::python::object &py_result)
 #endif
 }
 
+template<>
+void extract_array<Tango::DEV_PIPE_BLOB>(const CORBA::Any &any,
+					 boost::python::object &py_result)
+{
+    assert(false);
+}
+
 CORBA::Any *PyCmd::execute(Tango::DeviceImpl *dev, const CORBA::Any &param_any)
 {
     PyDeviceImplBase *dev_ptr = dynamic_cast<PyDeviceImplBase *>(dev);
diff --git a/src/boost/cpp/tgutils.h b/src/boost/cpp/tgutils.h
index 6ef6f14..1cab669 100644
--- a/src/boost/cpp/tgutils.h
+++ b/src/boost/cpp/tgutils.h
@@ -107,6 +107,7 @@ TSD_SIMPLE__( DEV_LONG64,               Tango::DevLong64 ,  Tango::DevVarLong64A
 TSD_SIMPLE__( DEV_ULONG64,              Tango::DevULong64,  Tango::DevVarULong64Array   );
 TSD_SIMPLE__( DEV_STATE,                Tango::DevState  ,  Tango::DevVarStateArray   );
 TSD_SIMPLE__( DEV_ENCODED,              Tango::DevEncoded,  Tango::DevVarEncodedArray     );
+TSD_SIMPLE__( DEV_PIPE_BLOB,            Tango::DevPipeBlob, void  );
 
 TSD_SIMPLE__( DEV_VOID,                 void             , void);
 
@@ -123,7 +124,7 @@ TSD_ARRAY__(  DEVVAR_DOUBLESTRINGARRAY, void             ,  Tango::DevVarDoubleS
 TSD_ARRAY__(  DEVVAR_BOOLEANARRAY,      Tango::DevBoolean,  Tango::DevVarBooleanArray);
 TSD_ARRAY__(  DEVVAR_LONG64ARRAY,       Tango::DevLong64 ,  Tango::DevVarLong64Array);
 TSD_ARRAY__(  DEVVAR_ULONG64ARRAY,      Tango::DevULong64,  Tango::DevVarULong64Array);
-
+TSD_ARRAY__(  DEVVAR_STATEARRAY,        Tango::DevState  ,  Tango::DevVarStateArray);
  
 DEF_TANGO_SCALAR_ARRAY_NAMES( DEV_SHORT,   DEVVAR_SHORTARRAY );
 DEF_TANGO_SCALAR_ARRAY_NAMES( DEV_LONG,    DEVVAR_LONGARRAY );
@@ -136,7 +137,7 @@ DEF_TANGO_SCALAR_ARRAY_NAMES( DEV_ULONG,   DEVVAR_ULONGARRAY );
 //DEF_TANGO_SCALAR_ARRAY_NAMES( DEV_UCHAR,   DEVVAR_CHARARRAY );
 DEF_TANGO_SCALAR_ARRAY_NAMES( DEV_LONG64,  DEVVAR_LONG64ARRAY );
 DEF_TANGO_SCALAR_ARRAY_NAMES( DEV_ULONG64, DEVVAR_ULONG64ARRAY );
-// DEF_TANGO_SCALAR_ARRAY_NAMES( DEV_STATE,   DEVVAR_STATEARRAY );
+DEF_TANGO_SCALAR_ARRAY_NAMES( DEV_STATE,   DEVVAR_STATEARRAY );
 // DEF_TANGO_SCALAR_ARRAY_NAMES( DEV_ENCODED, DEVVAR_ENCODEDARRAY );
 //DEF_TANGO_SCALAR_ARRAY_NAMES( DEV_,        DEVVAR_LONGSTRINGARRAY );
 //DEF_TANGO_SCALAR_ARRAY_NAMES( DEV_,        DEVVAR_DOUBLESTRINGARRAY );
@@ -228,6 +229,7 @@ DEF_TANGO_SCALAR_ARRAY_NAMES( DEV_ULONG64, DEVVAR_ULONG64ARRAY );
         __TANGO_DEPEND_ON_TYPE_AUX_ID(DEV_USHORT, DOIT_SIMPLE) \
         __TANGO_DEPEND_ON_TYPE_AUX_ID(DEV_ULONG, DOIT_SIMPLE) \
         __TANGO_DEPEND_ON_TYPE_AUX_ID(DEV_STRING, DOIT_SIMPLE) \
+        __TANGO_DEPEND_ON_TYPE_AUX_ID(DEV_STATE, DOIT_SIMPLE) \
         __TANGO_DEPEND_ON_TYPE_AUX_ID(DEVVAR_CHARARRAY, DOIT_ARRAY) \
         __TANGO_DEPEND_ON_TYPE_AUX_ID(DEVVAR_SHORTARRAY, DOIT_ARRAY) \
         __TANGO_DEPEND_ON_TYPE_AUX_ID(DEVVAR_LONGARRAY, DOIT_ARRAY) \
@@ -238,7 +240,7 @@ DEF_TANGO_SCALAR_ARRAY_NAMES( DEV_ULONG64, DEVVAR_ULONG64ARRAY );
         __TANGO_DEPEND_ON_TYPE_AUX_ID(DEVVAR_STRINGARRAY, DOIT_ARRAY) \
         __TANGO_DEPEND_ON_TYPE_AUX_ID(DEVVAR_LONGSTRINGARRAY, DOIT_ARRAY) \
         __TANGO_DEPEND_ON_TYPE_AUX_ID(DEVVAR_DOUBLESTRINGARRAY, DOIT_ARRAY) \
-        __TANGO_DEPEND_ON_TYPE_AUX_ID(DEV_STATE, DOIT_SIMPLE) \
+        __TANGO_DEPEND_ON_TYPE_AUX_ID(DEVVAR_STATEARRAY, DOIT_ARRAY) \
 /*        __TANGO_DEPEND_ON_TYPE_AUX_ID(CONST_DEV_STRING, DOIT_SIMPLE) */\
 /*        __TANGO_DEPEND_ON_TYPE_AUX_ID(DEVVAR_BOOLEANARRAY, DOIT_ARRAY) */\
 /*        __TANGO_DEPEND_ON_TYPE_AUX_ID(DEV_UCHAR, DOIT_SIMPLE)*/ \
@@ -248,6 +250,7 @@ DEF_TANGO_SCALAR_ARRAY_NAMES( DEV_ULONG64, DEVVAR_ULONG64ARRAY );
         __TANGO_DEPEND_ON_TYPE_AUX_ID(DEVVAR_ULONG64ARRAY, DOIT_ARRAY) \
 /*        __TANGO_DEPEND_ON_TYPE_AUX_ID(DEV_INT, DOIT_SIMPLE) */\
         __TANGO_DEPEND_ON_TYPE_AUX_ID(DEV_ENCODED, DOIT_SIMPLE) \
+        __TANGO_DEPEND_ON_TYPE_AUX_ID(DEV_PIPE_BLOB, DOIT_SIMPLE) \
         default: \
             assert(false); \
     } } else (void)0
@@ -267,6 +270,7 @@ DEF_TANGO_SCALAR_ARRAY_NAMES( DEV_ULONG64, DEVVAR_ULONG64ARRAY );
 /*        __TANGO_DEPEND_ON_TYPE_AUX_ID(DEVVAR_BOOLEANARRAY, DOIT_ARRAY) */\
         __TANGO_DEPEND_ON_TYPE_AUX_ID(DEVVAR_LONG64ARRAY, DOIT_ARRAY) \
         __TANGO_DEPEND_ON_TYPE_AUX_ID(DEVVAR_ULONG64ARRAY, DOIT_ARRAY) \
+        __TANGO_DEPEND_ON_TYPE_AUX_ID(DEVVAR_STATEARRAY, DOIT_ARRAY) \
         default: \
             assert(false); \
     } } else (void)0
@@ -293,6 +297,7 @@ DEF_TANGO_SCALAR_ARRAY_NAMES( DEV_ULONG64, DEVVAR_ULONG64ARRAY );
         __TANGO_DEPEND_ON_TYPE_AUX_NAME(DEVVAR_LONGSTRINGARRAY, DOIT_ARRAY) \
         __TANGO_DEPEND_ON_TYPE_AUX_NAME(DEVVAR_DOUBLESTRINGARRAY, DOIT_ARRAY) \
         __TANGO_DEPEND_ON_TYPE_AUX_NAME(DEV_STATE, DOIT_SIMPLE) \
+        __TANGO_DEPEND_ON_TYPE_AUX_NAME(DEVVAR_STATEARRAY, DOIT_ARRAY) \
 /*        __TANGO_DEPEND_ON_TYPE_AUX_NAME(CONST_DEV_STRING, DOIT_SIMPLE) */\
 /*        __TANGO_DEPEND_ON_TYPE_AUX_NAME(DEVVAR_BOOLEANARRAY, DOIT_ARRAY) */\
 /*        __TANGO_DEPEND_ON_TYPE_AUX_NAME(DEV_UCHAR, DOIT_SIMPLE)*/ \
@@ -302,6 +307,7 @@ DEF_TANGO_SCALAR_ARRAY_NAMES( DEV_ULONG64, DEVVAR_ULONG64ARRAY );
         __TANGO_DEPEND_ON_TYPE_AUX_NAME(DEVVAR_ULONG64ARRAY, DOIT_ARRAY) \
 /*        __TANGO_DEPEND_ON_TYPE_AUX_NAME(DEV_INT, DOIT_SIMPLE) */\
         __TANGO_DEPEND_ON_TYPE_AUX_NAME(DEV_ENCODED, DOIT_SIMPLE) \
+        __TANGO_DEPEND_ON_TYPE_AUX_NAME(DEV_PIPE_BLOB, DOIT_SIMPLE) \
         default: \
             assert(false); \
     } } else (void)0
diff --git a/src/boost/cpp/to_py_numpy.hpp b/src/boost/cpp/to_py_numpy.hpp
index f5a49c2..e37eb1c 100644
--- a/src/boost/cpp/to_py_numpy.hpp
+++ b/src/boost/cpp/to_py_numpy.hpp
@@ -56,6 +56,12 @@ inline boost::python::object to_py_numpy<Tango::DEVVAR_STRINGARRAY>(const Tango:
 }
 
 template <>
+inline boost::python::object to_py_numpy<Tango::DEVVAR_STATEARRAY>(const Tango::DevVarStateArray* tg_array, boost::python::object parent)
+{
+    return to_py_list(tg_array);
+}
+
+template <>
 inline boost::python::object to_py_numpy<Tango::DEVVAR_LONGSTRINGARRAY>(const Tango::DevVarLongStringArray* tg_array, boost::python::object parent)
 {
     boost::python::list result;
diff --git a/src/boost/python/device_proxy.py b/src/boost/python/device_proxy.py
index 47176d1..20e8afd 100644
--- a/src/boost/python/device_proxy.py
+++ b/src/boost/python/device_proxy.py
@@ -123,6 +123,11 @@ def __check_read_attribute(dev_attr):
         raise DevFailed(*dev_attr.get_err_stack())
     return dev_attr
 
+def __check_read_pipe(dev_pipe):
+    if dev_pipe.has_failed:
+        raise DevFailed(*dev_pipe.get_err_stack())
+    return dev_pipe
+
 def __DeviceProxy__init__(self, *args, **kwargs):
     self.__dict__['_green_mode'] = kwargs.pop('green_mode', None)
     self.__dict__['_executors'] = executors = {}
@@ -1136,6 +1141,9 @@ def __DeviceProxy__str(self):
     info = self._get_info_()
     return "%s(%s)" % (info.dev_class, self.dev_name())
 
+def __DeviceProxy__read_pipe(self, pipe_name, extract_as=ExtractAs.Numpy):
+    return self._read_pipe(pipe_name, extract_as)
+
 def __DeviceProxy__read_attributes(self, *args, **kwargs):
     return self._read_attributes(*args, **kwargs)
 
@@ -1248,6 +1256,8 @@ def __init_DeviceProxy():
     DeviceProxy.write_attribute_asynch = __DeviceProxy__write_attribute_asynch
     DeviceProxy.write_attribute_reply = __DeviceProxy__write_attribute_reply
 
+    DeviceProxy.read_pipe = __DeviceProxy__read_pipe
+
     DeviceProxy.get_property = __DeviceProxy__get_property
     DeviceProxy.put_property = __DeviceProxy__put_property
     DeviceProxy.delete_property = __DeviceProxy__delete_property
diff --git a/src/boost/python/pytango_pprint.py b/src/boost/python/pytango_pprint.py
index e3769a5..75e63d8 100644
--- a/src/boost/python/pytango_pprint.py
+++ b/src/boost/python/pytango_pprint.py
@@ -29,8 +29,8 @@ from ._PyTango import (StdStringVector, StdLongVector, CommandInfoList,
     ChangeEventInfo, PeriodicEventInfo, ArchiveEventInfo,
     AttributeEventInfo, AttributeInfoEx,
     DeviceAttribute, DeviceAttributeHistory, DeviceData, DeviceDataHistory,
-    DbDatum, DbDevInfo, DbDevImportInfo, DbDevExportInfo, DbServerInfo,
-    GroupReply, GroupAttrReply, GroupCmdReply,
+    DevicePipe, DbDatum, DbDevInfo, DbDevImportInfo, DbDevExportInfo,
+    DbServerInfo, GroupReply, GroupAttrReply, GroupCmdReply,
     DevError, EventData, AttrConfEventData, DataReadyEventData,
     TimeVal, DevFailed, CmdArgType)
 
@@ -120,8 +120,8 @@ def __registerStructStr():
         ChangeEventInfo, PeriodicEventInfo, ArchiveEventInfo,
         AttributeEventInfo, AttributeInfoEx, PipeInfo,
         DeviceAttribute, DeviceAttributeHistory, DeviceData, DeviceDataHistory,
-        DbDatum, DbDevInfo, DbDevImportInfo, DbDevExportInfo, DbServerInfo,
-        GroupReply, GroupAttrReply, GroupCmdReply,
+        DevicePipe, DbDatum, DbDevInfo, DbDevImportInfo, DbDevExportInfo, 
+        DbServerInfo, GroupReply, GroupAttrReply, GroupCmdReply,
         DevError, EventData, AttrConfEventData, DataReadyEventData,
         AttributeConfig, AttributeConfig_2, AttributeConfig_3,
         AttributeConfig_5,

-- 
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