[pytango] 40/483: fixes #3405580
Sandor Bodo-Merle
sbodomerle-guest at moszumanska.debian.org
Thu Sep 28 19:14:22 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 905b45111285a70d7327abf429a156efae7384ad
Author: tiagocoutinho <tiagocoutinho at 4e9c00fd-8f2e-0410-aa12-93ce3db5e235>
Date: Wed Sep 7 13:38:26 2011 +0000
fixes #3405580
git-svn-id: http://svn.code.sf.net/p/tango-cs/code/bindings/PyTango/trunk@17820 4e9c00fd-8f2e-0410-aa12-93ce3db5e235
---
Makefile | 8 ++-
PyTango/device_server.py | 101 +++++++++++++++++++++++++----------
doc/conf.py | 6 +--
doc/revision.rst | 1 +
doc/server/index.rst | 63 +++++++++++-----------
src/base_types.cpp | 3 ++
src/pytango.cpp | 2 +
src/server/device_class.cpp | 2 +
src/server/multi_attribute.cpp | 2 +
src/server/multi_class_attribute.cpp | 47 ++++++++++++++++
10 files changed, 172 insertions(+), 63 deletions(-)
diff --git a/Makefile b/Makefile
index ac36f17..97d5bb5 100644
--- a/Makefile
+++ b/Makefile
@@ -135,6 +135,7 @@ $(OBJS_DIR)/dserver.o \
$(OBJS_DIR)/encoded_attribute.o \
$(OBJS_DIR)/log4tango.o \
$(OBJS_DIR)/multi_attribute.o \
+$(OBJS_DIR)/multi_class_attribute.o \
$(OBJS_DIR)/subdev.o \
$(OBJS_DIR)/tango_util.o \
$(OBJS_DIR)/user_default_attr_prop.o \
@@ -199,8 +200,11 @@ clean:
rm -f $(PREP).gch
rm -rf $(OBJS_DIR)
-install: build
+install-py:
mkdir -p $(prefix)
rsync -r PyTango $(prefix)
+
+install: build install-py
rsync $(OBJS_DIR)/$(LIB_NAME) $(prefix)/PyTango
- rsync $(OBJS_DIR)/$(LIB_SYMB_NAME) $(prefix)/PyTango
+# rsync $(OBJS_DIR)/$(LIB_SYMB_NAME) $(prefix)/PyTango
+
diff --git a/PyTango/device_server.py b/PyTango/device_server.py
index 050f67b..4460b9e 100644
--- a/PyTango/device_server.py
+++ b/PyTango/device_server.py
@@ -35,7 +35,7 @@ import copy
import _PyTango
from _PyTango import DeviceImpl, Device_3Impl, Device_4Impl
-from _PyTango import Attribute, WAttribute, MultiAttribute
+from _PyTango import Attribute, WAttribute, MultiAttribute, MultiClassAttribute
from _PyTango import Attr
from _PyTango import Logger
from _PyTango import AttrWriteType, AttrDataFormat, DispLevel
@@ -607,9 +607,6 @@ def __init_Attribute():
Attribute.get_properties_3 = __Attribute__get_properties_3
Attribute.set_properties = __Attribute__set_properties
-def __init_MultiAttribute():
- MultiAttribute.get_attribute_list = __MultiAttribute__get_attribute_list
-
def __init_Logger():
Logger.log = __Logger__log
Logger.log_unconditionally = __Logger__log_unconditionally
@@ -1746,34 +1743,73 @@ def __doc_WAttribute():
Return : (obj) the attribute write value.
""" )
-def __MultiAttribute__get_attribute_list(self):
- """
- get_attribute_list(self) -> seq<Attribute>
+def __doc_MultiClassAttribute():
+ def document_method(method_name, desc, append=True):
+ return __document_method(MultiClassAttribute, method_name, desc, append)
- Get the list of attribute objects.
+ MultiClassAttribute.__doc__ = """
+ There is one instance of this class for each device class.
+ This class is mainly an aggregate of :class:`~PyTango.Attr` objects.
+ It eases management of multiple attributes
+
+ New in PyTango 7.2.1"""
+
+ document_method("get_attr", """
+ get_attr(self, attr_name) -> Attr
- Return : (seq<Attribute>) list of attribute objects
+ Get the :class:`~PyTango.Attr` object for the attribute with
+ name passed as parameter
+
+ Parameters :
+ - attr_name : (str) attribute name
+ Return : (Attr) the attribute object
+
+ Throws : DevFailed If the attribute is not defined.
New in PyTango 7.2.1
- """
- return [ self.get_attr_by_ind(i) for i in range(self.get_attr_nb()) ]
+ """ )
+
+ document_method("remove_attr", """
+ remove_attr(self, attr_name, cl_name) -> None
+
+ Remove the :class:`~PyTango.Attr` object for the attribute with
+ name passed as parameter. Does nothing if the attribute does not
+ exist.
+
+ Parameters :
+ - attr_name : (str) attribute name
+ - cl_name : (str) the attribute class name
-
+ New in PyTango 7.2.1
+ """ )
+
+ document_method("get_attr_list", """
+ get_attr_list(self) -> seq<Attr>
+
+ Get the list of :class:`~PyTango.Attr` for this device class.
+
+ Return : (seq<Attr>) the list of attribute objects
+
+ New in PyTango 7.2.1
+ """ )
+
def __doc_MultiAttribute():
def document_method(method_name, desc, append=True):
return __document_method(MultiAttribute, method_name, desc, append)
MultiAttribute.__doc__ = """
There is one instance of this class for each device.
- This class is mainly an aggregate of Attribute or WAttribute objects.
- It eases management of multiple attributes"""
+ This class is mainly an aggregate of :class:`~PyTango.Attribute` or
+ :class:`~PyTango.WAttribute` objects. It eases management of multiple
+ attributes"""
document_method("get_attr_by_name", """
get_attr_by_name(self, attr_name) -> Attribute
- Get Attribute object from its name.
- This method returns an Attribute object with a name passed as
- parameter. The equality on attribute name is case independant.
+ Get :class:`~PyTango.Attribute` object from its name.
+ This method returns an :class:`~PyTango.Attribute` object with a
+ name passed as parameter. The equality on attribute name is case
+ independant.
Parameters :
- attr_name : (str) attribute name
@@ -1785,9 +1821,9 @@ def __doc_MultiAttribute():
document_method("get_attr_by_ind", """
get_attr_by_ind(self, ind) -> Attribute
- Get Attribute object from its index.
- This method returns an Attribute object from the index in the
- main attribute vector.
+ Get :class:`~PyTango.Attribute` object from its index.
+ This method returns an :class:`~PyTango.Attribute` object from the
+ index in the main attribute vector.
Parameters :
- ind : (int) the attribute index
@@ -1798,8 +1834,9 @@ def __doc_MultiAttribute():
get_w_attr_by_name(self, attr_name) -> WAttribute
Get a writable attribute object from its name.
- This method returns an WAttribute object with a name passed as
- parameter. The equality on attribute name is case independant.
+ This method returns an :class:`~PyTango.WAttribute` object with a
+ name passed as parameter. The equality on attribute name is case
+ independant.
Parameters :
- attr_name : (str) attribute name
@@ -1812,8 +1849,8 @@ def __doc_MultiAttribute():
get_w_attr_by_ind(self, ind) -> WAttribute
Get a writable attribute object from its index.
- This method returns an WAttribute object from the index in the
- main attribute vector.
+ This method returns an :class:`~PyTango.WAttribute` object from the
+ index in the main attribute vector.
Parameters :
- ind : (int) the attribute index
@@ -1825,8 +1862,8 @@ def __doc_MultiAttribute():
Get Attribute index into the main attribute vector from its name.
This method returns the index in the Attribute vector (stored in the
- MultiAttribute object) of an attribute with a given name.
- The name equality is case independant.
+ :class:`~PyTango.MultiAttribute` object) of an attribute with a
+ given name. The name equality is case independant.
Parameters :
- attr_name : (str) attribute name
@@ -1881,6 +1918,16 @@ def __doc_MultiAttribute():
New in PyTango 7.0.0
""" )
+ document_method("get_attribute_list", """
+ get_attribute_list(self) -> seq<Attribute>
+
+ Get the list of attribute objects.
+
+ Return : (seq<Attribute>) list of attribute objects
+
+ New in PyTango 7.2.1
+ """ )
+
def __doc_Attr():
def document_method(method_name, desc, append=True):
return __document_method(Attr, method_name, desc, append)
@@ -2398,7 +2445,6 @@ def init(doc=True):
__init_Attribute()
__init_Attr()
__init_Logger()
- __init_MultiAttribute()
if doc:
__doc_DeviceImpl()
__doc_extra_DeviceImpl(Device_3Impl)
@@ -2406,5 +2452,6 @@ def init(doc=True):
__doc_Attribute()
__doc_WAttribute()
__doc_MultiAttribute()
+ __doc_MultiClassAttribute()
__doc_UserDefaultAttrProp()
__doc_Attr()
diff --git a/doc/conf.py b/doc/conf.py
index d9da810..2986ae0 100644
--- a/doc/conf.py
+++ b/doc/conf.py
@@ -206,10 +206,10 @@ htmlhelp_basename = 'PyTangodoc'
# -- Options for LaTeX output --------------------------------------------------
# The paper size ('letter' or 'a4').
-#latex_paper_size = 'letter'
+latex_paper_size = 'a4'
# The font size ('10pt', '11pt' or '12pt').
-#latex_font_size = '10pt'
+latex_font_size = '10pt'
# Grouping the document tree into LaTeX files. List of tuples
# (source start file, target name, title, author, documentclass [howto/manual]).
@@ -220,7 +220,7 @@ latex_documents = [
# The name of an image file (relative to this directory) to place at the top of
# the title page.
-#latex_logo = None
+latex_logo = 'logo.png'
# For "manual" documents, if this is true, then toplevel headings are parts,
# not chapters.
diff --git a/doc/revision.rst b/doc/revision.rst
index 7f75aff..e7facab 100644
--- a/doc/revision.rst
+++ b/doc/revision.rst
@@ -80,6 +80,7 @@ Version history
| | - from sourceforge: |
| | - `3372371: write attribute of DevEncoded doesn't work <https://sourceforge.net/tracker/?func=detail&aid=3372371&group_id=57612&atid=484769>`_ |
| | - `3404771: PyTango.MultiAttribute.get_attribute_list missing <https://sourceforge.net/tracker/?func=detail&aid=3404771&group_id=57612&atid=484769>`_ |
+| | - `3405580: PyTango.MultiClassAttribute missing <https://sourceforge.net/tracker/?func=detail&aid=3405580&group_id=57612&atid=484769>`_ |
+------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| 7.2.0 | Features: |
| | - from sourceforge: |
diff --git a/doc/server/index.rst b/doc/server/index.rst
index 483bbe0..6f9cbc8 100644
--- a/doc/server/index.rst
+++ b/doc/server/index.rst
@@ -516,61 +516,62 @@ Unlike the commands, the is_allowed method for attributes receives a parameter
of type :class:`AttReqtype`.
The following table gives some more info on these methods:
+.. html:
+-------------+-------------+--------------------------------------------------------------+
| data format | data type | python type |
+=============+=============+==============================================================+
| SCALAR | DEV_BOOLEAN | :py:obj:`bool` |
- | +-------------+--------------------------------------------------------------+
- | | DEV_UCHAR | :py:obj:`int` |
- | +-------------+--------------------------------------------------------------+
- | | DEV_SHORT | :py:obj:`int` |
- | +-------------+--------------------------------------------------------------+
- | | DEV_USHORT | :py:obj:`int` |
- | +-------------+--------------------------------------------------------------+
- | | DEV_LONG | :py:obj:`int` |
- | +-------------+--------------------------------------------------------------+
- | | DEV_ULONG | :py:obj:`int` |
- | +-------------+--------------------------------------------------------------+
- | | DEV_LONG64 | :py:obj:`int`/ :py:obj:`long` |
- | +-------------+--------------------------------------------------------------+
- | | DEV_ULONG64 | :py:obj:`int`/ :py:obj:`long` |
- | +-------------+--------------------------------------------------------------+
- | | DEV_FLOAT | :py:obj:`float` |
- | +-------------+--------------------------------------------------------------+
- | | DEV_DOUBLE | :py:obj:`float` |
- | +-------------+--------------------------------------------------------------+
- | | DEV_STRING | :py:obj:`str` |
+ |-------------+-------------+--------------------------------------------------------------+
+ | SCALAR | DEV_UCHAR | :py:obj:`int` |
+ +-------------+-------------+--------------------------------------------------------------+
+ | SCALAR | DEV_SHORT | :py:obj:`int` |
+ +-------------+-------------+--------------------------------------------------------------+
+ | SCALAR | DEV_USHORT | :py:obj:`int` |
+ +-------------+-------------+--------------------------------------------------------------+
+ | SCALAR | DEV_LONG | :py:obj:`int` |
+ +-------------+-------------+--------------------------------------------------------------+
+ | SCALAR | DEV_ULONG | :py:obj:`int` |
+ +-------------+-------------+--------------------------------------------------------------+
+ | SCALAR | DEV_LONG64 | :py:obj:`int`/ :py:obj:`long` |
+ +-------------+-------------+--------------------------------------------------------------+
+ | SCALAR | DEV_ULONG64 | :py:obj:`int`/ :py:obj:`long` |
+ +-------------+-------------+--------------------------------------------------------------+
+ | SCALAR | DEV_FLOAT | :py:obj:`float` |
+ +-------------+-------------+--------------------------------------------------------------+
+ | SCALAR | DEV_DOUBLE | :py:obj:`float` |
+ +-------------+-------------+--------------------------------------------------------------+
+ | SCALAR | DEV_STRING | :py:obj:`str` |
+-------------+-------------+--------------------------------------------------------------+
| SPECTRUM | DEV_BOOLEAN | :py:class:`numpy.ndarray` (dtype= :py:obj:`numpy.bool`) |
- | or | | or sequence<:py:obj:`bool`> |
- | IMAGE +-------------+--------------------------------------------------------------+
+ | or IMAGE | | or sequence<:py:obj:`bool`> |
+ +-------------+-------------+--------------------------------------------------------------+
| | DEV_UCHAR | :py:class:`numpy.ndarray` (dtype= :py:obj:`numpy.uint8`) |
| | | or sequence<:py:obj:`int`> |
- | +-------------+--------------------------------------------------------------+
+ +-------------+-------------+--------------------------------------------------------------+
| | DEV_SHORT | :py:class:`numpy.ndarray` (dtype= :py:obj:`numpy.int16`) |
| | | or sequence<:py:obj:`int`> |
- | +-------------+--------------------------------------------------------------+
+ +-------------+-------------+--------------------------------------------------------------+
| | DEV_USHORT | :py:class:`numpy.ndarray` (dtype= :py:obj:`numpy.uint16`) |
| | | or sequence<:py:obj:`int`> |
- | +-------------+--------------------------------------------------------------+
+ +-------------+-------------+--------------------------------------------------------------+
| | DEV_LONG | :py:class:`numpy.ndarray` (dtype= :py:obj:`numpy.int32`) |
| | | or sequence<:py:obj:`int`> |
- | +-------------+--------------------------------------------------------------+
+ +-------------+-------------+--------------------------------------------------------------+
| | DEV_ULONG | :py:class:`numpy.ndarray` (dtype= :py:obj:`numpy.uint32`) |
| | | or sequence<:py:obj:`int`> |
- | +-------------+--------------------------------------------------------------+
+ +-------------+-------------+--------------------------------------------------------------+
| | DEV_LONG64 | :py:class:`numpy.ndarray` (dtype= :py:obj:`numpy.int64`) |
| | | or sequence<:py:obj:`int`> |
- | +-------------+--------------------------------------------------------------+
+ +-------------+-------------+--------------------------------------------------------------+
| | DEV_ULONG64 | :py:class:`numpy.ndarray` (dtype= :py:obj:`numpy.uint64`) |
| | | or sequence<:py:obj:`int`> |
- | +-------------+--------------------------------------------------------------+
+ +-------------+-------------+--------------------------------------------------------------+
| | DEV_FLOAT | :py:class:`numpy.ndarray` (dtype= :py:obj:`numpy.float32`) |
| | | or sequence<:py:obj:`float`> |
- | +-------------+--------------------------------------------------------------+
+ +-------------+-------------+--------------------------------------------------------------+
| | DEV_DOUBLE | :py:class:`numpy.ndarray` (dtype= :py:obj:`numpy.float64`) |
| | | or sequence<:py:obj:`float`> |
- | +-------------+--------------------------------------------------------------+
+ +-------------+-------------+--------------------------------------------------------------+
| | DEV_STRING | sequence<:py:obj:`str`> |
+-------------+-------------+--------------------------------------------------------------+
diff --git a/src/base_types.cpp b/src/base_types.cpp
index 37c3847..20e5f16 100644
--- a/src/base_types.cpp
+++ b/src/base_types.cpp
@@ -259,6 +259,9 @@ void export_base_types()
class_<std::vector<Tango::Attr *> >("AttrList")
.def(vector_indexing_suite<std::vector<Tango::Attr *>, true>());
+ class_<std::vector<Tango::Attribute *> >("AttributeList")
+ .def(vector_indexing_suite<std::vector<Tango::Attribute *>, true>());
+
//class_<Tango::EventDataList>("EventDataList")
// .def(vector_indexing_suite<Tango::EventDataList>());
diff --git a/src/pytango.cpp b/src/pytango.cpp
index c60ede9..fa0fc5b 100644
--- a/src/pytango.cpp
+++ b/src/pytango.cpp
@@ -58,6 +58,7 @@ void export_attribute();
void export_encoded_attribute();
void export_wattribute();
void export_multi_attribute();
+void export_multi_class_attribute();
void export_user_default_attr_prop();
void export_sub_dev_diag();
void export_dserver();
@@ -109,6 +110,7 @@ BOOST_PYTHON_MODULE(_PyTango)
export_encoded_attribute();
export_wattribute();
export_multi_attribute();
+ export_multi_class_attribute();
export_user_default_attr_prop();
export_sub_dev_diag();
export_device_class();
diff --git a/src/server/device_class.cpp b/src/server/device_class.cpp
index c53164a..7215f67 100644
--- a/src/server/device_class.cpp
+++ b/src/server/device_class.cpp
@@ -343,6 +343,8 @@ void export_device_class()
&Tango::DeviceClass::device_destroyer)
.def("_create_attribute", &CppDeviceClass::create_attribute)
.def("_create_command", &CppDeviceClass::create_command)
+ .def("get_class_attr", &Tango::DeviceClass::get_class_attr,
+ return_value_policy<reference_existing_object>())
;
implicitly_convertible<auto_ptr<CppDeviceClassWrap>, auto_ptr<CppDeviceClass> >();
}
diff --git a/src/server/multi_attribute.cpp b/src/server/multi_attribute.cpp
index d474c1c..d2586f4 100644
--- a/src/server/multi_attribute.cpp
+++ b/src/server/multi_attribute.cpp
@@ -53,5 +53,7 @@ void export_multi_attribute()
.def("read_alarm",
(void (Tango::MultiAttribute::*) (const std::string &))
&Tango::MultiAttribute::read_alarm) // New in 7.0.0
+ .def("get_attribute_list", &Tango::MultiAttribute::get_attribute_list,
+ return_value_policy<reference_existing_object>())
;
}
diff --git a/src/server/multi_class_attribute.cpp b/src/server/multi_class_attribute.cpp
new file mode 100644
index 0000000..3600d8c
--- /dev/null
+++ b/src/server/multi_class_attribute.cpp
@@ -0,0 +1,47 @@
+/*******************************************************************************
+
+ This file is part of PyTango, a python binding for Tango
+
+ http://www.tango-controls.org/static/PyTango/latest/doc/html/index.html
+
+ Copyright 2011 CELLS / ALBA Synchrotron, Bellaterra, Spain
+
+ PyTango is free software: you can redistribute it and/or modify
+ it under the terms of the GNU Lesser General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ PyTango is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public License
+ along with PyTango. If not, see <http://www.gnu.org/licenses/>.
+
+*******************************************************************************/
+
+#include "pytgutils.h"
+#include <sstream>
+
+using namespace boost::python;
+
+void export_multi_class_attribute()
+{
+ Tango::Attr& (Tango::MultiClassAttribute::*get_attr_)(std::string &) =
+ &Tango::MultiClassAttribute::get_attr;
+ void (Tango::MultiClassAttribute::*remove_attr_)(std::string &, const std::string &) =
+ &Tango::MultiClassAttribute::remove_attr;
+
+ class_<Tango::MultiClassAttribute, boost::noncopyable>("MultiClassAttribute", no_init)
+ .def("get_attr",
+ (Tango::Attr& (Tango::MultiClassAttribute::*) (const std::string &))
+ get_attr_,
+ return_value_policy<reference_existing_object>())
+ .def("remove_attr",
+ (void (Tango::MultiClassAttribute::*) (const std::string &, const std::string &))
+ remove_attr_)
+ .def("get_attr_list", &Tango::MultiClassAttribute::get_attr_list,
+ return_value_policy<reference_existing_object>())
+ ;
+}
--
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