[pytango] 24/37: Implement TANGO enumeration type (client)
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 ac521b8a5830be2384ef223bdebf0e393b21ee3d
Author: Jose Tiago Coutinho Macara <tiago.coutinho at esrf.fr>
Date: Fri Dec 11 14:41:27 2015 +0100
Implement TANGO enumeration type (client)
---
src/boost/cpp/tango_numpy.h | 1 +
src/boost/cpp/tgutils.h | 21 +++++++++++++++++++--
src/boost/python/__init__.py | 4 ++--
src/boost/python/base_types.py | 1 +
4 files changed, 23 insertions(+), 4 deletions(-)
diff --git a/src/boost/cpp/tango_numpy.h b/src/boost/cpp/tango_numpy.h
index 56f29e5..13f5aa2 100644
--- a/src/boost/cpp/tango_numpy.h
+++ b/src/boost/cpp/tango_numpy.h
@@ -59,6 +59,7 @@
//Unassigned: Tango::DEV_ENCODED
DEF_TANGO2NUMPY(Tango::DEV_LONG64, NPY_INT64 );
DEF_TANGO2NUMPY(Tango::DEV_ULONG64, NPY_UINT64 );
+ DEF_TANGO2NUMPY(Tango::DEV_ENUM, NPY_INT16 );
/// @name Conversion from a Tango array type name to the scalar numpy name
/// For types like DEVVAR_DOUBLEARRAY. This is ended with ARRAY, except
diff --git a/src/boost/cpp/tgutils.h b/src/boost/cpp/tgutils.h
index 1cab669..ea8d5fd 100644
--- a/src/boost/cpp/tgutils.h
+++ b/src/boost/cpp/tgutils.h
@@ -66,18 +66,24 @@ struct tango_name2scalarname
enum {value = Tango:: scalarname}; \
};
-#define DEF_TANGO_NAME2TYPE(tangoname, tangotype) \
+#define DEF_TANGO_NAME2TYPE__(tangoname, tangotype) \
template<> \
struct tango_name2type<Tango:: tangoname> \
{ \
typedef tangotype Type; \
- }; \
+ };
+
+#define DEF_TANGO_TYPE2NAME__(tangotype, tangoname) \
template<> \
struct tango_type2name<tangotype> \
{ \
enum {value = Tango:: tangoname}; \
};
+#define DEF_TANGO_NAME2TYPE(tangoname, tangotype) \
+ DEF_TANGO_NAME2TYPE__(tangoname, tangotype) \
+ DEF_TANGO_TYPE2NAME__(tangotype, tangoname)
+
#define DEF_TANGO_NAME2ARRAY(tangoname, tangotype, simple) \
template<> \
struct tango_name2arraytype<Tango:: tangoname> \
@@ -109,6 +115,11 @@ TSD_SIMPLE__( DEV_STATE, Tango::DevState , Tango::DevVarStateAr
TSD_SIMPLE__( DEV_ENCODED, Tango::DevEncoded, Tango::DevVarEncodedArray );
TSD_SIMPLE__( DEV_PIPE_BLOB, Tango::DevPipeBlob, void );
+// since enum type is implemented as a short we cannot use tango_type2name because
+// it will conflict with the DevShort template declaration
+DEF_TANGO_NAME2TYPE__( DEV_ENUM, Tango::DevEnum);
+DEF_TANGO_NAME2ARRAY( DEV_ENUM, Tango::DevVarShortArray, Tango::DevEnum);
+
TSD_SIMPLE__( DEV_VOID, void , void);
TSD_ARRAY__( DEVVAR_CHARARRAY, _CORBA_Octet , Tango::DevVarCharArray);
@@ -188,6 +199,7 @@ DEF_TANGO_SCALAR_ARRAY_NAMES( DEV_STATE, DEVVAR_STATEARRAY );
__TANGO_DEPEND_ON_TYPE_AUX_ID(DEV_ULONG64, DOIT) \
__TANGO_DEPEND_ON_TYPE_AUX_ID(DEV_STATE, DOIT) \
__TANGO_DEPEND_ON_TYPE_AUX_ID(DEV_ENCODED, DOIT) \
+ __TANGO_DEPEND_ON_TYPE_AUX_ID(DEV_ENUM, DOIT) \
default: \
assert(false); \
} } else (void)0
@@ -207,6 +219,7 @@ DEF_TANGO_SCALAR_ARRAY_NAMES( DEV_STATE, DEVVAR_STATEARRAY );
__TANGO_DEPEND_ON_TYPE_AUX_NAME(DEV_ULONG64, DOIT) \
__TANGO_DEPEND_ON_TYPE_AUX_NAME(DEV_STATE, DOIT) \
__TANGO_DEPEND_ON_TYPE_AUX_NAME(DEV_ENCODED, DOIT) \
+ __TANGO_DEPEND_ON_TYPE_AUX_NAME(DEV_ENUM, DOIT) \
default: \
assert(false); \
} } else (void)0
@@ -251,6 +264,7 @@ DEF_TANGO_SCALAR_ARRAY_NAMES( DEV_STATE, DEVVAR_STATEARRAY );
/* __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) \
+ __TANGO_DEPEND_ON_TYPE_AUX_ID(DEV_ENUM, DOIT_SIMPLE) \
default: \
assert(false); \
} } else (void)0
@@ -308,6 +322,7 @@ DEF_TANGO_SCALAR_ARRAY_NAMES( DEV_STATE, DEVVAR_STATEARRAY );
/* __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) \
+ __TANGO_DEPEND_ON_TYPE_AUX_NAME(DEV_ENUM, DOIT_SIMPLE) \
default: \
assert(false); \
} } else (void)0
@@ -329,6 +344,7 @@ DEF_TANGO_SCALAR_ARRAY_NAMES( DEV_STATE, DEVVAR_STATEARRAY );
__TANGO_DEPEND_ON_TYPE_AUX_ID(DEV_UCHAR, DOIT) \
__TANGO_DEPEND_ON_TYPE_AUX_ID(DEV_LONG64, DOIT) \
__TANGO_DEPEND_ON_TYPE_AUX_ID(DEV_ULONG64, DOIT) \
+ __TANGO_DEPEND_ON_TYPE_AUX_ID(DEV_ENUM, DOIT) \
default: \
assert(false); \
} } else (void)0
@@ -344,6 +360,7 @@ DEF_TANGO_SCALAR_ARRAY_NAMES( DEV_STATE, DEVVAR_STATEARRAY );
__TANGO_DEPEND_ON_TYPE_AUX_NAME(DEV_UCHAR, DOIT) \
__TANGO_DEPEND_ON_TYPE_AUX_NAME(DEV_LONG64, DOIT) \
__TANGO_DEPEND_ON_TYPE_AUX_NAME(DEV_ULONG64, DOIT) \
+ __TANGO_DEPEND_ON_TYPE_AUX_NAME(DEV_ENUM, DOIT) \
default: \
assert(false); \
} } else (void)0
diff --git a/src/boost/python/__init__.py b/src/boost/python/__init__.py
index 83bb745..01b20e1 100644
--- a/src/boost/python/__init__.py
+++ b/src/boost/python/__init__.py
@@ -35,7 +35,7 @@ __all__ = [ 'AccessControlType', 'ApiUtil', 'ArchiveEventInfo',
'DbHistoryList', 'DbServerInfo', 'DbServerData', 'DebugIt', 'DevBoolean', 'DevCommandInfo',
'DevDouble', 'DevEncoded', 'DevError', 'DevFailed', 'DevFloat', 'DevInt',
'DevLong', 'DevLong64', 'DevShort', 'DevSource', 'DevState', 'DevString',
-'DevUChar', 'DevULong', 'DevULong64', 'DevUShort', 'DevVarBooleanArray',
+'DevUChar', 'DevULong', 'DevULong64', 'DevUShort', 'DevEnum', 'DevVarBooleanArray',
'DevVarCharArray', 'DevVarDoubleArray', 'DevVarDoubleStringArray',
'DevVarFloatArray', 'DevVarLong64Array', 'DevVarLongArray',
'DevVarLongStringArray', 'DevVarShortArray', 'DevVarStringArray',
@@ -133,7 +133,7 @@ from ._PyTango import (AccessControlType, ApiUtil, ArchiveEventInfo,
DbHistoryList, DbServerInfo, DbServerData, DevBoolean, DevCommandInfo, DevDouble,
DevEncoded, DevError, DevFailed, DevFloat, DevInt, DevLong, DevLong64,
DevShort, DevSource, DevState, DevString, DevUChar, DevULong, DevULong64,
- DevUShort, DevVarBooleanArray, DevVarCharArray, DevVarDoubleArray,
+ DevUShort, DevEnum, DevVarBooleanArray, DevVarCharArray, DevVarDoubleArray,
DevVarDoubleStringArray, DevVarFloatArray, DevVarLong64Array,
DevVarLongArray, DevVarLongStringArray, DevVarShortArray, DevVarStringArray,
DevVarULong64Array, DevVarULongArray, DevVarUShortArray, DevVoid,
diff --git a/src/boost/python/base_types.py b/src/boost/python/base_types.py
index d49cc20..c35c06f 100644
--- a/src/boost/python/base_types.py
+++ b/src/boost/python/base_types.py
@@ -357,6 +357,7 @@ def __doc_base_types():
- DevVarULong64Array
- DevInt
- DevEncoded
+ - DevEnum
""" )
document_enum("LockerLanguage", """
--
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