diff --git a/include/AmptekHardwareInterface.h b/include/AmptekHardwareInterface.h index 9527ee2ac66c9ce8edd05fcfc7d4710a67171f7f..2bbdfb7e087d1da4ae2fde8253daced1f518df0c 100644 --- a/include/AmptekHardwareInterface.h +++ b/include/AmptekHardwareInterface.h @@ -48,8 +48,10 @@ public: bool ResetListModeTimer(); bool DisableListMode(); - bool startBuffering(); - bool stopBuffering(); + bool startHardwareBuffering(); + bool stopHardwareBuffering(); + bool BufferSpectrum(uint16_t index); + bool BufferAndClearSpectrum(uint16_t index); std::pair<AmptekSpectrum, AmptekStatus> GetBufferedSpectrum(size_t id); bool StartCommtestStreaming(uint16_t min_channel,uint16_t max_channel, diff --git a/include/AmptekSimulatorConnectionHandler.h b/include/AmptekSimulatorConnectionHandler.h index 4f78556f332ca96262fe4765658b056873de515d..b1823e4a2d2714345409de30c7116867eaa34669 100644 --- a/include/AmptekSimulatorConnectionHandler.h +++ b/include/AmptekSimulatorConnectionHandler.h @@ -15,6 +15,7 @@ public: private: void readConfig(char* configs); + void initConfigs(); std::string buildConfigResponse(char* config_names); void createStatusData(byte* buffer); void createSpectrumData(byte* buffer); diff --git a/include/packet.h b/include/packet.h index 92f0d0e20b9e180e0488c677dc3cc38239cd87fc..e7989eee67d82b4d158f1ee778b794dc3fbd5731 100644 --- a/include/packet.h +++ b/include/packet.h @@ -111,24 +111,24 @@ enum PID2_SUBTYPE_COMMTEST_RESPONSE{ enum PID2_SUBTYPE_ACK{ - DP5_P2_ACK_OK = 0x00, - DP5_P2_ACK_SYNC_ERR = 0x01, - DP5_P2_ACK_PID_ERR = 0x02, - DP5_P2_ACK_LEN_ERR = 0x03, - DP5_P2_ACK_CHECKSUM_ERR = 0x04, - DP5_P2_ACK_BADPARAM_ERR = 0x05, - DP5_P2_ACK_BADHEX_ERR = 0x06, - DP5_P2_ACK_BADCMD_ERR = 0x07, - DP5_P2_ACK_FPGA_ERR = 0x08, - DP5_P2_ACK_CP2201_ERR = 0x09, - DP5_P2_ACK_SCOPE_ERR = 0x0A, - DP5_P2_ACK_PC5_ERR = 0x0B, - DP5_P2_ACK_OK_SHARING = 0x0C, - DP5_P2_ACK_BUSY_ERR = 0x0D, - DP5_P2_ACK_I2C_ERR = 0x0E, - DP5_P2_ACK_OK_FPGAADDR = 0x0F, - DP5_P2_ACK_VERSION_ERR = 0x10, - DP5_P2_ACK_CALIB_ERR = 0x11 + DP5_P2_ACK_OK = 0x00, + DP5_P2_ACK_SYNC_ERR = 0x01, + DP5_P2_ACK_PID_ERR = 0x02, + DP5_P2_ACK_LEN_ERR = 0x03, + DP5_P2_ACK_CHECKSUM_ERR = 0x04, + DP5_P2_ACK_BADPARAM_ERR = 0x05, + DP5_P2_ACK_BADHEX_ERR = 0x06, + DP5_P2_ACK_BADCMD_ERR = 0x07, + DP5_P2_ACK_FPGA_ERR = 0x08, + DP5_P2_ACK_CP2201_ERR = 0x09, + DP5_P2_ACK_SCOPE_ERR = 0x0A, + DP5_P2_ACK_PC5_ERR = 0x0B, + DP5_P2_ACK_OK_SHARING = 0x0C, + DP5_P2_ACK_BUSY_ERR = 0x0D, + DP5_P2_ACK_I2C_ERR = 0x0E, + DP5_P2_ACK_OK_FPGAADDR = 0x0F, + DP5_P2_ACK_VERSION_ERR = 0x10, + DP5_P2_ACK_CALIB_ERR = 0x11 }; class AmptekException : public std::runtime_error diff --git a/python/amptek_hardware_interface/AmptekHardwareInterface.i b/python/amptek_hardware_interface/AmptekHardwareInterface.i index 7ab124965208cc1e591e353ad262bca89b083a37..a7dd418adfd080e8a228251b605830e37acb65db 100644 --- a/python/amptek_hardware_interface/AmptekHardwareInterface.i +++ b/python/amptek_hardware_interface/AmptekHardwareInterface.i @@ -22,6 +22,7 @@ namespace std { %template(StringVector) vector<std::string>; %template(DoubleVector) vector<double>; %template(UIntVector) vector<unsigned int>; + %template(AmptekDataPair) pair<AmptekSpectrum, AmptekStatus>; } %except { try { diff --git a/python/amptek_hardware_interface/AmptekHardwareInterface.py b/python/amptek_hardware_interface/AmptekHardwareInterface.py index d1f28649775f8c4e509d356c93bb6bbdf2896052..aa30c89cedba04a1c994989bbeb67c4a074017bc 100644 --- a/python/amptek_hardware_interface/AmptekHardwareInterface.py +++ b/python/amptek_hardware_interface/AmptekHardwareInterface.py @@ -1,22 +1,15 @@ # This file was automatically generated by SWIG (http://www.swig.org). -# Version 3.0.12 +# Version 3.0.8 # # Do not make changes to this file unless you know what you are doing--modify # the SWIG interface file instead. -from sys import version_info as _swig_python_version_info -if _swig_python_version_info >= (2, 7, 0): - def swig_import_helper(): - import importlib - pkg = __name__.rpartition('.')[0] - mname = '.'.join((pkg, '_AmptekHardwareInterface')).lstrip('.') - try: - return importlib.import_module(mname) - except ImportError: - return importlib.import_module('_AmptekHardwareInterface') - _AmptekHardwareInterface = swig_import_helper() - del swig_import_helper -elif _swig_python_version_info >= (2, 6, 0): + + + + +from sys import version_info +if version_info >= (2, 6, 0): def swig_import_helper(): from os.path import dirname import imp @@ -26,27 +19,22 @@ elif _swig_python_version_info >= (2, 6, 0): except ImportError: import _AmptekHardwareInterface return _AmptekHardwareInterface - try: - _mod = imp.load_module('_AmptekHardwareInterface', fp, pathname, description) - finally: - if fp is not None: + if fp is not None: + try: + _mod = imp.load_module('_AmptekHardwareInterface', fp, pathname, description) + finally: fp.close() - return _mod + return _mod _AmptekHardwareInterface = swig_import_helper() del swig_import_helper else: import _AmptekHardwareInterface -del _swig_python_version_info - +del version_info try: _swig_property = property except NameError: pass # Python < 2.2 doesn't have 'property'. -try: - import builtins as __builtin__ -except ImportError: - import __builtin__ def _swig_setattr_nondynamic(self, class_type, name, value, static=1): if (name == "thisown"): @@ -68,22 +56,37 @@ def _swig_setattr(self, class_type, name, value): return _swig_setattr_nondynamic(self, class_type, name, value, 0) -def _swig_getattr(self, class_type, name): +def _swig_getattr_nondynamic(self, class_type, name, static=1): if (name == "thisown"): return self.this.own() method = class_type.__swig_getmethods__.get(name, None) if method: return method(self) - raise AttributeError("'%s' object has no attribute '%s'" % (class_type.__name__, name)) + if (not static): + return object.__getattr__(self, name) + else: + raise AttributeError(name) + +def _swig_getattr(self, class_type, name): + return _swig_getattr_nondynamic(self, class_type, name, 0) def _swig_repr(self): try: strthis = "proxy of " + self.this.__repr__() - except __builtin__.Exception: + except Exception: strthis = "" return "<%s.%s; %s >" % (self.__class__.__module__, self.__class__.__name__, strthis,) +try: + _object = object + _newclass = 1 +except AttributeError: + class _object: + pass + _newclass = 0 + + def _swig_setattr_nondynamic_method(set): def set_attr(self, name, value): @@ -236,7 +239,7 @@ class IntVector(object): this = _AmptekHardwareInterface.new_IntVector(*args) try: self.this.append(this) - except __builtin__.Exception: + except Exception: self.this = this def push_back(self, x): @@ -346,7 +349,7 @@ class StringVector(object): this = _AmptekHardwareInterface.new_StringVector(*args) try: self.this.append(this) - except __builtin__.Exception: + except Exception: self.this = this def push_back(self, x): @@ -456,7 +459,7 @@ class DoubleVector(object): this = _AmptekHardwareInterface.new_DoubleVector(*args) try: self.this.append(this) - except __builtin__.Exception: + except Exception: self.this = this def push_back(self, x): @@ -566,7 +569,7 @@ class UIntVector(object): this = _AmptekHardwareInterface.new_UIntVector(*args) try: self.this.append(this) - except __builtin__.Exception: + except Exception: self.this = this def push_back(self, x): @@ -597,10 +600,51 @@ class UIntVector(object): UIntVector_swigregister = _AmptekHardwareInterface.UIntVector_swigregister UIntVector_swigregister(UIntVector) +class AmptekDataPair(object): + thisown = _swig_property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc='The membership flag') + __repr__ = _swig_repr + + def __init__(self, *args): + this = _AmptekHardwareInterface.new_AmptekDataPair(*args) + try: + self.this.append(this) + except Exception: + self.this = this + first = _swig_property(_AmptekHardwareInterface.AmptekDataPair_first_get, _AmptekHardwareInterface.AmptekDataPair_first_set) + second = _swig_property(_AmptekHardwareInterface.AmptekDataPair_second_get, _AmptekHardwareInterface.AmptekDataPair_second_set) + def __len__(self): + return 2 + def __repr__(self): + return str((self.first, self.second)) + def __getitem__(self, index): + if not (index % 2): + return self.first + else: + return self.second + def __setitem__(self, index, val): + if not (index % 2): + self.first = val + else: + self.second = val + __swig_destroy__ = _AmptekHardwareInterface.delete_AmptekDataPair + __del__ = lambda self: None +AmptekDataPair_swigregister = _AmptekHardwareInterface.AmptekDataPair_swigregister +AmptekDataPair_swigregister(AmptekDataPair) + + +_AmptekHardwareInterface.SPECLEN_swigconstant(_AmptekHardwareInterface) SPECLEN = _AmptekHardwareInterface.SPECLEN + +_AmptekHardwareInterface.NOT_CONNECTED_swigconstant(_AmptekHardwareInterface) NOT_CONNECTED = _AmptekHardwareInterface.NOT_CONNECTED + +_AmptekHardwareInterface.ON_swigconstant(_AmptekHardwareInterface) ON = _AmptekHardwareInterface.ON + +_AmptekHardwareInterface.RECORDING_swigconstant(_AmptekHardwareInterface) RECORDING = _AmptekHardwareInterface.RECORDING + +_AmptekHardwareInterface.ERROR_swigconstant(_AmptekHardwareInterface) ERROR = _AmptekHardwareInterface.ERROR class AmptekHardwareInterface(object): thisown = _swig_property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc='The membership flag') @@ -610,7 +654,7 @@ class AmptekHardwareInterface(object): this = _AmptekHardwareInterface.new_AmptekHardwareInterface() try: self.this.append(this) - except __builtin__.Exception: + except Exception: self.this = this __swig_destroy__ = _AmptekHardwareInterface.delete_AmptekHardwareInterface __del__ = lambda self: None @@ -663,11 +707,17 @@ class AmptekHardwareInterface(object): def DisableListMode(self): return _AmptekHardwareInterface.AmptekHardwareInterface_DisableListMode(self) - def startBuffering(self): - return _AmptekHardwareInterface.AmptekHardwareInterface_startBuffering(self) + def startHardwareBuffering(self): + return _AmptekHardwareInterface.AmptekHardwareInterface_startHardwareBuffering(self) + + def stopHardwareBuffering(self): + return _AmptekHardwareInterface.AmptekHardwareInterface_stopHardwareBuffering(self) - def stopBuffering(self): - return _AmptekHardwareInterface.AmptekHardwareInterface_stopBuffering(self) + def BufferSpectrum(self, index): + return _AmptekHardwareInterface.AmptekHardwareInterface_BufferSpectrum(self, index) + + def BufferAndClearSpectrum(self, index): + return _AmptekHardwareInterface.AmptekHardwareInterface_BufferAndClearSpectrum(self, index) def GetBufferedSpectrum(self, id): return _AmptekHardwareInterface.AmptekHardwareInterface_GetBufferedSpectrum(self, id) @@ -689,6 +739,8 @@ class AmptekHardwareInterface(object): AmptekHardwareInterface_swigregister = _AmptekHardwareInterface.AmptekHardwareInterface_swigregister AmptekHardwareInterface_swigregister(AmptekHardwareInterface) + +_AmptekHardwareInterface.STATUS_SIZE_swigconstant(_AmptekHardwareInterface) STATUS_SIZE = _AmptekHardwareInterface.STATUS_SIZE class AmptekStatus(object): thisown = _swig_property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc='The membership flag') @@ -698,7 +750,7 @@ class AmptekStatus(object): this = _AmptekHardwareInterface.new_AmptekStatus(*args) try: self.this.append(this) - except __builtin__.Exception: + except Exception: self.this = this __swig_destroy__ = _AmptekHardwareInterface.delete_AmptekStatus __del__ = lambda self: None @@ -800,7 +852,7 @@ class AmptekSpectrum(object): this = _AmptekHardwareInterface.new_AmptekSpectrum(*args) try: self.this.append(this) - except __builtin__.Exception: + except Exception: self.this = this def AgeMillis(self): diff --git a/python/amptek_hardware_interface/AmptekHardwareInterface_wrap.cpp b/python/amptek_hardware_interface/AmptekHardwareInterface_wrap.cpp index 97b7eb0d1f6018a36d4b58ace1b6c595f8129e84..b8a4bf1fcc4c3f1642634c925cee73b1cea98a62 100644 --- a/python/amptek_hardware_interface/AmptekHardwareInterface_wrap.cpp +++ b/python/amptek_hardware_interface/AmptekHardwareInterface_wrap.cpp @@ -1,6 +1,6 @@ /* ---------------------------------------------------------------------------- * This file was automatically generated by SWIG (http://www.swig.org). - * Version 3.0.12 + * Version 3.0.8 * * This file is not intended to be easily readable and contains a number of * coding conventions designed to improve portability and efficiency. Do not make @@ -106,11 +106,9 @@ template <typename T> T SwigValueInit() { #endif /* exporting methods */ -#if defined(__GNUC__) -# if (__GNUC__ >= 4) || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4) -# ifndef GCC_HASCLASSVISIBILITY -# define GCC_HASCLASSVISIBILITY -# endif +#if (__GNUC__ >= 4) || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4) +# ifndef GCC_HASCLASSVISIBILITY +# define GCC_HASCLASSVISIBILITY # endif #endif @@ -670,16 +668,16 @@ SWIG_UnpackData(const char *c, void *ptr, size_t sz) { char d = *(c++); unsigned char uu; if ((d >= '0') && (d <= '9')) - uu = (unsigned char)((d - '0') << 4); + uu = ((d - '0') << 4); else if ((d >= 'a') && (d <= 'f')) - uu = (unsigned char)((d - ('a'-10)) << 4); + uu = ((d - ('a'-10)) << 4); else return (char *) 0; d = *(c++); if ((d >= '0') && (d <= '9')) - uu |= (unsigned char)(d - '0'); + uu |= (d - '0'); else if ((d >= 'a') && (d <= 'f')) - uu |= (unsigned char)(d - ('a'-10)); + uu |= (d - ('a'-10)); else return (char *) 0; *u = uu; @@ -862,6 +860,10 @@ PyString_FromFormat(const char *fmt, ...) { } #endif +/* Add PyObject_Del for old Pythons */ +#if PY_VERSION_HEX < 0x01060000 +# define PyObject_Del(op) PyMem_DEL((op)) +#endif #ifndef PyObject_DEL # define PyObject_DEL PyObject_Del #endif @@ -976,7 +978,6 @@ typedef destructor freefunc; #if PY_VERSION_HEX < 0x03020000 #define PyDescr_TYPE(x) (((PyDescrObject *)(x))->d_type) #define PyDescr_NAME(x) (((PyDescrObject *)(x))->d_name) -#define Py_hash_t long #endif /* ----------------------------------------------------------------------------- @@ -1925,6 +1926,7 @@ SwigPyObject_TypeOnce(void) { static int type_init = 0; if (!type_init) { const PyTypeObject tmp = { + /* PyObject header changed in Python 3 */ #if PY_VERSION_HEX >= 0x03000000 PyVarObject_HEAD_INIT(NULL, 0) #else @@ -1935,7 +1937,7 @@ SwigPyObject_TypeOnce(void) { sizeof(SwigPyObject), /* tp_basicsize */ 0, /* tp_itemsize */ (destructor)SwigPyObject_dealloc, /* tp_dealloc */ - 0, /* tp_print */ + 0, /* tp_print */ #if PY_VERSION_HEX < 0x02020000 (getattrfunc)SwigPyObject_getattr, /* tp_getattr */ #else @@ -1943,7 +1945,7 @@ SwigPyObject_TypeOnce(void) { #endif (setattrfunc)0, /* tp_setattr */ #if PY_VERSION_HEX >= 0x03000000 - 0, /* tp_reserved in 3.0.1, tp_compare in 3.0.0 but not used */ + 0, /* tp_reserved in 3.0.1, tp_compare in 3.0.0 but not used */ #else (cmpfunc)SwigPyObject_compare, /* tp_compare */ #endif @@ -1953,7 +1955,7 @@ SwigPyObject_TypeOnce(void) { 0, /* tp_as_mapping */ (hashfunc)0, /* tp_hash */ (ternaryfunc)0, /* tp_call */ - 0, /* tp_str */ + 0, /* tp_str */ PyObject_GenericGetAttr, /* tp_getattro */ 0, /* tp_setattro */ 0, /* tp_as_buffer */ @@ -2116,6 +2118,7 @@ SwigPyPacked_TypeOnce(void) { static int type_init = 0; if (!type_init) { const PyTypeObject tmp = { + /* PyObject header changed in Python 3 */ #if PY_VERSION_HEX>=0x03000000 PyVarObject_HEAD_INIT(NULL, 0) #else @@ -3013,31 +3016,33 @@ SWIG_Python_NonDynamicSetAttr(PyObject *obj, PyObject *name, PyObject *value) { #define SWIGTYPE_p_byte swig_types[4] #define SWIGTYPE_p_char swig_types[5] #define SWIGTYPE_p_difference_type swig_types[6] -#define SWIGTYPE_p_int swig_types[7] -#define SWIGTYPE_p_long_long swig_types[8] -#define SWIGTYPE_p_p_PyObject swig_types[9] -#define SWIGTYPE_p_short swig_types[10] -#define SWIGTYPE_p_signed_char swig_types[11] -#define SWIGTYPE_p_size_type swig_types[12] -#define SWIGTYPE_p_std__allocatorT_double_t swig_types[13] -#define SWIGTYPE_p_std__allocatorT_int_t swig_types[14] -#define SWIGTYPE_p_std__allocatorT_std__string_t swig_types[15] -#define SWIGTYPE_p_std__allocatorT_unsigned_int_t swig_types[16] -#define SWIGTYPE_p_std__chrono__time_pointT_std__chrono__system_clock_t swig_types[17] -#define SWIGTYPE_p_std__invalid_argument swig_types[18] -#define SWIGTYPE_p_std__pairT_AmptekSpectrum_AmptekStatus_t swig_types[19] -#define SWIGTYPE_p_std__vectorT_double_std__allocatorT_double_t_t swig_types[20] -#define SWIGTYPE_p_std__vectorT_int_std__allocatorT_int_t_t swig_types[21] -#define SWIGTYPE_p_std__vectorT_std__string_std__allocatorT_std__string_t_t swig_types[22] -#define SWIGTYPE_p_std__vectorT_unsigned_int_std__allocatorT_unsigned_int_t_t swig_types[23] -#define SWIGTYPE_p_swig__SwigPyIterator swig_types[24] -#define SWIGTYPE_p_unsigned_char swig_types[25] -#define SWIGTYPE_p_unsigned_int swig_types[26] -#define SWIGTYPE_p_unsigned_long_long swig_types[27] -#define SWIGTYPE_p_unsigned_short swig_types[28] -#define SWIGTYPE_p_value_type swig_types[29] -static swig_type_info *swig_types[31]; -static swig_module_info swig_module = {swig_types, 30, 0, 0, 0, 0}; +#define SWIGTYPE_p_first_type swig_types[7] +#define SWIGTYPE_p_int swig_types[8] +#define SWIGTYPE_p_long_long swig_types[9] +#define SWIGTYPE_p_p_PyObject swig_types[10] +#define SWIGTYPE_p_second_type swig_types[11] +#define SWIGTYPE_p_short swig_types[12] +#define SWIGTYPE_p_signed_char swig_types[13] +#define SWIGTYPE_p_size_type swig_types[14] +#define SWIGTYPE_p_std__allocatorT_double_t swig_types[15] +#define SWIGTYPE_p_std__allocatorT_int_t swig_types[16] +#define SWIGTYPE_p_std__allocatorT_std__string_t swig_types[17] +#define SWIGTYPE_p_std__allocatorT_unsigned_int_t swig_types[18] +#define SWIGTYPE_p_std__chrono__time_pointT_std__chrono__system_clock_t swig_types[19] +#define SWIGTYPE_p_std__invalid_argument swig_types[20] +#define SWIGTYPE_p_std__pairT_AmptekSpectrum_AmptekStatus_t swig_types[21] +#define SWIGTYPE_p_std__vectorT_double_std__allocatorT_double_t_t swig_types[22] +#define SWIGTYPE_p_std__vectorT_int_std__allocatorT_int_t_t swig_types[23] +#define SWIGTYPE_p_std__vectorT_std__string_std__allocatorT_std__string_t_t swig_types[24] +#define SWIGTYPE_p_std__vectorT_unsigned_int_std__allocatorT_unsigned_int_t_t swig_types[25] +#define SWIGTYPE_p_swig__SwigPyIterator swig_types[26] +#define SWIGTYPE_p_unsigned_char swig_types[27] +#define SWIGTYPE_p_unsigned_int swig_types[28] +#define SWIGTYPE_p_unsigned_long_long swig_types[29] +#define SWIGTYPE_p_unsigned_short swig_types[30] +#define SWIGTYPE_p_value_type swig_types[31] +static swig_type_info *swig_types[33]; +static swig_module_info swig_module = {swig_types, 32, 0, 0, 0, 0}; #define SWIG_TypeQuery(name) SWIG_TypeQueryModule(&swig_module, &swig_module, name) #define SWIG_MangledTypeQuery(name) SWIG_MangledTypeQueryModule(&swig_module, &swig_module, name) @@ -3064,7 +3069,7 @@ static swig_module_info swig_module = {swig_types, 30, 0, 0, 0, 0}; #endif #define SWIG_name "_AmptekHardwareInterface" -#define SWIGVERSION 0x030012 +#define SWIGVERSION 0x030008 #define SWIG_VERSION SWIGVERSION @@ -3175,7 +3180,6 @@ namespace swig { #endif -#include <typeinfo> #include <stdexcept> @@ -3325,7 +3329,7 @@ SWIG_AsVal_double (PyObject *obj, double *val) return SWIG_OK; #if PY_VERSION_HEX < 0x03000000 } else if (PyInt_Check(obj)) { - if (val) *val = (double) PyInt_AsLong(obj); + if (val) *val = PyInt_AsLong(obj); return SWIG_OK; #endif } else if (PyLong_Check(obj)) { @@ -3446,109 +3450,23 @@ SWIG_AsVal_unsigned_SS_long (PyObject *obj, unsigned long *val) } -#include <limits.h> -#if !defined(SWIG_NO_LLONG_MAX) -# if !defined(LLONG_MAX) && defined(__GNUC__) && defined (__LONG_LONG_MAX__) -# define LLONG_MAX __LONG_LONG_MAX__ -# define LLONG_MIN (-LLONG_MAX - 1LL) -# define ULLONG_MAX (LLONG_MAX * 2ULL + 1ULL) -# endif -#endif - - -#if defined(LLONG_MAX) && !defined(SWIG_LONG_LONG_AVAILABLE) -# define SWIG_LONG_LONG_AVAILABLE -#endif - - -#ifdef SWIG_LONG_LONG_AVAILABLE -SWIGINTERN int -SWIG_AsVal_unsigned_SS_long_SS_long (PyObject *obj, unsigned long long *val) -{ - int res = SWIG_TypeError; - if (PyLong_Check(obj)) { - unsigned long long v = PyLong_AsUnsignedLongLong(obj); - if (!PyErr_Occurred()) { - if (val) *val = v; - return SWIG_OK; - } else { - PyErr_Clear(); - res = SWIG_OverflowError; - } - } else { - unsigned long v; - res = SWIG_AsVal_unsigned_SS_long (obj,&v); - if (SWIG_IsOK(res)) { - if (val) *val = v; - return res; - } - } -#ifdef SWIG_PYTHON_CAST_MODE - { - const double mant_max = 1LL << DBL_MANT_DIG; - double d; - res = SWIG_AsVal_double (obj,&d); - if (SWIG_IsOK(res) && !SWIG_CanCastAsInteger(&d, 0, mant_max)) - return SWIG_OverflowError; - if (SWIG_IsOK(res) && SWIG_CanCastAsInteger(&d, 0, mant_max)) { - if (val) *val = (unsigned long long)(d); - return SWIG_AddCast(res); - } - res = SWIG_TypeError; - } -#endif - return res; -} -#endif - - SWIGINTERNINLINE int SWIG_AsVal_size_t (PyObject * obj, size_t *val) { - int res = SWIG_TypeError; -#ifdef SWIG_LONG_LONG_AVAILABLE - if (sizeof(size_t) <= sizeof(unsigned long)) { -#endif - unsigned long v; - res = SWIG_AsVal_unsigned_SS_long (obj, val ? &v : 0); - if (SWIG_IsOK(res) && val) *val = static_cast< size_t >(v); -#ifdef SWIG_LONG_LONG_AVAILABLE - } else if (sizeof(size_t) <= sizeof(unsigned long long)) { - unsigned long long v; - res = SWIG_AsVal_unsigned_SS_long_SS_long (obj, val ? &v : 0); - if (SWIG_IsOK(res) && val) *val = static_cast< size_t >(v); - } -#endif + unsigned long v; + int res = SWIG_AsVal_unsigned_SS_long (obj, val ? &v : 0); + if (SWIG_IsOK(res) && val) *val = static_cast< size_t >(v); return res; } - #define SWIG_From_long PyInt_FromLong - - -#ifdef SWIG_LONG_LONG_AVAILABLE -SWIGINTERNINLINE PyObject* -SWIG_From_long_SS_long (long long value) -{ - return ((value < LONG_MIN) || (value > LONG_MAX)) ? - PyLong_FromLongLong(value) : PyInt_FromLong(static_cast< long >(value)); -} -#endif + #define SWIG_From_long PyLong_FromLong SWIGINTERNINLINE PyObject * SWIG_From_ptrdiff_t (ptrdiff_t value) { -#ifdef SWIG_LONG_LONG_AVAILABLE - if (sizeof(ptrdiff_t) <= sizeof(long)) { -#endif - return SWIG_From_long (static_cast< long >(value)); -#ifdef SWIG_LONG_LONG_AVAILABLE - } else { - /* assume sizeof(ptrdiff_t) <= sizeof(long long) */ - return SWIG_From_long_SS_long (static_cast< long long >(value)); - } -#endif + return SWIG_From_long (static_cast< long >(value)); } @@ -3602,65 +3520,12 @@ SWIG_AsVal_long (PyObject *obj, long* val) } -#ifdef SWIG_LONG_LONG_AVAILABLE -SWIGINTERN int -SWIG_AsVal_long_SS_long (PyObject *obj, long long *val) -{ - int res = SWIG_TypeError; - if (PyLong_Check(obj)) { - long long v = PyLong_AsLongLong(obj); - if (!PyErr_Occurred()) { - if (val) *val = v; - return SWIG_OK; - } else { - PyErr_Clear(); - res = SWIG_OverflowError; - } - } else { - long v; - res = SWIG_AsVal_long (obj,&v); - if (SWIG_IsOK(res)) { - if (val) *val = v; - return res; - } - } -#ifdef SWIG_PYTHON_CAST_MODE - { - const double mant_max = 1LL << DBL_MANT_DIG; - const double mant_min = -mant_max; - double d; - res = SWIG_AsVal_double (obj,&d); - if (SWIG_IsOK(res) && !SWIG_CanCastAsInteger(&d, mant_min, mant_max)) - return SWIG_OverflowError; - if (SWIG_IsOK(res) && SWIG_CanCastAsInteger(&d, mant_min, mant_max)) { - if (val) *val = (long long)(d); - return SWIG_AddCast(res); - } - res = SWIG_TypeError; - } -#endif - return res; -} -#endif - - SWIGINTERNINLINE int SWIG_AsVal_ptrdiff_t (PyObject * obj, ptrdiff_t *val) { - int res = SWIG_TypeError; -#ifdef SWIG_LONG_LONG_AVAILABLE - if (sizeof(ptrdiff_t) <= sizeof(long)) { -#endif - long v; - res = SWIG_AsVal_long (obj, val ? &v : 0); - if (SWIG_IsOK(res) && val) *val = static_cast< ptrdiff_t >(v); -#ifdef SWIG_LONG_LONG_AVAILABLE - } else if (sizeof(ptrdiff_t) <= sizeof(long long)) { - long long v; - res = SWIG_AsVal_long_SS_long (obj, val ? &v : 0); - if (SWIG_IsOK(res) && val) *val = static_cast< ptrdiff_t >(v); - } -#endif + long v; + int res = SWIG_AsVal_long (obj, val ? &v : 0); + if (SWIG_IsOK(res) && val) *val = static_cast< ptrdiff_t >(v); return res; } @@ -3701,21 +3566,8 @@ namespace swig { return traits<typename noconst_traits<Type >::noconst_type >::type_name(); } - template <class Type> struct traits_info { - static swig_type_info *type_query(std::string name) { - name += " *"; - return SWIG_TypeQuery(name.c_str()); - } - static swig_type_info *type_info() { - static swig_type_info *info = type_query(type_name<Type>()); - return info; - } - }; - - /* - Partial specialization for pointers (traits_info) - */ - template <class Type> struct traits_info<Type *> { + template <class Type> + struct traits_info { static swig_type_info *type_query(std::string name) { name += " *"; return SWIG_TypeQuery(name.c_str()); @@ -3732,7 +3584,7 @@ namespace swig { } /* - Partial specialization for pointers (traits) + Partial specialization for pointers */ template <class Type> struct traits <Type *> { typedef pointer_category category; @@ -3802,8 +3654,7 @@ namespace swig { struct traits_asptr { static int asptr(PyObject *obj, Type **val) { Type *p; - swig_type_info *descriptor = type_info<Type>(); - int res = descriptor ? SWIG_ConvertPtr(obj, (void **)&p, descriptor, 0) : SWIG_ERROR; + int res = SWIG_ConvertPtr(obj, (void**)&p, type_info<Type>(), 0); if (SWIG_IsOK(res)) { if (val) *val = p; } @@ -3951,7 +3802,7 @@ namespace swig { namespace std { template <> - struct less <PyObject *> + struct less <PyObject *>: public binary_function<PyObject *, PyObject *, bool> { bool operator()(PyObject * v, PyObject *w) const @@ -3976,7 +3827,7 @@ namespace std { }; template <> - struct less <swig::SwigPtr_PyObject> + struct less <swig::SwigPtr_PyObject>: public binary_function<swig::SwigPtr_PyObject, swig::SwigPtr_PyObject, bool> { bool operator()(const swig::SwigPtr_PyObject& v, const swig::SwigPtr_PyObject& w) const @@ -3986,7 +3837,7 @@ namespace std { }; template <> - struct less <swig::SwigVar_PyObject> + struct less <swig::SwigVar_PyObject>: public binary_function<swig::SwigVar_PyObject, swig::SwigVar_PyObject, bool> { bool operator()(const swig::SwigVar_PyObject& v, const swig::SwigVar_PyObject& w) const @@ -4049,7 +3900,7 @@ namespace swig { if (step == 0) { throw std::invalid_argument("slice step cannot be zero"); } else if (step > 0) { - // Required range: 0 <= i < size, 0 <= j < size, i <= j + // Required range: 0 <= i < size, 0 <= j < size if (i < 0) { ii = 0; } else if (i < (Difference)size) { @@ -4057,15 +3908,13 @@ namespace swig { } else if (insert && (i >= (Difference)size)) { ii = (Difference)size; } - if (j < 0) { + if ( j < 0 ) { jj = 0; } else { jj = (j < (Difference)size) ? j : (Difference)size; } - if (jj < ii) - jj = ii; } else { - // Required range: -1 <= i < size-1, -1 <= j < size-1, i >= j + // Required range: -1 <= i < size-1, -1 <= j < size-1 if (i < -1) { ii = -1; } else if (i < (Difference) size) { @@ -4078,8 +3927,6 @@ namespace swig { } else { jj = (j < (Difference)size ) ? j : (Difference)(size-1); } - if (ii < jj) - ii = jj; } } @@ -4105,13 +3952,6 @@ namespace swig { seq->erase(position); } - template <class Sequence> - struct traits_reserve { - static void reserve(Sequence & /*seq*/, typename Sequence::size_type /*n*/) { - // This should be specialized for types that support reserve - } - }; - template <class Sequence, class Difference> inline Sequence* getslice(const Sequence* self, Difference i, Difference j, Py_ssize_t step) { @@ -4129,7 +3969,6 @@ namespace swig { return new Sequence(sb, se); } else { Sequence *sequence = new Sequence(); - swig::traits_reserve<Sequence>::reserve(*sequence, (jj - ii + step - 1) / step); typename Sequence::const_iterator it = sb; while (it!=se) { sequence->push_back(*it); @@ -4140,16 +3979,17 @@ namespace swig { } } else { Sequence *sequence = new Sequence(); - swig::traits_reserve<Sequence>::reserve(*sequence, (ii - jj - step - 1) / -step); - typename Sequence::const_reverse_iterator sb = self->rbegin(); - typename Sequence::const_reverse_iterator se = self->rbegin(); - std::advance(sb,size-ii-1); - std::advance(se,size-jj-1); - typename Sequence::const_reverse_iterator it = sb; - while (it!=se) { - sequence->push_back(*it); - for (Py_ssize_t c=0; c<-step && it!=se; ++c) - it++; + if (ii > jj) { + typename Sequence::const_reverse_iterator sb = self->rbegin(); + typename Sequence::const_reverse_iterator se = self->rbegin(); + std::advance(sb,size-ii-1); + std::advance(se,size-jj-1); + typename Sequence::const_reverse_iterator it = sb; + while (it!=se) { + sequence->push_back(*it); + for (Py_ssize_t c=0; c<-step && it!=se; ++c) + it++; + } } return sequence; } @@ -4163,11 +4003,12 @@ namespace swig { Difference jj = 0; swig::slice_adjust(i, j, step, size, ii, jj, true); if (step > 0) { + if (jj < ii) + jj = ii; if (step == 1) { size_t ssize = jj - ii; if (ssize <= is.size()) { // expanding/staying the same size - swig::traits_reserve<Sequence>::reserve(*self, self->size() - ssize + is.size()); typename Sequence::iterator sb = self->begin(); typename InputSeq::const_iterator isit = is.begin(); std::advance(sb,ii); @@ -4201,6 +4042,8 @@ namespace swig { } } } else { + if (jj > ii) + jj = ii; size_t replacecount = (ii - jj - step - 1) / -step; if (is.size() != replacecount) { char msg[1024]; @@ -4226,33 +4069,37 @@ namespace swig { Difference jj = 0; swig::slice_adjust(i, j, step, size, ii, jj, true); if (step > 0) { - typename Sequence::iterator sb = self->begin(); - std::advance(sb,ii); - if (step == 1) { - typename Sequence::iterator se = self->begin(); - std::advance(se,jj); - self->erase(sb,se); - } else { - typename Sequence::iterator it = sb; - size_t delcount = (jj - ii + step - 1) / step; + if (jj > ii) { + typename Sequence::iterator sb = self->begin(); + std::advance(sb,ii); + if (step == 1) { + typename Sequence::iterator se = self->begin(); + std::advance(se,jj); + self->erase(sb,se); + } else { + typename Sequence::iterator it = sb; + size_t delcount = (jj - ii + step - 1) / step; + while (delcount) { + it = self->erase(it); + for (Py_ssize_t c=0; c<(step-1) && it != self->end(); ++c) + it++; + delcount--; + } + } + } + } else { + if (ii > jj) { + typename Sequence::reverse_iterator sb = self->rbegin(); + std::advance(sb,size-ii-1); + typename Sequence::reverse_iterator it = sb; + size_t delcount = (ii - jj - step - 1) / -step; while (delcount) { - it = self->erase(it); - for (Py_ssize_t c=0; c<(step-1) && it != self->end(); ++c) + it = typename Sequence::reverse_iterator(self->erase((++it).base())); + for (Py_ssize_t c=0; c<(-step-1) && it != self->rend(); ++c) it++; delcount--; } } - } else { - typename Sequence::reverse_iterator sb = self->rbegin(); - std::advance(sb,size-ii-1); - typename Sequence::reverse_iterator it = sb; - size_t delcount = (ii - jj - step - 1) / -step; - while (delcount) { - it = typename Sequence::reverse_iterator(self->erase((++it).base())); - for (Py_ssize_t c=0; c<(-step-1) && it != self->rend(); ++c) - it++; - delcount--; - } } } } @@ -4708,6 +4555,16 @@ namespace swig } +#include <limits.h> +#if !defined(SWIG_NO_LLONG_MAX) +# if !defined(LLONG_MAX) && defined(__GNUC__) && defined (__LONG_LONG_MAX__) +# define LLONG_MAX __LONG_LONG_MAX__ +# define LLONG_MIN (-LLONG_MAX - 1LL) +# define ULLONG_MAX (LLONG_MAX * 2ULL + 1ULL) +# endif +#endif + + SWIGINTERN int SWIG_AsVal_int (PyObject * obj, int *val) { @@ -4771,8 +4628,8 @@ namespace swig { static int asptr(PyObject *obj, sequence **seq) { if (obj == Py_None || SWIG_Python_GetSwigThis(obj)) { sequence *p; - swig_type_info *descriptor = swig::type_info<sequence>(); - if (descriptor && SWIG_IsOK(::SWIG_ConvertPtr(obj, (void **)&p, descriptor, 0))) { + if (::SWIG_ConvertPtr(obj,(void**)&p, + swig::type_info<sequence>(),0) == SWIG_OK) { if (seq) *seq = p; return SWIG_OLDOBJ; } @@ -4811,7 +4668,7 @@ namespace swig { #ifdef SWIG_PYTHON_EXTRA_NATIVE_CONTAINERS swig_type_info *desc = swig::type_info<sequence>(); if (desc && desc->clientdata) { - return SWIG_InternalNewPointerObj(new sequence(seq), desc, SWIG_POINTER_OWN); + return SWIG_NewPointerObj(new sequence(seq), desc, SWIG_POINTER_OWN); } #endif size_type size = seq.size(); @@ -4832,13 +4689,6 @@ namespace swig { namespace swig { - template <class T> - struct traits_reserve<std::vector<T> > { - static void reserve(std::vector<T> &seq, typename std::vector<T>::size_type n) { - seq.reserve(n); - } - }; - template <class T> struct traits_asptr<std::vector<T> > { static int asptr(PyObject *obj, std::vector<T> **vec) { @@ -4881,33 +4731,14 @@ SWIGINTERNINLINE PyObject* SWIG_From_unsigned_SS_long (unsigned long value) { return (value > LONG_MAX) ? - PyLong_FromUnsignedLong(value) : PyInt_FromLong(static_cast< long >(value)); -} - - -#ifdef SWIG_LONG_LONG_AVAILABLE -SWIGINTERNINLINE PyObject* -SWIG_From_unsigned_SS_long_SS_long (unsigned long long value) -{ - return (value > LONG_MAX) ? - PyLong_FromUnsignedLongLong(value) : PyInt_FromLong(static_cast< long >(value)); + PyLong_FromUnsignedLong(value) : PyLong_FromLong(static_cast< long >(value)); } -#endif SWIGINTERNINLINE PyObject * SWIG_From_size_t (size_t value) { -#ifdef SWIG_LONG_LONG_AVAILABLE - if (sizeof(size_t) <= sizeof(unsigned long)) { -#endif - return SWIG_From_unsigned_SS_long (static_cast< unsigned long >(value)); -#ifdef SWIG_LONG_LONG_AVAILABLE - } else { - /* assume sizeof(size_t) <= sizeof(unsigned long long) */ - return SWIG_From_unsigned_SS_long_SS_long (static_cast< unsigned long long >(value)); - } -#endif + return SWIG_From_unsigned_SS_long (static_cast< unsigned long >(value)); } SWIGINTERN std::vector< int,std::allocator< int > > *std_vector_Sl_int_Sg____getslice__(std::vector< int > *self,std::vector< int >::difference_type i,std::vector< int >::difference_type j){ @@ -5007,18 +4838,13 @@ SWIGINTERN int SWIG_AsCharPtrAndSize(PyObject *obj, char** cptr, size_t* psize, int *alloc) { #if PY_VERSION_HEX>=0x03000000 -#if defined(SWIG_PYTHON_STRICT_BYTE_CHAR) - if (PyBytes_Check(obj)) -#else if (PyUnicode_Check(obj)) -#endif #else if (PyString_Check(obj)) #endif { char *cstr; Py_ssize_t len; #if PY_VERSION_HEX>=0x03000000 -#if !defined(SWIG_PYTHON_STRICT_BYTE_CHAR) if (!alloc && cptr) { /* We can't allow converting without allocation, since the internal representation of string in Python 3 is UCS-2/UCS-4 but we require @@ -5027,9 +4853,8 @@ SWIG_AsCharPtrAndSize(PyObject *obj, char** cptr, size_t* psize, int *alloc) return SWIG_RuntimeError; } obj = PyUnicode_AsUTF8String(obj); - if(alloc) *alloc = SWIG_NEWOBJ; -#endif PyBytes_AsStringAndSize(obj, &cstr, &len); + if(alloc) *alloc = SWIG_NEWOBJ; #else PyString_AsStringAndSize(obj, &cstr, &len); #endif @@ -5050,34 +4875,26 @@ SWIG_AsCharPtrAndSize(PyObject *obj, char** cptr, size_t* psize, int *alloc) if (*alloc == SWIG_NEWOBJ) #endif { - *cptr = reinterpret_cast< char* >(memcpy(new char[len + 1], cstr, sizeof(char)*(len + 1))); + *cptr = reinterpret_cast< char* >(memcpy((new char[len + 1]), cstr, sizeof(char)*(len + 1))); *alloc = SWIG_NEWOBJ; } else { *cptr = cstr; *alloc = SWIG_OLDOBJ; } } else { -#if PY_VERSION_HEX>=0x03000000 -#if defined(SWIG_PYTHON_STRICT_BYTE_CHAR) - *cptr = PyBytes_AsString(obj); -#else - assert(0); /* Should never reach here with Unicode strings in Python 3 */ -#endif -#else + #if PY_VERSION_HEX>=0x03000000 + assert(0); /* Should never reach here in Python 3 */ + #endif *cptr = SWIG_Python_str_AsChar(obj); -#endif } } if (psize) *psize = len + 1; -#if PY_VERSION_HEX>=0x03000000 && !defined(SWIG_PYTHON_STRICT_BYTE_CHAR) +#if PY_VERSION_HEX>=0x03000000 Py_XDECREF(obj); #endif return SWIG_OK; } else { #if defined(SWIG_PYTHON_2_UNICODE) -#if defined(SWIG_PYTHON_STRICT_BYTE_CHAR) -#error "Cannot use both SWIG_PYTHON_2_UNICODE and SWIG_PYTHON_STRICT_BYTE_CHAR at once" -#endif #if PY_VERSION_HEX<0x03000000 if (PyUnicode_Check(obj)) { char *cstr; Py_ssize_t len; @@ -5088,7 +4905,7 @@ SWIG_AsCharPtrAndSize(PyObject *obj, char** cptr, size_t* psize, int *alloc) if (PyString_AsStringAndSize(obj, &cstr, &len) != -1) { if (cptr) { if (alloc) *alloc = SWIG_NEWOBJ; - *cptr = reinterpret_cast< char* >(memcpy(new char[len + 1], cstr, sizeof(char)*(len + 1))); + *cptr = reinterpret_cast< char* >(memcpy((new char[len + 1]), cstr, sizeof(char)*(len + 1))); } if (psize) *psize = len + 1; @@ -5175,15 +4992,11 @@ SWIG_FromCharPtrAndSize(const char* carray, size_t size) SWIG_InternalNewPointerObj(const_cast< char * >(carray), pchar_descriptor, 0) : SWIG_Py_Void(); } else { #if PY_VERSION_HEX >= 0x03000000 -#if defined(SWIG_PYTHON_STRICT_BYTE_CHAR) - return PyBytes_FromStringAndSize(carray, static_cast< Py_ssize_t >(size)); -#else #if PY_VERSION_HEX >= 0x03010000 return PyUnicode_DecodeUTF8(carray, static_cast< Py_ssize_t >(size), "surrogateescape"); #else return PyUnicode_FromStringAndSize(carray, static_cast< Py_ssize_t >(size)); #endif -#endif #else return PyString_FromStringAndSize(carray, static_cast< Py_ssize_t >(size)); #endif @@ -5590,91 +5403,264 @@ SWIGINTERN std::vector< unsigned int >::iterator std_vector_Sl_unsigned_SS_int_S SWIGINTERN std::vector< unsigned int >::iterator std_vector_Sl_unsigned_SS_int_Sg__insert__SWIG_0(std::vector< unsigned int > *self,std::vector< unsigned int >::iterator pos,std::vector< unsigned int >::value_type const &x){ return self->insert(pos, x); } SWIGINTERN void std_vector_Sl_unsigned_SS_int_Sg__insert__SWIG_1(std::vector< unsigned int > *self,std::vector< unsigned int >::iterator pos,std::vector< unsigned int >::size_type n,std::vector< unsigned int >::value_type const &x){ self->insert(pos, n, x); } -SWIGINTERN int -SWIG_AsVal_unsigned_SS_short (PyObject * obj, unsigned short *val) -{ - unsigned long v; - int res = SWIG_AsVal_unsigned_SS_long (obj, &v); - if (SWIG_IsOK(res)) { - if ((v > USHRT_MAX)) { - return SWIG_OverflowError; - } else { - if (val) *val = static_cast< unsigned short >(v); - } - } - return res; -} - -#ifdef __cplusplus -extern "C" { -#endif -SWIGINTERN PyObject *_wrap_delete_SwigPyIterator(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - swig::SwigPyIterator *arg1 = (swig::SwigPyIterator *) 0 ; - void *argp1 = 0 ; - int res1 = 0 ; - PyObject * obj0 = 0 ; - - if (!PyArg_ParseTuple(args,(char *)"O:delete_SwigPyIterator",&obj0)) SWIG_fail; - res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_swig__SwigPyIterator, SWIG_POINTER_DISOWN | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "delete_SwigPyIterator" "', argument " "1"" of type '" "swig::SwigPyIterator *""'"); + namespace swig { + template <> struct traits< AmptekSpectrum > { + typedef pointer_category category; + static const char* type_name() { return"AmptekSpectrum"; } + }; } - arg1 = reinterpret_cast< swig::SwigPyIterator * >(argp1); - delete arg1; - resultobj = SWIG_Py_Void(); - return resultobj; -fail: - return NULL; -} -SWIGINTERN PyObject *_wrap_SwigPyIterator_value(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - swig::SwigPyIterator *arg1 = (swig::SwigPyIterator *) 0 ; - void *argp1 = 0 ; - int res1 = 0 ; - PyObject * obj0 = 0 ; - PyObject *result = 0 ; - - if (!PyArg_ParseTuple(args,(char *)"O:SwigPyIterator_value",&obj0)) SWIG_fail; - res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_swig__SwigPyIterator, 0 | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "SwigPyIterator_value" "', argument " "1"" of type '" "swig::SwigPyIterator const *""'"); - } - arg1 = reinterpret_cast< swig::SwigPyIterator * >(argp1); - try { - result = (PyObject *)((swig::SwigPyIterator const *)arg1)->value(); - } - catch(swig::stop_iteration &_e) { - { - (void)_e; - SWIG_SetErrorObj(PyExc_StopIteration, SWIG_Py_Void()); - SWIG_fail; - } + namespace swig { + template <> struct traits< AmptekStatus > { + typedef pointer_category category; + static const char* type_name() { return"AmptekStatus"; } + }; } - - resultobj = result; - return resultobj; -fail: - return NULL; -} -SWIGINTERN PyObject *_wrap_SwigPyIterator_incr__SWIG_0(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - swig::SwigPyIterator *arg1 = (swig::SwigPyIterator *) 0 ; - size_t arg2 ; - void *argp1 = 0 ; - int res1 = 0 ; - size_t val2 ; - int ecode2 = 0 ; - PyObject * obj0 = 0 ; - PyObject * obj1 = 0 ; - swig::SwigPyIterator *result = 0 ; - - if (!PyArg_ParseTuple(args,(char *)"OO:SwigPyIterator_incr",&obj0,&obj1)) SWIG_fail; - res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_swig__SwigPyIterator, 0 | 0 ); + namespace swig { + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + template <class T, class U > + struct traits_asptr<std::pair<T,U> > { + typedef std::pair<T,U> value_type; + + static int get_pair(PyObject* first, PyObject* second, + std::pair<T,U> **val) + { + if (val) { + value_type *vp = (new std::pair<T,U>); + T *pfirst = &(vp->first); + int res1 = swig::asval((PyObject*)first, pfirst); + if (!SWIG_IsOK(res1)) return res1; + U *psecond = &(vp->second); + int res2 = swig::asval((PyObject*)second, psecond); + if (!SWIG_IsOK(res2)) return res2; + *val = vp; + return SWIG_AddNewMask(res1 > res2 ? res1 : res2); + } else { + T *pfirst = 0; + int res1 = swig::asval((PyObject*)first, pfirst); + if (!SWIG_IsOK(res1)) return res1; + U *psecond = 0; + int res2 = swig::asval((PyObject*)second, psecond); + if (!SWIG_IsOK(res2)) return res2; + return res1 > res2 ? res1 : res2; + } + } + + static int asptr(PyObject *obj, std::pair<T,U> **val) { + int res = SWIG_ERROR; + if (PyTuple_Check(obj)) { + if (PyTuple_GET_SIZE(obj) == 2) { + res = get_pair(PyTuple_GET_ITEM(obj,0),PyTuple_GET_ITEM(obj,1), val); + } + } else if (PySequence_Check(obj)) { + if (PySequence_Size(obj) == 2) { + swig::SwigVar_PyObject first = PySequence_GetItem(obj,0); + swig::SwigVar_PyObject second = PySequence_GetItem(obj,1); + res = get_pair(first, second, val); + } + } else { + value_type *p; + res = SWIG_ConvertPtr(obj,(void**)&p,swig::type_info<value_type>(),0); + if (SWIG_IsOK(res) && val) *val = p; + } + return res; + } + }; + + + template <class T, class U > + struct traits_from<std::pair<T,U> > { + static PyObject *from(const std::pair<T,U>& val) { + PyObject* obj = PyTuple_New(2); + PyTuple_SetItem(obj,0,swig::from(val.first)); + PyTuple_SetItem(obj,1,swig::from(val.second)); + return obj; + } + }; + } + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + namespace swig { + template <> struct traits<std::pair< AmptekSpectrum, AmptekStatus > > { + typedef pointer_category category; + static const char* type_name() { + return "std::pair<" "AmptekSpectrum" "," "AmptekStatus" " >"; + } + }; + } + + +SWIGINTERN int +SWIG_AsVal_unsigned_SS_short (PyObject * obj, unsigned short *val) +{ + unsigned long v; + int res = SWIG_AsVal_unsigned_SS_long (obj, &v); + if (SWIG_IsOK(res)) { + if ((v > USHRT_MAX)) { + return SWIG_OverflowError; + } else { + if (val) *val = static_cast< unsigned short >(v); + } + } + return res; +} + +#ifdef __cplusplus +extern "C" { +#endif +SWIGINTERN PyObject *_wrap_delete_SwigPyIterator(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + swig::SwigPyIterator *arg1 = (swig::SwigPyIterator *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + PyObject * obj0 = 0 ; + + if (!PyArg_ParseTuple(args,(char *)"O:delete_SwigPyIterator",&obj0)) SWIG_fail; + res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_swig__SwigPyIterator, SWIG_POINTER_DISOWN | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "delete_SwigPyIterator" "', argument " "1"" of type '" "swig::SwigPyIterator *""'"); + } + arg1 = reinterpret_cast< swig::SwigPyIterator * >(argp1); + delete arg1; + resultobj = SWIG_Py_Void(); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_SwigPyIterator_value(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + swig::SwigPyIterator *arg1 = (swig::SwigPyIterator *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + PyObject * obj0 = 0 ; + PyObject *result = 0 ; + + if (!PyArg_ParseTuple(args,(char *)"O:SwigPyIterator_value",&obj0)) SWIG_fail; + res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_swig__SwigPyIterator, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "SwigPyIterator_value" "', argument " "1"" of type '" "swig::SwigPyIterator const *""'"); + } + arg1 = reinterpret_cast< swig::SwigPyIterator * >(argp1); + try { + result = (PyObject *)((swig::SwigPyIterator const *)arg1)->value(); + } + catch(swig::stop_iteration &_e) { + { + (void)_e; + SWIG_SetErrorObj(PyExc_StopIteration, SWIG_Py_Void()); + SWIG_fail; + } + } + + resultobj = result; + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_SwigPyIterator_incr__SWIG_0(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + swig::SwigPyIterator *arg1 = (swig::SwigPyIterator *) 0 ; + size_t arg2 ; + void *argp1 = 0 ; + int res1 = 0 ; + size_t val2 ; + int ecode2 = 0 ; + PyObject * obj0 = 0 ; + PyObject * obj1 = 0 ; + swig::SwigPyIterator *result = 0 ; + + if (!PyArg_ParseTuple(args,(char *)"OO:SwigPyIterator_incr",&obj0,&obj1)) SWIG_fail; + res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_swig__SwigPyIterator, 0 | 0 ); if (!SWIG_IsOK(res1)) { SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "SwigPyIterator_incr" "', argument " "1"" of type '" "swig::SwigPyIterator *""'"); } @@ -6453,7 +6439,7 @@ fail: SWIGINTERN PyObject *SwigPyIterator_swigregister(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *obj; - if (!PyArg_ParseTuple(args,(char *)"O:swigregister", &obj)) return NULL; + if (!PyArg_ParseTuple(args,(char*)"O:swigregister", &obj)) return NULL; SWIG_TypeNewClientData(SWIGTYPE_p_swig__SwigPyIterator, SWIG_NewClientData(obj)); return SWIG_Py_Void(); } @@ -8371,7 +8357,7 @@ fail: SWIGINTERN PyObject *IntVector_swigregister(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *obj; - if (!PyArg_ParseTuple(args,(char *)"O:swigregister", &obj)) return NULL; + if (!PyArg_ParseTuple(args,(char*)"O:swigregister", &obj)) return NULL; SWIG_TypeNewClientData(SWIGTYPE_p_std__vectorT_int_std__allocatorT_int_t_t, SWIG_NewClientData(obj)); return SWIG_Py_Void(); } @@ -10319,7 +10305,7 @@ fail: SWIGINTERN PyObject *StringVector_swigregister(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *obj; - if (!PyArg_ParseTuple(args,(char *)"O:swigregister", &obj)) return NULL; + if (!PyArg_ParseTuple(args,(char*)"O:swigregister", &obj)) return NULL; SWIG_TypeNewClientData(SWIGTYPE_p_std__vectorT_std__string_std__allocatorT_std__string_t_t, SWIG_NewClientData(obj)); return SWIG_Py_Void(); } @@ -12237,7 +12223,7 @@ fail: SWIGINTERN PyObject *DoubleVector_swigregister(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *obj; - if (!PyArg_ParseTuple(args,(char *)"O:swigregister", &obj)) return NULL; + if (!PyArg_ParseTuple(args,(char*)"O:swigregister", &obj)) return NULL; SWIG_TypeNewClientData(SWIGTYPE_p_std__vectorT_double_std__allocatorT_double_t_t, SWIG_NewClientData(obj)); return SWIG_Py_Void(); } @@ -14155,11 +14141,333 @@ fail: SWIGINTERN PyObject *UIntVector_swigregister(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *obj; - if (!PyArg_ParseTuple(args,(char *)"O:swigregister", &obj)) return NULL; + if (!PyArg_ParseTuple(args,(char*)"O:swigregister", &obj)) return NULL; SWIG_TypeNewClientData(SWIGTYPE_p_std__vectorT_unsigned_int_std__allocatorT_unsigned_int_t_t, SWIG_NewClientData(obj)); return SWIG_Py_Void(); } +SWIGINTERN PyObject *_wrap_new_AmptekDataPair__SWIG_0(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + std::pair< AmptekSpectrum,AmptekStatus > *result = 0 ; + + if (!PyArg_ParseTuple(args,(char *)":new_AmptekDataPair")) SWIG_fail; + result = (std::pair< AmptekSpectrum,AmptekStatus > *)new std::pair< AmptekSpectrum,AmptekStatus >(); + resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_std__pairT_AmptekSpectrum_AmptekStatus_t, SWIG_POINTER_NEW | 0 ); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_new_AmptekDataPair__SWIG_1(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + AmptekSpectrum arg1 ; + AmptekStatus arg2 ; + void *argp1 ; + int res1 = 0 ; + void *argp2 ; + int res2 = 0 ; + PyObject * obj0 = 0 ; + PyObject * obj1 = 0 ; + std::pair< AmptekSpectrum,AmptekStatus > *result = 0 ; + + if (!PyArg_ParseTuple(args,(char *)"OO:new_AmptekDataPair",&obj0,&obj1)) SWIG_fail; + { + res1 = SWIG_ConvertPtr(obj0, &argp1, SWIGTYPE_p_AmptekSpectrum, 0 | 0); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "new_AmptekDataPair" "', argument " "1"" of type '" "AmptekSpectrum""'"); + } + if (!argp1) { + SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "new_AmptekDataPair" "', argument " "1"" of type '" "AmptekSpectrum""'"); + } else { + AmptekSpectrum * temp = reinterpret_cast< AmptekSpectrum * >(argp1); + arg1 = *temp; + if (SWIG_IsNewObj(res1)) delete temp; + } + } + { + res2 = SWIG_ConvertPtr(obj1, &argp2, SWIGTYPE_p_AmptekStatus, 0 | 0); + if (!SWIG_IsOK(res2)) { + SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "new_AmptekDataPair" "', argument " "2"" of type '" "AmptekStatus""'"); + } + if (!argp2) { + SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "new_AmptekDataPair" "', argument " "2"" of type '" "AmptekStatus""'"); + } else { + AmptekStatus * temp = reinterpret_cast< AmptekStatus * >(argp2); + arg2 = *temp; + if (SWIG_IsNewObj(res2)) delete temp; + } + } + result = (std::pair< AmptekSpectrum,AmptekStatus > *)new std::pair< AmptekSpectrum,AmptekStatus >(arg1,arg2); + resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_std__pairT_AmptekSpectrum_AmptekStatus_t, SWIG_POINTER_NEW | 0 ); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_new_AmptekDataPair__SWIG_2(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + std::pair< AmptekSpectrum,AmptekStatus > *arg1 = 0 ; + int res1 = SWIG_OLDOBJ ; + PyObject * obj0 = 0 ; + std::pair< AmptekSpectrum,AmptekStatus > *result = 0 ; + + if (!PyArg_ParseTuple(args,(char *)"O:new_AmptekDataPair",&obj0)) SWIG_fail; + { + std::pair< AmptekSpectrum,AmptekStatus > *ptr = (std::pair< AmptekSpectrum,AmptekStatus > *)0; + res1 = swig::asptr(obj0, &ptr); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "new_AmptekDataPair" "', argument " "1"" of type '" "std::pair< AmptekSpectrum,AmptekStatus > const &""'"); + } + if (!ptr) { + SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "new_AmptekDataPair" "', argument " "1"" of type '" "std::pair< AmptekSpectrum,AmptekStatus > const &""'"); + } + arg1 = ptr; + } + result = (std::pair< AmptekSpectrum,AmptekStatus > *)new std::pair< AmptekSpectrum,AmptekStatus >((std::pair< AmptekSpectrum,AmptekStatus > const &)*arg1); + resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_std__pairT_AmptekSpectrum_AmptekStatus_t, SWIG_POINTER_NEW | 0 ); + if (SWIG_IsNewObj(res1)) delete arg1; + return resultobj; +fail: + if (SWIG_IsNewObj(res1)) delete arg1; + return NULL; +} + + +SWIGINTERN PyObject *_wrap_new_AmptekDataPair(PyObject *self, PyObject *args) { + Py_ssize_t argc; + PyObject *argv[3] = { + 0 + }; + Py_ssize_t ii; + + if (!PyTuple_Check(args)) SWIG_fail; + argc = args ? PyObject_Length(args) : 0; + for (ii = 0; (ii < 2) && (ii < argc); ii++) { + argv[ii] = PyTuple_GET_ITEM(args,ii); + } + if (argc == 0) { + return _wrap_new_AmptekDataPair__SWIG_0(self, args); + } + if (argc == 1) { + int _v; + int res = swig::asptr(argv[0], (std::pair< AmptekSpectrum,AmptekStatus >**)(0)); + _v = SWIG_CheckState(res); + if (_v) { + return _wrap_new_AmptekDataPair__SWIG_2(self, args); + } + } + if (argc == 2) { + int _v; + int res = SWIG_ConvertPtr(argv[0], 0, SWIGTYPE_p_AmptekSpectrum, 0); + _v = SWIG_CheckState(res); + if (_v) { + int res = SWIG_ConvertPtr(argv[1], 0, SWIGTYPE_p_AmptekStatus, 0); + _v = SWIG_CheckState(res); + if (_v) { + return _wrap_new_AmptekDataPair__SWIG_1(self, args); + } + } + } + +fail: + SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number or type of arguments for overloaded function 'new_AmptekDataPair'.\n" + " Possible C/C++ prototypes are:\n" + " std::pair< AmptekSpectrum,AmptekStatus >::pair()\n" + " std::pair< AmptekSpectrum,AmptekStatus >::pair(AmptekSpectrum,AmptekStatus)\n" + " std::pair< AmptekSpectrum,AmptekStatus >::pair(std::pair< AmptekSpectrum,AmptekStatus > const &)\n"); + return 0; +} + + +SWIGINTERN PyObject *_wrap_AmptekDataPair_first_set(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + std::pair< AmptekSpectrum,AmptekStatus > *arg1 = (std::pair< AmptekSpectrum,AmptekStatus > *) 0 ; + AmptekSpectrum *arg2 = (AmptekSpectrum *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + void *argp2 = 0 ; + int res2 = 0 ; + PyObject * obj0 = 0 ; + PyObject * obj1 = 0 ; + + if (!PyArg_ParseTuple(args,(char *)"OO:AmptekDataPair_first_set",&obj0,&obj1)) SWIG_fail; + res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__pairT_AmptekSpectrum_AmptekStatus_t, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "AmptekDataPair_first_set" "', argument " "1"" of type '" "std::pair< AmptekSpectrum,AmptekStatus > *""'"); + } + arg1 = reinterpret_cast< std::pair< AmptekSpectrum,AmptekStatus > * >(argp1); + res2 = SWIG_ConvertPtr(obj1, &argp2,SWIGTYPE_p_AmptekSpectrum, 0 | 0 ); + if (!SWIG_IsOK(res2)) { + SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "AmptekDataPair_first_set" "', argument " "2"" of type '" "AmptekSpectrum *""'"); + } + arg2 = reinterpret_cast< AmptekSpectrum * >(argp2); + if (arg1) (arg1)->first = *arg2; + resultobj = SWIG_Py_Void(); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_AmptekDataPair_first_get(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + std::pair< AmptekSpectrum,AmptekStatus > *arg1 = (std::pair< AmptekSpectrum,AmptekStatus > *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + PyObject * obj0 = 0 ; + AmptekSpectrum *result = 0 ; + + if (!PyArg_ParseTuple(args,(char *)"O:AmptekDataPair_first_get",&obj0)) SWIG_fail; + res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__pairT_AmptekSpectrum_AmptekStatus_t, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "AmptekDataPair_first_get" "', argument " "1"" of type '" "std::pair< AmptekSpectrum,AmptekStatus > *""'"); + } + arg1 = reinterpret_cast< std::pair< AmptekSpectrum,AmptekStatus > * >(argp1); + result = (AmptekSpectrum *)& ((arg1)->first); + resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_AmptekSpectrum, 0 | 0 ); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_AmptekDataPair_second_set(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + std::pair< AmptekSpectrum,AmptekStatus > *arg1 = (std::pair< AmptekSpectrum,AmptekStatus > *) 0 ; + AmptekStatus *arg2 = (AmptekStatus *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + void *argp2 = 0 ; + int res2 = 0 ; + PyObject * obj0 = 0 ; + PyObject * obj1 = 0 ; + + if (!PyArg_ParseTuple(args,(char *)"OO:AmptekDataPair_second_set",&obj0,&obj1)) SWIG_fail; + res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__pairT_AmptekSpectrum_AmptekStatus_t, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "AmptekDataPair_second_set" "', argument " "1"" of type '" "std::pair< AmptekSpectrum,AmptekStatus > *""'"); + } + arg1 = reinterpret_cast< std::pair< AmptekSpectrum,AmptekStatus > * >(argp1); + res2 = SWIG_ConvertPtr(obj1, &argp2,SWIGTYPE_p_AmptekStatus, 0 | 0 ); + if (!SWIG_IsOK(res2)) { + SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "AmptekDataPair_second_set" "', argument " "2"" of type '" "AmptekStatus *""'"); + } + arg2 = reinterpret_cast< AmptekStatus * >(argp2); + if (arg1) (arg1)->second = *arg2; + resultobj = SWIG_Py_Void(); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_AmptekDataPair_second_get(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + std::pair< AmptekSpectrum,AmptekStatus > *arg1 = (std::pair< AmptekSpectrum,AmptekStatus > *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + PyObject * obj0 = 0 ; + AmptekStatus *result = 0 ; + + if (!PyArg_ParseTuple(args,(char *)"O:AmptekDataPair_second_get",&obj0)) SWIG_fail; + res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__pairT_AmptekSpectrum_AmptekStatus_t, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "AmptekDataPair_second_get" "', argument " "1"" of type '" "std::pair< AmptekSpectrum,AmptekStatus > *""'"); + } + arg1 = reinterpret_cast< std::pair< AmptekSpectrum,AmptekStatus > * >(argp1); + result = (AmptekStatus *)& ((arg1)->second); + resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_AmptekStatus, 0 | 0 ); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_delete_AmptekDataPair(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + std::pair< AmptekSpectrum,AmptekStatus > *arg1 = (std::pair< AmptekSpectrum,AmptekStatus > *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + PyObject * obj0 = 0 ; + + if (!PyArg_ParseTuple(args,(char *)"O:delete_AmptekDataPair",&obj0)) SWIG_fail; + res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__pairT_AmptekSpectrum_AmptekStatus_t, SWIG_POINTER_DISOWN | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "delete_AmptekDataPair" "', argument " "1"" of type '" "std::pair< AmptekSpectrum,AmptekStatus > *""'"); + } + arg1 = reinterpret_cast< std::pair< AmptekSpectrum,AmptekStatus > * >(argp1); + delete arg1; + resultobj = SWIG_Py_Void(); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *AmptekDataPair_swigregister(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *obj; + if (!PyArg_ParseTuple(args,(char*)"O:swigregister", &obj)) return NULL; + SWIG_TypeNewClientData(SWIGTYPE_p_std__pairT_AmptekSpectrum_AmptekStatus_t, SWIG_NewClientData(obj)); + return SWIG_Py_Void(); +} + +SWIGINTERN PyObject *SPECLEN_swigconstant(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *module; + PyObject *d; + if (!PyArg_ParseTuple(args,(char*)"O:swigconstant", &module)) return NULL; + d = PyModule_GetDict(module); + if (!d) return NULL; + SWIG_Python_SetConstant(d, "SPECLEN",SWIG_From_int(static_cast< int >(8192))); + return SWIG_Py_Void(); +} + + +SWIGINTERN PyObject *NOT_CONNECTED_swigconstant(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *module; + PyObject *d; + if (!PyArg_ParseTuple(args,(char*)"O:swigconstant", &module)) return NULL; + d = PyModule_GetDict(module); + if (!d) return NULL; + SWIG_Python_SetConstant(d, "NOT_CONNECTED",SWIG_From_int(static_cast< int >(NOT_CONNECTED))); + return SWIG_Py_Void(); +} + + +SWIGINTERN PyObject *ON_swigconstant(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *module; + PyObject *d; + if (!PyArg_ParseTuple(args,(char*)"O:swigconstant", &module)) return NULL; + d = PyModule_GetDict(module); + if (!d) return NULL; + SWIG_Python_SetConstant(d, "ON",SWIG_From_int(static_cast< int >(ON))); + return SWIG_Py_Void(); +} + + +SWIGINTERN PyObject *RECORDING_swigconstant(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *module; + PyObject *d; + if (!PyArg_ParseTuple(args,(char*)"O:swigconstant", &module)) return NULL; + d = PyModule_GetDict(module); + if (!d) return NULL; + SWIG_Python_SetConstant(d, "RECORDING",SWIG_From_int(static_cast< int >(RECORDING))); + return SWIG_Py_Void(); +} + + +SWIGINTERN PyObject *ERROR_swigconstant(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *module; + PyObject *d; + if (!PyArg_ParseTuple(args,(char*)"O:swigconstant", &module)) return NULL; + d = PyModule_GetDict(module); + if (!d) return NULL; + SWIG_Python_SetConstant(d, "ERROR",SWIG_From_int(static_cast< int >(ERROR))); + return SWIG_Py_Void(); +} + + SWIGINTERN PyObject *_wrap_new_AmptekHardwareInterface(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; AmptekHardwareInterface *result = 0 ; @@ -14707,21 +15015,74 @@ fail: } -SWIGINTERN PyObject *_wrap_AmptekHardwareInterface_startBuffering(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { +SWIGINTERN PyObject *_wrap_AmptekHardwareInterface_startHardwareBuffering(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + AmptekHardwareInterface *arg1 = (AmptekHardwareInterface *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + PyObject * obj0 = 0 ; + bool result; + + if (!PyArg_ParseTuple(args,(char *)"O:AmptekHardwareInterface_startHardwareBuffering",&obj0)) SWIG_fail; + res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_AmptekHardwareInterface, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "AmptekHardwareInterface_startHardwareBuffering" "', argument " "1"" of type '" "AmptekHardwareInterface *""'"); + } + arg1 = reinterpret_cast< AmptekHardwareInterface * >(argp1); + result = (bool)(arg1)->startHardwareBuffering(); + resultobj = SWIG_From_bool(static_cast< bool >(result)); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_AmptekHardwareInterface_stopHardwareBuffering(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + AmptekHardwareInterface *arg1 = (AmptekHardwareInterface *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + PyObject * obj0 = 0 ; + bool result; + + if (!PyArg_ParseTuple(args,(char *)"O:AmptekHardwareInterface_stopHardwareBuffering",&obj0)) SWIG_fail; + res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_AmptekHardwareInterface, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "AmptekHardwareInterface_stopHardwareBuffering" "', argument " "1"" of type '" "AmptekHardwareInterface *""'"); + } + arg1 = reinterpret_cast< AmptekHardwareInterface * >(argp1); + result = (bool)(arg1)->stopHardwareBuffering(); + resultobj = SWIG_From_bool(static_cast< bool >(result)); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_AmptekHardwareInterface_BufferSpectrum(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; AmptekHardwareInterface *arg1 = (AmptekHardwareInterface *) 0 ; + uint16_t arg2 ; void *argp1 = 0 ; int res1 = 0 ; + unsigned short val2 ; + int ecode2 = 0 ; PyObject * obj0 = 0 ; + PyObject * obj1 = 0 ; bool result; - if (!PyArg_ParseTuple(args,(char *)"O:AmptekHardwareInterface_startBuffering",&obj0)) SWIG_fail; + if (!PyArg_ParseTuple(args,(char *)"OO:AmptekHardwareInterface_BufferSpectrum",&obj0,&obj1)) SWIG_fail; res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_AmptekHardwareInterface, 0 | 0 ); if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "AmptekHardwareInterface_startBuffering" "', argument " "1"" of type '" "AmptekHardwareInterface *""'"); + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "AmptekHardwareInterface_BufferSpectrum" "', argument " "1"" of type '" "AmptekHardwareInterface *""'"); } arg1 = reinterpret_cast< AmptekHardwareInterface * >(argp1); - result = (bool)(arg1)->startBuffering(); + ecode2 = SWIG_AsVal_unsigned_SS_short(obj1, &val2); + if (!SWIG_IsOK(ecode2)) { + SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "AmptekHardwareInterface_BufferSpectrum" "', argument " "2"" of type '" "uint16_t""'"); + } + arg2 = static_cast< uint16_t >(val2); + result = (bool)(arg1)->BufferSpectrum(arg2); resultobj = SWIG_From_bool(static_cast< bool >(result)); return resultobj; fail: @@ -14729,21 +15090,30 @@ fail: } -SWIGINTERN PyObject *_wrap_AmptekHardwareInterface_stopBuffering(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { +SWIGINTERN PyObject *_wrap_AmptekHardwareInterface_BufferAndClearSpectrum(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; AmptekHardwareInterface *arg1 = (AmptekHardwareInterface *) 0 ; + uint16_t arg2 ; void *argp1 = 0 ; int res1 = 0 ; + unsigned short val2 ; + int ecode2 = 0 ; PyObject * obj0 = 0 ; + PyObject * obj1 = 0 ; bool result; - if (!PyArg_ParseTuple(args,(char *)"O:AmptekHardwareInterface_stopBuffering",&obj0)) SWIG_fail; + if (!PyArg_ParseTuple(args,(char *)"OO:AmptekHardwareInterface_BufferAndClearSpectrum",&obj0,&obj1)) SWIG_fail; res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_AmptekHardwareInterface, 0 | 0 ); if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "AmptekHardwareInterface_stopBuffering" "', argument " "1"" of type '" "AmptekHardwareInterface *""'"); + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "AmptekHardwareInterface_BufferAndClearSpectrum" "', argument " "1"" of type '" "AmptekHardwareInterface *""'"); } arg1 = reinterpret_cast< AmptekHardwareInterface * >(argp1); - result = (bool)(arg1)->stopBuffering(); + ecode2 = SWIG_AsVal_unsigned_SS_short(obj1, &val2); + if (!SWIG_IsOK(ecode2)) { + SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "AmptekHardwareInterface_BufferAndClearSpectrum" "', argument " "2"" of type '" "uint16_t""'"); + } + arg2 = static_cast< uint16_t >(val2); + result = (bool)(arg1)->BufferAndClearSpectrum(arg2); resultobj = SWIG_From_bool(static_cast< bool >(result)); return resultobj; fail: @@ -14761,7 +15131,7 @@ SWIGINTERN PyObject *_wrap_AmptekHardwareInterface_GetBufferedSpectrum(PyObject int ecode2 = 0 ; PyObject * obj0 = 0 ; PyObject * obj1 = 0 ; - SwigValueWrapper< std::pair< AmptekSpectrum,AmptekStatus > > result; + std::pair< AmptekSpectrum,AmptekStatus > result; if (!PyArg_ParseTuple(args,(char *)"OO:AmptekHardwareInterface_GetBufferedSpectrum",&obj0,&obj1)) SWIG_fail; res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_AmptekHardwareInterface, 0 | 0 ); @@ -14775,7 +15145,7 @@ SWIGINTERN PyObject *_wrap_AmptekHardwareInterface_GetBufferedSpectrum(PyObject } arg2 = static_cast< size_t >(val2); result = (arg1)->GetBufferedSpectrum(arg2); - resultobj = SWIG_NewPointerObj((new std::pair< AmptekSpectrum,AmptekStatus >(static_cast< const std::pair< AmptekSpectrum,AmptekStatus >& >(result))), SWIGTYPE_p_std__pairT_AmptekSpectrum_AmptekStatus_t, SWIG_POINTER_OWN | 0 ); + resultobj = swig::from(static_cast< std::pair< AmptekSpectrum,AmptekStatus > >(result)); return resultobj; fail: return NULL; @@ -15018,11 +15388,22 @@ fail: SWIGINTERN PyObject *AmptekHardwareInterface_swigregister(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *obj; - if (!PyArg_ParseTuple(args,(char *)"O:swigregister", &obj)) return NULL; + if (!PyArg_ParseTuple(args,(char*)"O:swigregister", &obj)) return NULL; SWIG_TypeNewClientData(SWIGTYPE_p_AmptekHardwareInterface, SWIG_NewClientData(obj)); return SWIG_Py_Void(); } +SWIGINTERN PyObject *STATUS_SIZE_swigconstant(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *module; + PyObject *d; + if (!PyArg_ParseTuple(args,(char*)"O:swigconstant", &module)) return NULL; + d = PyModule_GetDict(module); + if (!d) return NULL; + SWIG_Python_SetConstant(d, "STATUS_SIZE",SWIG_From_int(static_cast< int >(64))); + return SWIG_Py_Void(); +} + + SWIGINTERN PyObject *_wrap_new_AmptekStatus__SWIG_0(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; byte *arg1 = (byte *) 0 ; @@ -15784,7 +16165,7 @@ fail: SWIGINTERN PyObject *AmptekStatus_swigregister(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *obj; - if (!PyArg_ParseTuple(args,(char *)"O:swigregister", &obj)) return NULL; + if (!PyArg_ParseTuple(args,(char*)"O:swigregister", &obj)) return NULL; SWIG_TypeNewClientData(SWIGTYPE_p_AmptekStatus, SWIG_NewClientData(obj)); return SWIG_Py_Void(); } @@ -16150,7 +16531,7 @@ fail: SWIGINTERN PyObject *AmptekSpectrum_swigregister(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *obj; - if (!PyArg_ParseTuple(args,(char *)"O:swigregister", &obj)) return NULL; + if (!PyArg_ParseTuple(args,(char*)"O:swigregister", &obj)) return NULL; SWIG_TypeNewClientData(SWIGTYPE_p_AmptekSpectrum, SWIG_NewClientData(obj)); return SWIG_Py_Void(); } @@ -16311,6 +16692,18 @@ static PyMethodDef SwigMethods[] = { { (char *)"UIntVector_capacity", _wrap_UIntVector_capacity, METH_VARARGS, NULL}, { (char *)"delete_UIntVector", _wrap_delete_UIntVector, METH_VARARGS, NULL}, { (char *)"UIntVector_swigregister", UIntVector_swigregister, METH_VARARGS, NULL}, + { (char *)"new_AmptekDataPair", _wrap_new_AmptekDataPair, METH_VARARGS, NULL}, + { (char *)"AmptekDataPair_first_set", _wrap_AmptekDataPair_first_set, METH_VARARGS, NULL}, + { (char *)"AmptekDataPair_first_get", _wrap_AmptekDataPair_first_get, METH_VARARGS, NULL}, + { (char *)"AmptekDataPair_second_set", _wrap_AmptekDataPair_second_set, METH_VARARGS, NULL}, + { (char *)"AmptekDataPair_second_get", _wrap_AmptekDataPair_second_get, METH_VARARGS, NULL}, + { (char *)"delete_AmptekDataPair", _wrap_delete_AmptekDataPair, METH_VARARGS, NULL}, + { (char *)"AmptekDataPair_swigregister", AmptekDataPair_swigregister, METH_VARARGS, NULL}, + { (char *)"SPECLEN_swigconstant", SPECLEN_swigconstant, METH_VARARGS, NULL}, + { (char *)"NOT_CONNECTED_swigconstant", NOT_CONNECTED_swigconstant, METH_VARARGS, NULL}, + { (char *)"ON_swigconstant", ON_swigconstant, METH_VARARGS, NULL}, + { (char *)"RECORDING_swigconstant", RECORDING_swigconstant, METH_VARARGS, NULL}, + { (char *)"ERROR_swigconstant", ERROR_swigconstant, METH_VARARGS, NULL}, { (char *)"new_AmptekHardwareInterface", _wrap_new_AmptekHardwareInterface, METH_VARARGS, NULL}, { (char *)"delete_AmptekHardwareInterface", _wrap_delete_AmptekHardwareInterface, METH_VARARGS, NULL}, { (char *)"AmptekHardwareInterface_connectUSB", _wrap_AmptekHardwareInterface_connectUSB, METH_VARARGS, NULL}, @@ -16329,8 +16722,10 @@ static PyMethodDef SwigMethods[] = { { (char *)"AmptekHardwareInterface_EnableListMode", _wrap_AmptekHardwareInterface_EnableListMode, METH_VARARGS, NULL}, { (char *)"AmptekHardwareInterface_ResetListModeTimer", _wrap_AmptekHardwareInterface_ResetListModeTimer, METH_VARARGS, NULL}, { (char *)"AmptekHardwareInterface_DisableListMode", _wrap_AmptekHardwareInterface_DisableListMode, METH_VARARGS, NULL}, - { (char *)"AmptekHardwareInterface_startBuffering", _wrap_AmptekHardwareInterface_startBuffering, METH_VARARGS, NULL}, - { (char *)"AmptekHardwareInterface_stopBuffering", _wrap_AmptekHardwareInterface_stopBuffering, METH_VARARGS, NULL}, + { (char *)"AmptekHardwareInterface_startHardwareBuffering", _wrap_AmptekHardwareInterface_startHardwareBuffering, METH_VARARGS, NULL}, + { (char *)"AmptekHardwareInterface_stopHardwareBuffering", _wrap_AmptekHardwareInterface_stopHardwareBuffering, METH_VARARGS, NULL}, + { (char *)"AmptekHardwareInterface_BufferSpectrum", _wrap_AmptekHardwareInterface_BufferSpectrum, METH_VARARGS, NULL}, + { (char *)"AmptekHardwareInterface_BufferAndClearSpectrum", _wrap_AmptekHardwareInterface_BufferAndClearSpectrum, METH_VARARGS, NULL}, { (char *)"AmptekHardwareInterface_GetBufferedSpectrum", _wrap_AmptekHardwareInterface_GetBufferedSpectrum, METH_VARARGS, NULL}, { (char *)"AmptekHardwareInterface_StartCommtestStreaming", _wrap_AmptekHardwareInterface_StartCommtestStreaming, METH_VARARGS, NULL}, { (char *)"AmptekHardwareInterface_StopCommtestStreaming", _wrap_AmptekHardwareInterface_StopCommtestStreaming, METH_VARARGS, NULL}, @@ -16338,6 +16733,7 @@ static PyMethodDef SwigMethods[] = { { (char *)"AmptekHardwareInterface_GetTextConfiguration", _wrap_AmptekHardwareInterface_GetTextConfiguration, METH_VARARGS, NULL}, { (char *)"AmptekHardwareInterface_GetState", _wrap_AmptekHardwareInterface_GetState, METH_VARARGS, NULL}, { (char *)"AmptekHardwareInterface_swigregister", AmptekHardwareInterface_swigregister, METH_VARARGS, NULL}, + { (char *)"STATUS_SIZE_swigconstant", STATUS_SIZE_swigconstant, METH_VARARGS, NULL}, { (char *)"new_AmptekStatus", _wrap_new_AmptekStatus, METH_VARARGS, NULL}, { (char *)"delete_AmptekStatus", _wrap_delete_AmptekStatus, METH_VARARGS, NULL}, { (char *)"AmptekStatus_FastCount", _wrap_AmptekStatus_FastCount, METH_VARARGS, NULL}, @@ -16392,9 +16788,11 @@ static swig_type_info _swigt__p_allocator_type = {"_p_allocator_type", "allocato static swig_type_info _swigt__p_byte = {"_p_byte", "byte *", 0, 0, (void*)0, 0}; static swig_type_info _swigt__p_char = {"_p_char", "char *", 0, 0, (void*)0, 0}; static swig_type_info _swigt__p_difference_type = {"_p_difference_type", "difference_type *", 0, 0, (void*)0, 0}; +static swig_type_info _swigt__p_first_type = {"_p_first_type", "first_type *", 0, 0, (void*)0, 0}; static swig_type_info _swigt__p_int = {"_p_int", "intptr_t *|int *|int_least32_t *|int_fast32_t *|int32_t *|int_fast16_t *", 0, 0, (void*)0, 0}; static swig_type_info _swigt__p_long_long = {"_p_long_long", "int_least64_t *|int_fast64_t *|int64_t *|long long *|intmax_t *", 0, 0, (void*)0, 0}; static swig_type_info _swigt__p_p_PyObject = {"_p_p_PyObject", "PyObject **", 0, 0, (void*)0, 0}; +static swig_type_info _swigt__p_second_type = {"_p_second_type", "second_type *", 0, 0, (void*)0, 0}; static swig_type_info _swigt__p_short = {"_p_short", "short *|int_least16_t *|int16_t *", 0, 0, (void*)0, 0}; static swig_type_info _swigt__p_signed_char = {"_p_signed_char", "signed char *|int_least8_t *|int_fast8_t *|int8_t *", 0, 0, (void*)0, 0}; static swig_type_info _swigt__p_size_type = {"_p_size_type", "size_type *", 0, 0, (void*)0, 0}; @@ -16424,9 +16822,11 @@ static swig_type_info *swig_type_initial[] = { &_swigt__p_byte, &_swigt__p_char, &_swigt__p_difference_type, + &_swigt__p_first_type, &_swigt__p_int, &_swigt__p_long_long, &_swigt__p_p_PyObject, + &_swigt__p_second_type, &_swigt__p_short, &_swigt__p_signed_char, &_swigt__p_size_type, @@ -16456,9 +16856,11 @@ static swig_cast_info _swigc__p_allocator_type[] = { {&_swigt__p_allocator_type static swig_cast_info _swigc__p_byte[] = { {&_swigt__p_byte, 0, 0, 0},{0, 0, 0, 0}}; static swig_cast_info _swigc__p_char[] = { {&_swigt__p_char, 0, 0, 0},{0, 0, 0, 0}}; static swig_cast_info _swigc__p_difference_type[] = { {&_swigt__p_difference_type, 0, 0, 0},{0, 0, 0, 0}}; +static swig_cast_info _swigc__p_first_type[] = { {&_swigt__p_first_type, 0, 0, 0},{0, 0, 0, 0}}; static swig_cast_info _swigc__p_int[] = { {&_swigt__p_int, 0, 0, 0},{0, 0, 0, 0}}; static swig_cast_info _swigc__p_long_long[] = { {&_swigt__p_long_long, 0, 0, 0},{0, 0, 0, 0}}; static swig_cast_info _swigc__p_p_PyObject[] = { {&_swigt__p_p_PyObject, 0, 0, 0},{0, 0, 0, 0}}; +static swig_cast_info _swigc__p_second_type[] = { {&_swigt__p_second_type, 0, 0, 0},{0, 0, 0, 0}}; static swig_cast_info _swigc__p_short[] = { {&_swigt__p_short, 0, 0, 0},{0, 0, 0, 0}}; static swig_cast_info _swigc__p_signed_char[] = { {&_swigt__p_signed_char, 0, 0, 0},{0, 0, 0, 0}}; static swig_cast_info _swigc__p_size_type[] = { {&_swigt__p_size_type, 0, 0, 0},{0, 0, 0, 0}}; @@ -16488,9 +16890,11 @@ static swig_cast_info *swig_cast_initial[] = { _swigc__p_byte, _swigc__p_char, _swigc__p_difference_type, + _swigc__p_first_type, _swigc__p_int, _swigc__p_long_long, _swigc__p_p_PyObject, + _swigc__p_second_type, _swigc__p_short, _swigc__p_signed_char, _swigc__p_size_type, @@ -16890,6 +17294,7 @@ extern "C" { static int type_init = 0; if (!type_init) { const PyTypeObject tmp = { + /* PyObject header changed in Python 3 */ #if PY_VERSION_HEX >= 0x03000000 PyVarObject_HEAD_INIT(NULL, 0) #else @@ -17121,13 +17526,13 @@ SWIG_init(void) { static PyGetSetDef thisown_getset_def = { (char *)"thisown", SwigPyBuiltin_GetterClosure, SwigPyBuiltin_SetterClosure, NULL, &thisown_getset_closure }; + PyObject *metatype_args; PyTypeObject *builtin_pytype; int builtin_base_count; swig_type_info *builtin_basetype; PyObject *tuple; PyGetSetDescrObject *static_getset; PyTypeObject *metatype; - PyTypeObject *swigpyobject; SwigPyClientData *cd; PyObject *public_interface, *public_symbol; PyObject *this_descr; @@ -17142,9 +17547,14 @@ SWIG_init(void) { (void)static_getset; (void)self; - /* Metaclass is used to implement static member variables */ - metatype = SwigPyObjectType(); + /* metatype is used to implement static member variables. */ + metatype_args = Py_BuildValue("(s(O){})", "SwigPyObjectType", &PyType_Type); + assert(metatype_args); + metatype = (PyTypeObject *) PyType_Type.tp_call((PyObject *) &PyType_Type, metatype_args, NULL); assert(metatype); + Py_DECREF(metatype_args); + metatype->tp_setattro = (setattrofunc) &SwigPyObjectType_setattro; + assert(PyType_Ready(metatype) >= 0); #endif /* Fix SwigMethods to carry the callback ptrs when needed */ @@ -17162,15 +17572,13 @@ SWIG_init(void) { SWIG_InitializeModule(0); #ifdef SWIGPYTHON_BUILTIN - swigpyobject = SwigPyObject_TypeOnce(); - SwigPyObject_stype = SWIG_MangledTypeQuery("_p_SwigPyObject"); assert(SwigPyObject_stype); cd = (SwigPyClientData*) SwigPyObject_stype->clientdata; if (!cd) { SwigPyObject_stype->clientdata = &SwigPyObject_clientdata; - SwigPyObject_clientdata.pytype = swigpyobject; - } else if (swigpyobject->tp_basicsize != cd->pytype->tp_basicsize) { + SwigPyObject_clientdata.pytype = SwigPyObject_TypeOnce(); + } else if (SwigPyObject_TypeOnce()->tp_basicsize != cd->pytype->tp_basicsize) { PyErr_SetString(PyExc_RuntimeError, "Import error: attempted to load two incompatible swig-generated modules."); # if PY_VERSION_HEX >= 0x03000000 return NULL; @@ -17204,12 +17612,6 @@ SWIG_init(void) { import_array(); - SWIG_Python_SetConstant(d, "SPECLEN",SWIG_From_int(static_cast< int >(8192))); - SWIG_Python_SetConstant(d, "NOT_CONNECTED",SWIG_From_int(static_cast< int >(NOT_CONNECTED))); - SWIG_Python_SetConstant(d, "ON",SWIG_From_int(static_cast< int >(ON))); - SWIG_Python_SetConstant(d, "RECORDING",SWIG_From_int(static_cast< int >(RECORDING))); - SWIG_Python_SetConstant(d, "ERROR",SWIG_From_int(static_cast< int >(ERROR))); - SWIG_Python_SetConstant(d, "STATUS_SIZE",SWIG_From_int(static_cast< int >(64))); #if PY_VERSION_HEX >= 0x03000000 return m; #else diff --git a/python/amptek_hardware_interface/AmptekPX5 b/python/amptek_hardware_interface/AmptekPX5 index 352e635bc68ac39d25179d7c4412e3c2588d0c72..7bb022d6e9f507b90b34848326fdf8883f42ea1f 100644 --- a/python/amptek_hardware_interface/AmptekPX5 +++ b/python/amptek_hardware_interface/AmptekPX5 @@ -461,6 +461,27 @@ class AmptekPX5(Device): f.write( self.create_dp5_config_string() ) f.write( self.create_dpp_status_string() ) + + @command(dtype_in=(str,) ) + def SaveBufferedSpectrumAsMCA(self, args): + buffer_index, filepath = args + buffer_index= int(buffer_index) + if os.path.exists(filepath): + self.set_state(tango.DevState.ALARM) + raise RuntimeError("File already exists!") + if not os.path.exists(os.path.dirname(filepath)): + self.set_state(tango.DevState.ALARM) + raise RuntimeError("Directory %s does not exist (filename: %s)!"%(os.path.dirname(filepath), filepath) ) + + spectrum, status = self.interface.GetBufferedSpectrum( buffer_index ) + + with open(filepath, "w+") as f: + f.write( self.create_pmca_spectrum_string() ) + f.write( self.create_calibration_string() ) + f.write( self.create_data_string() ) + f.write( self.create_dp5_config_string() ) + f.write( self.create_dpp_status_string() ) + @command(dtype_in=(int,)) def StartCommtestStreaming(self, args): print("test") @@ -476,6 +497,18 @@ class AmptekPX5(Device): def StopCommtestStreaming(self): self.interface.StopCommtestStreaming() + + @command(dtype_in = int) + def BufferSpectrum(self, index): + self.interface.BufferSpectrum(index) + + @command(dtype_in = int) + def BufferAndClearSpectrum(self, index): + self.interface.BufferAndClearSpectrum(index) + + + + def set_maxinfoage(self, x): self._max_info_age = x @@ -551,7 +584,7 @@ class AmptekPX5(Device): @command def ClearAlarm(self): - self.set_state(DevState.On) + self.set_state(DevState.ON) self.dev_state() def set_calibrationslope(self, val): @@ -667,7 +700,7 @@ class AmptekPX5(Device): - def create_dpp_status_string(self): + def create_dpp_status_string(self, status = None): template = ("<<DPP STATUS>>\n" "Device Type: {dev_type}\n" "Serial Number: {serial_nb}\n" @@ -683,7 +716,8 @@ class AmptekPX5(Device): "TEC Temp: {detector_temp:.1f}K\n" "Board Temp: {board_temp:.1f}C\n" "<<DPP STATUS END>>\n") - status = self.interface.updateStatus(0) + if status is None: + status = self.interface.updateStatus(0) outstring = template.format( dev_type = status.DeviceType(), serial_nb = status.SerialNb(), @@ -722,9 +756,11 @@ class AmptekPX5(Device): def create_calibration_string(self): return "" - def create_data_string(self): + def create_data_string(self, spectrum = None): + if spectrum is None: + spectrum = self.GetSpectrum(self._max_info_age) outstring = "<<DATA>>\n" - outstring += "\n".join([str(c) for c in self.GetSpectrum(self._max_info_age)] ) + "\n" + outstring += "\n".join([str(c) for c in spectrum] ) + "\n" outstring += "<<END>>\n" return outstring diff --git a/src/AmptekHardwareInterface.cpp b/src/AmptekHardwareInterface.cpp index 256c8c540ec57a7f8d279b86f2e4018d7a647fc5..6776e66dc7f21eb22f4eca22280e606de4b74d65 100644 --- a/src/AmptekHardwareInterface.cpp +++ b/src/AmptekHardwareInterface.cpp @@ -553,7 +553,7 @@ bool AmptekHardwareInterface::ResetListModeTimer(){ * @return true on success * @return false on failure */ -bool AmptekHardwareInterface::startBuffering(){ +bool AmptekHardwareInterface::startHardwareBuffering(){ try{ expectAcknowledge(connection_handler->sendAndReceive( Packet::DP5_PKT_REQUEST_RESTART_SEQ_BUFFERING) ); } @@ -572,7 +572,7 @@ bool AmptekHardwareInterface::startBuffering(){ * @return true on success * @return false on failure */ -bool AmptekHardwareInterface::stopBuffering(){ +bool AmptekHardwareInterface::stopHardwareBuffering(){ try{ expectAcknowledge(connection_handler->sendAndReceive( Packet::DP5_PKT_REQUEST_CANCEL_SEQ_BUFFERING) ); } @@ -584,6 +584,33 @@ bool AmptekHardwareInterface::stopBuffering(){ return true; } + + +bool AmptekHardwareInterface::BufferAndClearSpectrum(uint16_t index){ + try{ + expectAcknowledge(connection_handler->sendAndReceive( Packet::generateBufferAndClearRequest(index) ) ); + } + catch(AmptekException& e){ + + std::cerr<< "Failed sending buffer request: " << e.what() << std::endl; + return false; + } + return true; +} + + +bool AmptekHardwareInterface::BufferSpectrum(uint16_t index){ + try{ + expectAcknowledge(connection_handler->sendAndReceive( Packet::generateBufferRequest(index) ) ); + } + catch(AmptekException& e){ + + std::cerr<< "Failed sending buffer request: " << e.what() << std::endl; + return false; + } + return true; +} + /** * @brief Get Status and spectrum stored in an hardware buffer on the detector * diff --git a/src/AmptekSimulatorConnectionHandler.cpp b/src/AmptekSimulatorConnectionHandler.cpp index 48a2443419a163fdce791922bc1edb80ec1a237b..c70ce8c035b55be97ca51af93663a97d8a92231e 100644 --- a/src/AmptekSimulatorConnectionHandler.cpp +++ b/src/AmptekSimulatorConnectionHandler.cpp @@ -44,7 +44,7 @@ Packet AmptekSimulatorConnectionHandler::sendAndReceive( const Packet& request){ p.setData(arr, len); } else if (pid1 == Packet::DP5_PKT_REQUEST_SPECTRUM_AND_STATUS.at(PID1) - && pid2 == Packet::DP5_PKT_REQUEST_SPECTRUM_AND_STATUS.at(PID2)) + && (pid2 == DP5_P2_SPECTRUM_REQUEST_SPECTRUM_STATUS || pid2 == DP5_P2_SPECTRUM_REQUEST_GET_BUFFER) ) { p.setPid1( DP5_P1_SPECTRUM_RESPONSE ); switch (speclen){ @@ -86,26 +86,16 @@ Packet AmptekSimulatorConnectionHandler::sendAndReceive( const Packet& request){ p.resize( MIN_PACKET_LEN + len ); p.setData(arr, len); } - else if (pid1 == 0x20 - && pid2 == 0x03) + else if (pid1 == DP5_P1_TEXTCONFIG_REQUEST + && pid2 == DP5_P2_TEXTCONFIG_REQUEST_GET) { p.setPid1( DP5_P1_DATA_RESPONSE ); p.setPid2( DP5_P2_DATA_RESPONSE_CONFIG_READBACK ); char configs[ request.dataLength + 1 ]; byteToChar( (byte*)&(request.at(DATA)), configs, request.dataLength ); - std::cout << configs << std::endl; string configstring = buildConfigResponse(configs); std::cout << configstring << std::endl; - // std::stringstream configs; - - // configs << "MCAC=" << std::to_string(speclen) << ";PRET="; - // if (acquisition_time > 0){ - // configs << std::setw(2) << std::fixed << acquisition_time; - // } else{ - // configs << "OFF"; - // } - // string configstring = configs.str(); word16 len = configstring.size(); byte arr[len]; charToByte(configstring.c_str(), arr, len); @@ -135,14 +125,17 @@ Packet AmptekSimulatorConnectionHandler::sendAndReceive( const Packet& request){ { return Packet(DP5_P1_ACK, DP5_P2_ACK_OK, nullptr, 0); } - else if(pid1 == 0x20 //set Text Config - && pid2 == 0x02) + else if(pid1 == DP5_P1_TEXTCONFIG_REQUEST + && pid2 == DP5_P2_TEXTCONFIG_REQUEST_SET) { char configs[ request.dataLength + 1 ]; byteToChar( (byte*)&(request.at(DATA)), configs, request.dataLength ); readConfig(configs); return Packet(DP5_P1_ACK, DP5_P2_ACK_OK, nullptr, 0); } + else{ + return Packet(DP5_P1_ACK, DP5_P2_ACK_OK, nullptr, 0); + } p.calcAndFillChecksum(); return p; @@ -151,6 +144,7 @@ Packet AmptekSimulatorConnectionHandler::sendAndReceive( const Packet& request){ AmptekSimulatorConnectionHandler::AmptekSimulatorConnectionHandler(){ spectrum = new unsigned int[speclen]; clear(); + initConfigs(); spectrum_thread = new std::thread( [&]{ auto start_time = std::chrono::system_clock::now(); @@ -299,4 +293,76 @@ std::string AmptekSimulatorConnectionHandler::buildConfigResponse(char* config_ } } return configresponse_stream.str(); -} \ No newline at end of file +} + + + +void AmptekSimulatorConnectionHandler::initConfigs(){ + text_configs["AINP"] = "NEG"; + text_configs["AU34"] = "1"; + text_configs["AUO1"] = "ICR"; + text_configs["AUO2"] = "ICR"; + text_configs["BLRD"] = "0"; + text_configs["BLRM"] = "OFF"; + text_configs["BLRU"] = "0"; + text_configs["CON1"] = "DAC"; + text_configs["CON2"] = "AUXOUT2"; + text_configs["CLCK"] = "AUTO"; + text_configs["CLKL"] = "100"; + text_configs["CUSP"] = "0"; + text_configs["DACF"] = "0"; + text_configs["DACO"] = "OFF"; + text_configs["GAIA"] = "0"; + text_configs["GAIF"] = "1"; + text_configs["GAIN"] = "1"; + text_configs["GATE"] = "OFF"; + text_configs["GPED"] = "FALLING"; + text_configs["GPGA"] = "ON"; + text_configs["GPIN"] = "AUX1"; + text_configs["GPMC"] = "ON"; + text_configs["GPME"] = "ON"; + text_configs["HVSE"] = "OFF"; + text_configs["INOF"] = "DEF"; + text_configs["INOG"] = "LOW"; + text_configs["MCAC"] = std::to_string(speclen); + text_configs["MCAE"] = "OFF"; + text_configs["MCAS"] = "NORM"; + text_configs["MCSL"] = "0"; + text_configs["MCSH"] = "8191"; + text_configs["MCST"] = "1"; + text_configs["PAPS"] = "OFF"; + text_configs["PAPZ"] = "OFF"; + text_configs["PDMD"] = "NORM"; + text_configs["PRCL"] = "0"; + text_configs["PRCH"] = "8191"; + text_configs["PREC"] = "OFF"; + text_configs["PREL"] = "OFF"; + text_configs["PRER"] = "OFF"; + text_configs["PRET"] = "OFF"; + text_configs["PURE"] = "OFF"; + text_configs["RESL"] = "OFF"; + text_configs["RTDD"] = "0"; + text_configs["RTDE"] = "OFF"; + text_configs["RTDS"] = "0"; + text_configs["RTDT"] = "0"; + text_configs["RTDW"] = "0"; + text_configs["SCAH"] = "0"; + text_configs["SCAI"] = "1"; + text_configs["SCAL"] = "0"; + text_configs["SCAO"] = "OFF"; + text_configs["SCAW"] = "100"; + text_configs["SCOE"] = "RISING"; + text_configs["SCOG"] = "1"; + text_configs["SCOT"] = "87"; + text_configs["SOFF"] = "OFF"; + text_configs["SYNC"] = "INT"; + text_configs["TECS"] = "OFF"; + text_configs["TFLA"] = "0"; + text_configs["THFA"] = "0"; + text_configs["THSL"] = "0"; + text_configs["TLLD"] = "OFF"; + text_configs["TPEA"] = "0.4"; + text_configs["TPFA"] = "400"; + text_configs["TPMO"] = "OFF"; + text_configs["VOLU"] = "OFF"; +}