[pytango] 100/483: implements feature request #3495607

Sandor Bodo-Merle sbodomerle-guest at moszumanska.debian.org
Thu Sep 28 19:14:28 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 0fcf1006395c9033c80ae5d5d28fc9140a6811f1
Author: tiagocoutinho <tiagocoutinho at 4e9c00fd-8f2e-0410-aa12-93ce3db5e235>
Date:   Wed Feb 29 09:45:57 2012 +0000

    implements feature request #3495607
    
    git-svn-id: http://svn.code.sf.net/p/tango-cs/code/bindings/PyTango/trunk@19501 4e9c00fd-8f2e-0410-aa12-93ce3db5e235
---
 PyTango/device_class.py     | 15 +++++++++++++++
 src/server/device_class.cpp | 16 +++++++++++++++-
 src/server/device_class.h   |  7 +++++++
 3 files changed, 37 insertions(+), 1 deletion(-)

diff --git a/PyTango/device_class.py b/PyTango/device_class.py
index 6c39b97..fd878b9 100644
--- a/PyTango/device_class.py
+++ b/PyTango/device_class.py
@@ -635,7 +635,22 @@ class DeviceClass(_DeviceClass):
                 return
         err_mess = "Device " + name + " not in Tango class device list!"
         Except.throw_exception("PyAPI_CantDestroyDevice",err_mess,"DeviceClass.device_destroyer")
+    
+    def device_name_factory(self, dev_name_list):
+        """
+            device_name_factory(self, dev_name_list) ->  None
+                
+                Create device(s) name list (for no database device server).
+                This method can be re-defined in DeviceClass sub-class for
+                device server started without database. Its rule is to
+                initialise class device name. The default method does nothing.
+            
+            Parameters :
+                - dev_name_list : (seq<str>) sequence of devices to be filled
 
+            Return     : None"""
+        pass
+    
 def __init_DeviceClass():
     pass
 
diff --git a/src/server/device_class.cpp b/src/server/device_class.cpp
index b71d6b8..4af89ba 100644
--- a/src/server/device_class.cpp
+++ b/src/server/device_class.cpp
@@ -193,6 +193,19 @@ void CppDeviceClassWrap::command_factory()
     CALL_DEVCLASS_METHOD(_DeviceClass__command_factory)
 }
 
+void CppDeviceClassWrap::device_name_factory(std::vector<std::string> &dev_list)
+{
+    //
+    // make sure we pass the same vector object to the python method
+    //
+    object py_dev_list(
+                handle<>(
+                    to_python_indirect<
+                        std::vector<std::string>,
+                        detail::make_reference_holder>()(dev_list)));
+    CALL_DEVCLASS_METHOD_VARGS(device_name_factory, py_dev_list);
+}
+
 void CppDeviceClassWrap::device_factory(const Tango::DevVarStringArray *dev_list)
 {
     CALL_DEVCLASS_METHOD_VARGS(device_factory, dev_list)
@@ -234,7 +247,6 @@ void CppDeviceClassWrap::delete_class()
     {
         handle_python_exception(eas);
     }
-
 }
 
 namespace PyDeviceClass
@@ -272,6 +284,7 @@ namespace PyDeviceClass
     void (*add_device1)(CppDeviceClass &, auto_ptr<Tango::DeviceImpl>) = &add_device;
     void (*add_device2)(CppDeviceClass &, auto_ptr<Tango::Device_4Impl>) = &add_device;
     */
+    
 }
 
 BOOST_PYTHON_MEMBER_FUNCTION_OVERLOADS (export_device_overload,
@@ -301,6 +314,7 @@ void export_device_class()
         init<const std::string &>())
 
         .def("device_factory", &CppDeviceClassWrap::device_factory)
+        .def("device_name_factory", &CppDeviceClassWrap::device_name_factory)
         .def("export_device", &CppDeviceClass::export_device,
             export_device_overload())
         //.def("_add_device", PyDeviceClass::add_device1)
diff --git a/src/server/device_class.h b/src/server/device_class.h
index d0c79ad..c03a473 100644
--- a/src/server/device_class.h
+++ b/src/server/device_class.h
@@ -151,6 +151,12 @@ public:
     virtual void command_factory();
 
     /**
+     * This method forward a C++ call to the device_name_factory method to the
+     * Python method
+     */
+    virtual void device_name_factory(std::vector<std::string> &dev_list);
+
+    /**
      * This method is called to ask Python to delete a class by decrementing
      * the Python ref count
      */
@@ -172,6 +178,7 @@ public:
      */
     void default_signal_handler(long signo);
 
+
 protected:
 
     /**

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