Commit 1d72749d authored by Pavel Vainerman's avatar Pavel Vainerman

Потихоньку избавляюсь от char*

parent 89edf1eb
......@@ -169,7 +169,7 @@ class DBServer_MySQL:
bool writeToBase( const string& query );
void createTables( MySQLInterface* db );
inline const char* tblName(int key)
inline std::string tblName( int key )
{
return tblMap[key].c_str();
}
......
......@@ -46,9 +46,9 @@ class DBServer_PostgreSQL:
bool writeToBase( const string& query );
void createTables( std::shared_ptr<PostgreSQLInterface>& db );
inline const char* tblName(int key)
inline std::string tblName(int key)
{
return tblMap[key].c_str();
return tblMap[key];
}
enum Timers
......
......@@ -169,9 +169,9 @@ class DBServer_SQLite:
bool writeToBase( const string& query );
void createTables( SQLiteInterface* db );
inline const char* tblName(int key)
inline std::string tblName(int key)
{
return tblMap[key].c_str();
return tblMap[key];
}
enum Timers
......
......@@ -38,21 +38,16 @@
class ObjectRepositoryFactory: private ObjectRepository
{
public:
// ObjectRepositoryFactory();
// ObjectRepositoryFactory(int* argc=argc_ptr, char* **argv=argv_ptr); // параметры инициализации ORB
ObjectRepositoryFactory( const std::shared_ptr<UniSetTypes::Configuration>& conf );
~ObjectRepositoryFactory();
//! Создание секции
bool createSection(const char* name, const char* in_section )throw(UniSetTypes::ORepFailed, UniSetTypes::InvalidObjectName);
/*! \overload */
bool createSection(const std::string& name, const std::string& in_section)throw(UniSetTypes::ORepFailed, UniSetTypes::InvalidObjectName);
/*! Создание секции по полному имени */
bool createSectionF(const std::string& fullName)throw(UniSetTypes::ORepFailed, UniSetTypes::InvalidObjectName);
//! Функция создания секции в корневом 'каталоге'
bool createRootSection(const char* name);
/*! \overload */
bool createRootSection(const std::string& name);
......@@ -76,7 +71,7 @@ class ObjectRepositoryFactory: private ObjectRepository
private:
/*! Создание нового контекста(секции) */
bool createContext(const char* cname, CosNaming::NamingContext_ptr ctx);
bool createContext( const std::string& cname, CosNaming::NamingContext_ptr ctx);
};
//};
......
......@@ -112,11 +112,6 @@ class ThreadCreator:
ost::PosixThread::setName( name.c_str() );
}
inline void setName( const char* name )
{
ost::PosixThread::setName( name );
}
inline void setCancel( ost::Thread::Cancel mode )
{
ost::PosixThread::setCancel(mode);
......
......@@ -199,13 +199,9 @@ class UInterface
// Работа с ID, Name
/*! получение идентификатора объекта по имени */
inline UniSetTypes::ObjectId getIdByName( const char* name ) const
{
return oind->getIdByName(name);
}
inline UniSetTypes::ObjectId getIdByName( const std::string& name ) const
{
return getIdByName(name.c_str());
return oind->getIdByName(name);
}
/*! получение имени по идентификатору объекта */
......
......@@ -189,7 +189,7 @@ namespace UniSetTypes
/*! Функция разбора строки вида: id1@node1=val1,id2@node2=val2,...
Если '=' не указано, возвращается val=0
Если @node не указано, возвращается node=DefaultObjectId */
Если @node не указано, возвращается node=DefaultObjectId */
std::list<ParamSInfo> getSInfoList( const std::string& s, std::shared_ptr<UniSetTypes::Configuration> conf = nullptr );
......
......@@ -109,7 +109,7 @@
\endcode
*
*
* \todo Нужно добавить поддержку "пользователских типов" (возможно нужно использовать variadic templates)
* \todo Нужно добавить поддержку "пользовательских типов" (возможно нужно использовать variadic templates)
*/
class VMonitor
{
......
......@@ -10,13 +10,13 @@ using namespace std;
//---------------------------------------------------------------------------
static UInterface* ui = 0;
//---------------------------------------------------------------------------
void pyUInterface::uniset_init_params( UTypes::Params* p, const char* xmlfile )throw(UException)
void pyUInterface::uniset_init_params( UTypes::Params* p, const std::string& xmlfile )throw(UException)
{
pyUInterface::uniset_init(p->argc, p->argv, xmlfile);
}
//---------------------------------------------------------------------------
void pyUInterface::uniset_init( int argc, char* argv[], const char* xmlfile )throw(UException)
void pyUInterface::uniset_init( int argc, char* argv[], const std::string& xmlfile )throw(UException)
{
try
{
......@@ -118,7 +118,7 @@ void pyUInterface::setValue( long id, long val )throw(UException)
}
}
//---------------------------------------------------------------------------
long pyUInterface::getSensorID( const char* name )
long pyUInterface::getSensorID(const string& name )
{
auto conf = UniSetTypes::uniset_conf();
......@@ -128,42 +128,42 @@ long pyUInterface::getSensorID( const char* name )
return UniSetTypes::DefaultObjectId;
}
//---------------------------------------------------------------------------
const char* pyUInterface::getName( long id )
std::string pyUInterface::getName( long id )
{
auto conf = UniSetTypes::uniset_conf();
if( conf )
return UniSetTypes::uni_strdup(conf->oind->getMapName(id));
return conf->oind->getMapName(id);
return "";
}
//---------------------------------------------------------------------------
const char* pyUInterface::getShortName( long id )
string pyUInterface::getShortName( long id )
{
auto conf = UniSetTypes::uniset_conf();
if( conf )
return UniSetTypes::uni_strdup(ORepHelpers::getShortName(conf->oind->getMapName(id)));
return ORepHelpers::getShortName(conf->oind->getMapName(id));
return "";
}
//---------------------------------------------------------------------------
const char* pyUInterface::getTextName( long id )
std::string pyUInterface::getTextName( long id )
{
auto conf = UniSetTypes::uniset_conf();
if( conf )
return UniSetTypes::uni_strdup(conf->oind->getTextName(id));
return conf->oind->getTextName(id);
return "";
}
//---------------------------------------------------------------------------
const char* pyUInterface::getConfFileName()
string pyUInterface::getConfFileName()
{
auto conf = UniSetTypes::uniset_conf();
if( conf )
return UniSetTypes::uni_strdup(conf->getConfFileName());
return conf->getConfFileName();
return "";
......
......@@ -7,20 +7,20 @@
// --------------------------------------------------------------------------
namespace pyUInterface
{
void uniset_init_params( UTypes::Params* p, const char* xmlfile )throw(UException);
void uniset_init( int argc, char** argv, const char* xmlfile )throw(UException);
void uniset_init_params( UTypes::Params* p, const std::string& xmlfile )throw(UException);
void uniset_init( int argc, char** argv, const std::string& xmlfile )throw(UException);
//---------------------------------------------------------------------------
long getValue( long id )throw(UException);
void setValue( long id, long val )throw(UException);
long getSensorID( const char* );
long getSensorID( const std::string& name );
const char* getShortName( long id );
const char* getName( long id );
const char* getTextName( long id );
std::string getShortName( long id );
std::string getName( long id );
std::string getTextName( long id );
const char* getConfFileName();
std::string getConfFileName();
}
//---------------------------------------------------------------------------
......
......@@ -3,7 +3,7 @@
// --------------------------------------------------------------------------
using namespace std;
// --------------------------------------------------------------------------
UConnector::UConnector( UTypes::Params* p, const char* xfile )throw(UException):
UConnector::UConnector( UTypes::Params* p, const std::string& xfile )throw(UException):
conf(0),
ui(0),
xmlfile(xfile)
......@@ -23,7 +23,7 @@ UConnector::UConnector( UTypes::Params* p, const char* xfile )throw(UException):
}
}
//---------------------------------------------------------------------------
UConnector::UConnector( int argc, char** argv, const char* xfile )throw(UException):
UConnector::UConnector(int argc, char** argv, const string& xfile )throw(UException):
conf(0),
ui(0),
xmlfile(xfile)
......@@ -47,11 +47,11 @@ UConnector::~UConnector()
{
}
// --------------------------------------------------------------------------
const char* UConnector::getConfFileName()
string UConnector::getConfFileName()
{
// return xmlfile;
if( conf )
return UniSetTypes::uni_strdup(conf->getConfFileName());
return conf->getConfFileName();
return "";
......@@ -102,7 +102,7 @@ void UConnector::setValue( long id, long val, long node )throw(UException)
}
}
//---------------------------------------------------------------------------
long UConnector::getSensorID( const char* name )
long UConnector::getSensorID(const string& name )
{
if( conf )
return conf->getSensorID(name);
......@@ -110,7 +110,7 @@ long UConnector::getSensorID( const char* name )
return UTypes::DefaultID;
}
//---------------------------------------------------------------------------
long UConnector::getNodeID( const char* name )
long UConnector::getNodeID(const string& name )
{
if( conf )
return conf->getNodeID(name);
......@@ -118,26 +118,26 @@ long UConnector::getNodeID( const char* name )
return UTypes::DefaultID;
}
//---------------------------------------------------------------------------
const char* UConnector::getName( long id )
string UConnector::getName( long id )
{
if( conf )
return UniSetTypes::uni_strdup(conf->oind->getMapName(id));
return conf->oind->getMapName(id);
return "";
}
//---------------------------------------------------------------------------
const char* UConnector::getShortName( long id )
string UConnector::getShortName( long id )
{
if( conf )
return UniSetTypes::uni_strdup(ORepHelpers::getShortName(conf->oind->getMapName(id)));
return ORepHelpers::getShortName(conf->oind->getMapName(id));
return "";
}
//---------------------------------------------------------------------------
const char* UConnector::getTextName( long id )
string UConnector::getTextName( long id )
{
if( conf )
return UniSetTypes::uni_strdup(conf->oind->getTextName(id));
return conf->oind->getTextName(id);
return "";
}
......
......@@ -11,31 +11,30 @@
class UConnector
{
public:
UConnector( int argc, char** argv, const char* xmlfile )throw(UException);
UConnector( UTypes::Params* p, const char* xmlfile )throw(UException);
UConnector( int argc, char** argv, const std::string& xmlfile )throw(UException);
UConnector( UTypes::Params* p, const std::string& xmlfile )throw(UException);
~UConnector();
inline const char* getUIType()
inline std::string getUIType()
{
return "uniset";
return string("uniset");
}
const char* getConfFileName();
std::string getConfFileName();
long getValue( long id, long node )throw(UException);
void setValue( long id, long val, long node )throw(UException);
long getSensorID( const char* );
long getNodeID( const char* );
const char* getShortName( long id );
const char* getName( long id );
const char* getTextName( long id );
long getSensorID( const std::string& name );
long getNodeID( const std::string& name );
std::string getShortName( long id );
std::string getName( long id );
std::string getTextName( long id );
private:
std::shared_ptr<UniSetTypes::Configuration> conf;
std::shared_ptr<UInterface> ui;
const char* xmlfile;
std::string xmlfile;
};
//---------------------------------------------------------------------------
#endif
......
......@@ -3,6 +3,7 @@
* to regenerate the wrappers run:
* swig -python UInterface.i
***********************************************************/
%include <std_string.i>
%module pyUConnector
%{
......
/* ----------------------------------------------------------------------------
* This file was automatically generated by SWIG (http://www.swig.org).
* Version 3.0.6
* Version 3.0.7
*
* 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
......@@ -2998,7 +2998,7 @@ static swig_module_info swig_module = {swig_types, 5, 0, 0, 0, 0};
#endif
#define SWIG_name "_pyUConnector"
#define SWIGVERSION 0x030006
#define SWIGVERSION 0x030007
#define SWIG_VERSION SWIGVERSION
......@@ -3079,6 +3079,9 @@ namespace swig {
}
#include <string>
#include "UConnector.h"
......@@ -3336,6 +3339,37 @@ SWIG_AsVal_int (PyObject * obj, int *val)
}
SWIGINTERN int
SWIG_AsPtr_std_string (PyObject * obj, std::string **val)
{
char* buf = 0 ; size_t size = 0; int alloc = SWIG_OLDOBJ;
if (SWIG_IsOK((SWIG_AsCharPtrAndSize(obj, &buf, &size, &alloc)))) {
if (buf) {
if (val) *val = new std::string(buf, size - 1);
if (alloc == SWIG_NEWOBJ) delete[] buf;
return SWIG_NEWOBJ;
} else {
if (val) *val = 0;
return SWIG_OLDOBJ;
}
} else {
static int init = 0;
static swig_type_info* descriptor = 0;
if (!init) {
descriptor = SWIG_TypeQuery("std::string" " *");
init = 1;
}
if (descriptor) {
std::string *vptr;
int res = SWIG_ConvertPtr(obj, (void**)&vptr, descriptor, 0);
if (SWIG_IsOK(res) && val) *val = vptr;
return res;
}
}
return SWIG_ERROR;
}
SWIGINTERNINLINE PyObject *
SWIG_FromCharPtrAndSize(const char* carray, size_t size)
{
......@@ -3361,10 +3395,10 @@ SWIG_FromCharPtrAndSize(const char* carray, size_t size)
}
SWIGINTERNINLINE PyObject *
SWIG_FromCharPtr(const char *cptr)
{
return SWIG_FromCharPtrAndSize(cptr, (cptr ? strlen(cptr) : 0));
SWIGINTERNINLINE PyObject *
SWIG_From_std_string (const std::string& s)
{
return SWIG_FromCharPtrAndSize(s.data(), s.size());
}
#ifdef __cplusplus
......@@ -3587,14 +3621,12 @@ SWIGINTERN PyObject *_wrap_new_UConnector__SWIG_0(PyObject *SWIGUNUSEDPARM(self)
PyObject *resultobj = 0;
int arg1 ;
char **arg2 = (char **) 0 ;
char *arg3 = (char *) 0 ;
std::string *arg3 = 0 ;
int val1 ;
int ecode1 = 0 ;
void *argp2 = 0 ;
int res2 = 0 ;
int res3 ;
char *buf3 = 0 ;
int alloc3 = 0 ;
int res3 = SWIG_OLDOBJ ;
PyObject * obj0 = 0 ;
PyObject * obj1 = 0 ;
PyObject * obj2 = 0 ;
......@@ -3611,23 +3643,29 @@ SWIGINTERN PyObject *_wrap_new_UConnector__SWIG_0(PyObject *SWIGUNUSEDPARM(self)
SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "new_UConnector" "', argument " "2"" of type '" "char **""'");
}
arg2 = reinterpret_cast< char ** >(argp2);
res3 = SWIG_AsCharPtrAndSize(obj2, &buf3, NULL, &alloc3);
if (!SWIG_IsOK(res3)) {
SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "new_UConnector" "', argument " "3"" of type '" "char const *""'");
{
std::string *ptr = (std::string *)0;
res3 = SWIG_AsPtr_std_string(obj2, &ptr);
if (!SWIG_IsOK(res3)) {
SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "new_UConnector" "', argument " "3"" of type '" "std::string const &""'");
}
if (!ptr) {
SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "new_UConnector" "', argument " "3"" of type '" "std::string const &""'");
}
arg3 = ptr;
}
arg3 = reinterpret_cast< char * >(buf3);
try {
result = (UConnector *)new UConnector(arg1,arg2,(char const *)arg3);
result = (UConnector *)new UConnector(arg1,arg2,(std::string const &)*arg3);
}
catch(UException &_e) {
SWIG_Python_Raise(SWIG_NewPointerObj((new UException(static_cast< const UException& >(_e))),SWIGTYPE_p_UException,SWIG_POINTER_OWN), "UException", SWIGTYPE_p_UException); SWIG_fail;
}
resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_UConnector, SWIG_POINTER_NEW | 0 );
if (alloc3 == SWIG_NEWOBJ) delete[] buf3;
if (SWIG_IsNewObj(res3)) delete arg3;
return resultobj;
fail:
if (alloc3 == SWIG_NEWOBJ) delete[] buf3;
if (SWIG_IsNewObj(res3)) delete arg3;
return NULL;
}
......@@ -3635,12 +3673,10 @@ fail:
SWIGINTERN PyObject *_wrap_new_UConnector__SWIG_1(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
PyObject *resultobj = 0;
UTypes::Params *arg1 = (UTypes::Params *) 0 ;
char *arg2 = (char *) 0 ;
std::string *arg2 = 0 ;
void *argp1 = 0 ;
int res1 = 0 ;
int res2 ;
char *buf2 = 0 ;
int alloc2 = 0 ;
int res2 = SWIG_OLDOBJ ;
PyObject * obj0 = 0 ;
PyObject * obj1 = 0 ;
UConnector *result = 0 ;
......@@ -3651,30 +3687,38 @@ SWIGINTERN PyObject *_wrap_new_UConnector__SWIG_1(PyObject *SWIGUNUSEDPARM(self)
SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "new_UConnector" "', argument " "1"" of type '" "UTypes::Params *""'");
}
arg1 = reinterpret_cast< UTypes::Params * >(argp1);
res2 = SWIG_AsCharPtrAndSize(obj1, &buf2, NULL, &alloc2);
if (!SWIG_IsOK(res2)) {
SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "new_UConnector" "', argument " "2"" of type '" "char const *""'");
{
std::string *ptr = (std::string *)0;
res2 = SWIG_AsPtr_std_string(obj1, &ptr);
if (!SWIG_IsOK(res2)) {
SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "new_UConnector" "', argument " "2"" of type '" "std::string const &""'");
}
if (!ptr) {
SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "new_UConnector" "', argument " "2"" of type '" "std::string const &""'");
}
arg2 = ptr;
}
arg2 = reinterpret_cast< char * >(buf2);
try {
result = (UConnector *)new UConnector(arg1,(char const *)arg2);
result = (UConnector *)new UConnector(arg1,(std::string const &)*arg2);
}
catch(UException &_e) {
SWIG_Python_Raise(SWIG_NewPointerObj((new UException(static_cast< const UException& >(_e))),SWIGTYPE_p_UException,SWIG_POINTER_OWN), "UException", SWIGTYPE_p_UException); SWIG_fail;
}
resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_UConnector, SWIG_POINTER_NEW | 0 );
if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
if (SWIG_IsNewObj(res2)) delete arg2;
return resultobj;
fail:
if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
if (SWIG_IsNewObj(res2)) delete arg2;
return NULL;
}
SWIGINTERN PyObject *_wrap_new_UConnector(PyObject *self, PyObject *args) {
int argc;
PyObject *argv[4];
PyObject *argv[4] = {
0
};
int ii;
if (!PyTuple_Check(args)) SWIG_fail;
......@@ -3688,7 +3732,7 @@ SWIGINTERN PyObject *_wrap_new_UConnector(PyObject *self, PyObject *args) {
int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_UTypes__Params, 0);
_v = SWIG_CheckState(res);
if (_v) {
int res = SWIG_AsCharPtrAndSize(argv[1], 0, NULL, 0);
int res = SWIG_AsPtr_std_string(argv[1], (std::string**)(0));
_v = SWIG_CheckState(res);
if (_v) {
return _wrap_new_UConnector__SWIG_1(self, args);
......@@ -3706,7 +3750,7 @@ SWIGINTERN PyObject *_wrap_new_UConnector(PyObject *self, PyObject *args) {
int res = SWIG_ConvertPtr(argv[1], &vptr, SWIGTYPE_p_p_char, 0);
_v = SWIG_CheckState(res);
if (_v) {
int res = SWIG_AsCharPtrAndSize(argv[2], 0, NULL, 0);
int res = SWIG_AsPtr_std_string(argv[2], (std::string**)(0));
_v = SWIG_CheckState(res);
if (_v) {
return _wrap_new_UConnector__SWIG_0(self, args);
......@@ -3718,8 +3762,8 @@ SWIGINTERN PyObject *_wrap_new_UConnector(PyObject *self, PyObject *args) {
fail:
SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number or type of arguments for overloaded function 'new_UConnector'.\n"
" Possible C/C++ prototypes are:\n"
" UConnector::UConnector(int,char **,char const *)\n"
" UConnector::UConnector(UTypes::Params *,char const *)\n");
" UConnector::UConnector(int,char **,std::string const &)\n"
" UConnector::UConnector(UTypes::Params *,std::string const &)\n");
return 0;
}
......@@ -3751,7 +3795,7 @@ SWIGINTERN PyObject *_wrap_UConnector_getUIType(PyObject *SWIGUNUSEDPARM(self),
void *argp1 = 0 ;
int res1 = 0 ;
PyObject * obj0 = 0 ;
char *result = 0 ;
std::string result;
if (!PyArg_ParseTuple(args,(char *)"O:UConnector_getUIType",&obj0)) SWIG_fail;
res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_UConnector, 0 | 0 );
......@@ -3759,8 +3803,8 @@ SWIGINTERN PyObject *_wrap_UConnector_getUIType(PyObject *SWIGUNUSEDPARM(self),
SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "UConnector_getUIType" "', argument " "1"" of type '" "UConnector *""'");
}
arg1 = reinterpret_cast< UConnector * >(argp1);
result = (char *)(arg1)->getUIType();
resultobj = SWIG_FromCharPtr((const char *)result);
result = (arg1)->getUIType();
resultobj = SWIG_From_std_string(static_cast< std::string >(result));
return resultobj;
fail:
return NULL;
......@@ -3773,7 +3817,7 @@ SWIGINTERN PyObject *_wrap_UConnector_getConfFileName(PyObject *SWIGUNUSEDPARM(s
void *argp1 = 0 ;
int res1 = 0 ;
PyObject * obj0 = 0 ;
char *result = 0 ;
std::string result;
if (!PyArg_ParseTuple(args,(char *)"O:UConnector_getConfFileName",&obj0)) SWIG_fail;
res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_UConnector, 0 | 0 );
......@@ -3781,8 +3825,8 @@ SWIGINTERN PyObject *_wrap_UConnector_getConfFileName(PyObject *SWIGUNUSEDPARM(s
SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "UConnector_getConfFileName" "', argument " "1"" of type '" "UConnector *""'");
}
arg1 = reinterpret_cast< UConnector * >(argp1);
result = (char *)(arg1)->getConfFileName();
resultobj = SWIG_FromCharPtr((const char *)result);
result = (arg1)->getConfFileName();
resultobj = SWIG_From_std_string(static_cast< std::string >(result));
return resultobj;
fail:
return NULL;
......@@ -3892,12 +3936,10 @@ fail:
SWIGINTERN PyObject *_wrap_UConnector_getSensorID(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
PyObject *resultobj = 0;
UConnector *arg1 = (UConnector *) 0 ;
char *arg2 = (char *) 0 ;
std::string *arg2 = 0 ;
void *argp1 = 0 ;
int res1 = 0 ;
int res2 ;
char *buf2 = 0 ;
int alloc2 = 0 ;
int res2 = SWIG_OLDOBJ ;
PyObject * obj0 = 0 ;
PyObject * obj1 = 0 ;
long result;
......@@ -3908,17 +3950,23 @@ SWIGINTERN PyObject *_wrap_UConnector_getSensorID(PyObject *SWIGUNUSEDPARM(self)
SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "UConnector_getSensorID" "', argument " "1"" of type '" "UConnector *""'");
}
arg1 = reinterpret_cast< UConnector * >(argp1);
res2 = SWIG_AsCharPtrAndSize(obj1, &buf2, NULL, &alloc2);
if (!SWIG_IsOK(res2)) {
SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "UConnector_getSensorID" "', argument " "2"" of type '" "char const *""'");
{
std::string *ptr = (std::string *)0;
res2 = SWIG_AsPtr_std_string(obj1, &ptr);
if (!SWIG_IsOK(res2)) {
SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "UConnector_getSensorID" "', argument " "2"" of type '" "std::string const &""'");
}
if (!ptr) {
SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "UConnector_getSensorID" "', argument " "2"" of type '" "std::string const &""'");
}
arg2 = ptr;
}
arg2 = reinterpret_cast< char * >(buf2);
result = (long)(arg1)->getSensorID((char const *)arg2);
result = (long)(arg1)->getSensorID((std::string const &)*arg2);
resultobj = SWIG_From_long(static_cast< long >(result));
if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
if (SWIG_IsNewObj(res2)) delete arg2;
return resultobj;
fail:
if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
if (SWIG_IsNewObj(res2)) delete arg2;
return NULL;
}
......@@ -3926,12 +3974,10 @@ fail:
SWIGINTERN PyObject *_wrap_UConnector_getNodeID(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
PyObject *resultobj = 0;
UConnector *arg1 = (UConnector *) 0 ;
char *arg2 = (char *) 0 ;
std::string *arg2 = 0 ;
void *argp1 = 0 ;
int res1 = 0 ;
int res2 ;
char *buf2 = 0 ;
int alloc2 = 0 ;
int res2 = SWIG_OLDOBJ ;
PyObject * obj0 = 0 ;
PyObject * obj1 = 0 ;
long result;
......@@ -3942,17 +3988,23 @@ SWIGINTERN PyObject *_wrap_UConnector_getNodeID(PyObject *SWIGUNUSEDPARM(self),
SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "UConnector_getNodeID" "', argument " "1"" of type '" "UConnector *""'");
}
arg1 = reinterpret_cast< UConnector * >(argp1);
res2 = SWIG_AsCharPtrAndSize(obj1, &buf2, NULL, &alloc2);
if (!SWIG_IsOK(res2)) {
SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "UConnector_getNodeID" "', argument " "2"" of type '" "char const *""'");
{
std::string *ptr = (std::string *)0;
res2 = SWIG_AsPtr_std_string(obj1, &ptr);
if (!SWIG_IsOK(res2)) {
SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "UConnector_getNodeID" "', argument " "2"" of type '" "std::string const &""'");
}
if (!ptr) {
SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "UConnector_getNodeID" "', argument " "2"" of type '" "std::string const &""'");
}
arg2 = ptr;
}
arg2 = reinterpret_cast< char * >(buf2);
result = (long)(arg1)->getNodeID((char const *)arg2);
result = (long)(arg1)->getNodeID((std::string const &)*arg2);
resultobj = SWIG_From_long(static_cast< long >(result));
if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
if (SWIG_IsNewObj(res2)) delete arg2;
return resultobj;
fail:
if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
if (SWIG_IsNewObj(res2)) delete arg2;
return NULL;
}
......@@ -3967,7 +4019,7 @@ SWIGINTERN PyObject *_wrap_UConnector_getShortName(PyObject *SWIGUNUSEDPARM(self
int ecode2 = 0 ;
PyObject * obj0 = 0 ;
PyObject * obj1 = 0 ;
char *result = 0 ;
std::string result;
if (!PyArg_ParseTuple(args,(char *)"OO:UConnector_getShortName",&obj0,&obj1)) SWIG_fail;
res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_UConnector, 0 | 0 );
......@@ -3980,8 +4032,8 @@ SWIGINTERN PyObject *_wrap_UConnector_getShortName(PyObject *SWIGUNUSEDPARM(self
SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "UConnector_getShortName" "', argument " "2"" of type '" "long""'");
}
arg2 = static_cast< long >(val2);
result = (char *)(arg1)->getShortName(arg2);
resultobj = SWIG_FromCharPtr((const char *)result);
result = (arg1)->getShortName(arg2);
resultobj = SWIG_From_std_string(static_cast< std::string >(result));
return resultobj;
fail:
return NULL;
......@@ -3998,7 +4050,7 @@ SWIGINTERN PyObject *_wrap_UConnector_getName(PyObject *SWIGUNUSEDPARM(self), Py
int ecode2 = 0 ;
PyObject * obj0 = 0 ;
PyObject * obj1 = 0 ;
char *result = 0 ;
std::string result;
if (!PyArg_ParseTuple(args,(char *)"OO:UConnector_getName",&obj0,&obj1)) SWIG_fail;
res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_UConnector, 0 | 0 );
......@@ -4011,8 +4063,8 @@ SWIGINTERN PyObject *_wrap_UConnector_getName(PyObject *SWIGUNUSEDPARM(self), Py
SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "UConnector_getName" "', argument " "2"" of type '" "long""'");
}
arg2 = static_cast< long >(val2);
result = (char *)(arg1)->getName(arg2);
resultobj = SWIG_FromCharPtr((const char *)result);
result = (arg1)->getName(arg2);
resultobj = SWIG_From_std_string(static_cast< std::string >(result));
return resultobj;
fail:
return NULL;
......@@ -4029,7 +4081,7 @@ SWIGINTERN PyObject *_wrap_UConnector_getTextName(PyObject *SWIGUNUSEDPARM(self)
int ecode2 = 0 ;
PyObject * obj0 = 0 ;
PyObject * obj1 = 0 ;
char *result = 0 ;
std::string result;
if (!PyArg_ParseTuple(args,(char *)"OO:UConnector_getTextName",&obj0,&obj1)) SWIG_fail;
res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_UConnector, 0 | 0 );
......@@ -4042,8 +4094,8 @@ SWIGINTERN PyObject *_wrap_UConnector_getTextName(PyObject *SWIGUNUSEDPARM(self)
SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "UConnector_getTextName" "', argument " "2"" of type '" "long""'");
}
arg2 = static_cast< long >(val2);
result = (char *)(arg1)->getTextName(arg2);
resultobj = SWIG_FromCharPtr((const char *)result);
result = (arg1)->getTextName(arg2);
resultobj = SWIG_From_std_string(static_cast< std::string >(result));
return resultobj;
fail:
return NULL;
......
......@@ -8,9 +8,9 @@ struct UException
explicit UException( const char* e ): err( std::string(e)) {}
~UException() {}
const char* getError()
const std::string getError()
{
return err.c_str();
return err;
}
std::string err;
......
......@@ -3,6 +3,7 @@
* to regenerate the wrappers run:
* swig -python UException.i
***********************************************************/
%include <std_string.i>
%module pyUExceptions
%{
......
/* ----------------------------------------------------------------------------
* This file was automatically generated by SWIG (http://www.swig.org).
* Version 3.0.6
* Version 3.0.7
*
* 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
......@@ -2972,9 +2972,8 @@ SWIG_Python_NonDynamicSetAttr(PyObject *obj, PyObject *name, PyObject *value) {
#define SWIGTYPE_p_USysError swig_types[1]
#define SWIGTYPE_p_UTimeOut swig_types[2]
#define SWIGTYPE_p_char swig_types[3]
#define SWIGTYPE_p_std__string swig_types[4]
static swig_type_info *swig_types[6];
static swig_module_info swig_module = {swig_types, 5, 0, 0, 0, 0};
static swig_type_info *swig_types[5];
static swig_module_info swig_module = {swig_types, 4, 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)
......@@ -2998,7 +2997,7 @@ static swig_module_info swig_module = {swig_types, 5, 0, 0, 0, 0};
#endif
#define SWIG_name "_pyUExceptions"
#define SWIGVERSION 0x030006
#define SWIGVERSION 0x030007
#define SWIG_VERSION SWIGVERSION
......@@ -3079,6 +3078,9 @@ namespace swig {
}
#include <string>
#include "UExceptions.h"
......@@ -3171,6 +3173,37 @@ SWIG_AsCharPtrAndSize(PyObject *obj, char** cptr, size_t* psize, int *alloc)
}
SWIGINTERN int
SWIG_AsPtr_std_string (PyObject * obj, std::string **val)
{
char* buf = 0 ; size_t size = 0; int alloc = SWIG_OLDOBJ;
if (SWIG_IsOK((SWIG_AsCharPtrAndSize(obj, &buf, &size, &alloc)))) {
if (buf) {
if (val) *val = new std::string(buf, size - 1);
if (alloc == SWIG_NEWOBJ) delete[] buf;
return SWIG_NEWOBJ;
} else {
if (val) *val = 0;
return SWIG_OLDOBJ;
}
} else {
static int init = 0;
static swig_type_info* descriptor = 0;
if (!init) {
descriptor = SWIG_TypeQuery("std::string" " *");
init = 1;
}
if (descriptor) {
std::string *vptr;
int res = SWIG_ConvertPtr(obj, (void**)&vptr, descriptor, 0);
if (SWIG_IsOK(res) && val) *val = vptr;
return res;
}
}
return SWIG_ERROR;
}
......@@ -3199,10 +3232,10 @@ SWIG_FromCharPtrAndSize(const char* carray, size_t size)
}
SWIGINTERNINLINE PyObject *
SWIG_FromCharPtr(const char *cptr)
{
return SWIG_FromCharPtrAndSize(cptr, (cptr ? strlen(cptr) : 0));
SWIGINTERNINLINE PyObject *
SWIG_From_std_string (const std::string& s)
{
return SWIG_FromCharPtrAndSize(s.data(), s.size());
}
#ifdef __cplusplus
......@@ -3224,24 +3257,28 @@ fail:
SWIGINTERN PyObject *_wrap_new_UException__SWIG_1(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
PyObject *resultobj = 0;
std::string *arg1 = 0 ;
void *argp1 = 0 ;
int res1 = 0 ;
int res1 = SWIG_OLDOBJ ;
PyObject * obj0 = 0 ;
UException *result = 0 ;
if (!PyArg_ParseTuple(args,(char *)"O:new_UException",&obj0)) SWIG_fail;
res1 = SWIG_ConvertPtr(obj0, &argp1, SWIGTYPE_p_std__string, 0 | 0);
if (!SWIG_IsOK(res1)) {
SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "new_UException" "', argument " "1"" of type '" "std::string const &""'");
}
if (!argp1) {
SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "new_UException" "', argument " "1"" of type '" "std::string const &""'");
{
std::string *ptr = (std::string *)0;
res1 = SWIG_AsPtr_std_string(obj0, &ptr);
if (!SWIG_IsOK(res1)) {
SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "new_UException" "', argument " "1"" of type '" "std::string const &""'");
}
if (!ptr) {
SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "new_UException" "', argument " "1"" of type '" "std::string const &""'");
}
arg1 = ptr;
}
arg1 = reinterpret_cast< std::string * >(argp1);
result = (UException *)new UException((std::string const &)*arg1);
resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_UException, SWIG_POINTER_NEW | 0 );
if (SWIG_IsNewObj(res1)) delete arg1;
return resultobj;
fail:
if (SWIG_IsNewObj(res1)) delete arg1;
return NULL;
}
......@@ -3273,7 +3310,9 @@ fail:
SWIGINTERN PyObject *_wrap_new_UException(PyObject *self, PyObject *args) {
int argc;
PyObject *argv[2];
PyObject *argv[2] = {
0
};
int ii;
if (!PyTuple_Check(args)) SWIG_fail;
......@@ -3286,7 +3325,7 @@ SWIGINTERN PyObject *_wrap_new_UException(PyObject *self, PyObject *args) {
}
if (argc == 1) {
int _v;
int res = SWIG_ConvertPtr(argv[0], 0, SWIGTYPE_p_std__string, 0);
int res = SWIG_AsPtr_std_string(argv[0], (std::string**)(0));
_v = SWIG_CheckState(res);
if (_v) {
return _wrap_new_UException__SWIG_1(self, args);
......@@ -3338,7 +3377,7 @@ SWIGINTERN PyObject *_wrap_UException_getError(PyObject *SWIGUNUSEDPARM(self), P
void *argp1 = 0 ;
int res1 = 0 ;
PyObject * obj0 = 0 ;
char *result = 0 ;
std::string result;
if (!PyArg_ParseTuple(args,(char *)"O:UException_getError",&obj0)) SWIG_fail;
res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_UException, 0 | 0 );
......@@ -3346,8 +3385,8 @@ SWIGINTERN PyObject *_wrap_UException_getError(PyObject *SWIGUNUSEDPARM(self), P
SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "UException_getError" "', argument " "1"" of type '" "UException *""'");
}
arg1 = reinterpret_cast< UException * >(argp1);
result = (char *)(arg1)->getError();
resultobj = SWIG_FromCharPtr((const char *)result);
result = (arg1)->getError();
resultobj = SWIG_From_std_string(static_cast< std::string >(result));
return resultobj;
fail:
return NULL;
......@@ -3357,11 +3396,10 @@ fail:
SWIGINTERN PyObject *_wrap_UException_err_set(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
PyObject *resultobj = 0;
UException *arg1 = (UException *) 0 ;
std::string arg2 ;
std::string *arg2 = 0 ;
void *argp1 = 0 ;
int res1 = 0 ;
void *argp2 ;
int res2 = 0 ;
int res2 = SWIG_OLDOBJ ;
PyObject * obj0 = 0 ;
PyObject * obj1 = 0 ;
......@@ -3372,22 +3410,22 @@ SWIGINTERN PyObject *_wrap_UException_err_set(PyObject *SWIGUNUSEDPARM(self), Py
}
arg1 = reinterpret_cast< UException * >(argp1);
{
res2 = SWIG_ConvertPtr(obj1, &argp2, SWIGTYPE_p_std__string, 0 | 0);
std::string *ptr = (std::string *)0;
res2 = SWIG_AsPtr_std_string(obj1, &ptr);
if (!SWIG_IsOK(res2)) {
SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "UException_err_set" "', argument " "2"" of type '" "std::string""'");
}
if (!argp2) {
SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "UException_err_set" "', argument " "2"" of type '" "std::string""'");
} else {
std::string * temp = reinterpret_cast< std::string * >(argp2);
arg2 = *temp;
if (SWIG_IsNewObj(res2)) delete temp;
SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "UException_err_set" "', argument " "2"" of type '" "std::string const &""'");
}
if (!ptr) {
SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "UException_err_set" "', argument " "2"" of type '" "std::string const &""'");
}
arg2 = ptr;
}
if (arg1) (arg1)->err = arg2;
if (arg1) (arg1)->err = *arg2;
resultobj = SWIG_Py_Void();
if (SWIG_IsNewObj(res2)) delete arg2;
return resultobj;
fail:
if (SWIG_IsNewObj(res2)) delete arg2;
return NULL;
}
......@@ -3398,7 +3436,7 @@ SWIGINTERN PyObject *_wrap_UException_err_get(PyObject *SWIGUNUSEDPARM(self), Py
void *argp1 = 0 ;
int res1 = 0 ;
PyObject * obj0 = 0 ;
std::string result;
std::string *result = 0 ;
if (!PyArg_ParseTuple(args,(char *)"O:UException_err_get",&obj0)) SWIG_fail;
res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_UException, 0 | 0 );
......@@ -3406,8 +3444,8 @@ SWIGINTERN PyObject *_wrap_UException_err_get(PyObject *SWIGUNUSEDPARM(self), Py
SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "UException_err_get" "', argument " "1"" of type '" "UException *""'");
}
arg1 = reinterpret_cast< UException * >(argp1);
result = ((arg1)->err);
resultobj = SWIG_NewPointerObj((new std::string(static_cast< const std::string& >(result))), SWIGTYPE_p_std__string, SWIG_POINTER_OWN | 0 );
result = (std::string *) & ((arg1)->err);
resultobj = SWIG_From_std_string(static_cast< std::string >(*result));
return resultobj;
fail:
return NULL;
......@@ -3437,31 +3475,37 @@ fail:
SWIGINTERN PyObject *_wrap_new_UTimeOut__SWIG_1(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
PyObject *resultobj = 0;
std::string *arg1 = 0 ;
void *argp1 = 0 ;
int res1 = 0 ;
int res1 = SWIG_OLDOBJ ;
PyObject * obj0 = 0 ;
UTimeOut *result = 0 ;
if (!PyArg_ParseTuple(args,(char *)"O:new_UTimeOut",&obj0)) SWIG_fail;
res1 = SWIG_ConvertPtr(obj0, &argp1, SWIGTYPE_p_std__string, 0 | 0);
if (!SWIG_IsOK(res1)) {
SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "new_UTimeOut" "', argument " "1"" of type '" "std::string const &""'");
}
if (!argp1) {
SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "new_UTimeOut" "', argument " "1"" of type '" "std::string const &""'");
{
std::string *ptr = (std::string *)0;
res1 = SWIG_AsPtr_std_string(obj0, &ptr);
if (!SWIG_IsOK(res1)) {
SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "new_UTimeOut" "', argument " "1"" of type '" "std::string const &""'");
}
if (!ptr) {
SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "new_UTimeOut" "', argument " "1"" of type '" "std::string const &""'");
}
arg1 = ptr;
}
arg1 = reinterpret_cast< std::string * >(argp1);
result = (UTimeOut *)new UTimeOut((std::string const &)*arg1);
resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_UTimeOut, 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_UTimeOut(PyObject *self, PyObject *args) {
int argc;
PyObject *argv[2];
PyObject *argv[2] = {
0
};
int ii;
if (!PyTuple_Check(args)) SWIG_fail;
......@@ -3474,7 +3518,7 @@ SWIGINTERN PyObject *_wrap_new_UTimeOut(PyObject *self, PyObject *args) {
}
if (argc == 1) {
int _v;
int res = SWIG_ConvertPtr(argv[0], 0, SWIGTYPE_p_std__string, 0);
int res = SWIG_AsPtr_std_string(argv[0], (std::string**)(0));
_v = SWIG_CheckState(res);
if (_v) {
return _wrap_new_UTimeOut__SWIG_1(self, args);
......@@ -3534,31 +3578,37 @@ fail:
SWIGINTERN PyObject *_wrap_new_USysError__SWIG_1(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
PyObject *resultobj = 0;
std::string *arg1 = 0 ;
void *argp1 = 0 ;
int res1 = 0 ;
int res1 = SWIG_OLDOBJ ;
PyObject * obj0 = 0 ;
USysError *result = 0 ;
if (!PyArg_ParseTuple(args,(char *)"O:new_USysError",&obj0)) SWIG_fail;
res1 = SWIG_ConvertPtr(obj0, &argp1, SWIGTYPE_p_std__string, 0 | 0);
if (!SWIG_IsOK(res1)) {
SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "new_USysError" "', argument " "1"" of type '" "std::string const &""'");
}
if (!argp1) {
SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "new_USysError" "', argument " "1"" of type '" "std::string const &""'");
{
std::string *ptr = (std::string *)0;
res1 = SWIG_AsPtr_std_string(obj0, &ptr);
if (!SWIG_IsOK(res1)) {
SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "new_USysError" "', argument " "1"" of type '" "std::string const &""'");
}
if (!ptr) {
SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "new_USysError" "', argument " "1"" of type '" "std::string const &""'");
}
arg1 = ptr;
}
arg1 = reinterpret_cast< std::string * >(argp1);
result = (USysError *)new USysError((std::string const &)*arg1);
resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_USysError, 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_USysError(PyObject *self, PyObject *args) {
int argc;
PyObject *argv[2];
PyObject *argv[2] = {
0
};
int ii;
if (!PyTuple_Check(args)) SWIG_fail;
......@@ -3571,7 +3621,7 @@ SWIGINTERN PyObject *_wrap_new_USysError(PyObject *self, PyObject *args) {
}
if (argc == 1) {
int _v;
int res = SWIG_ConvertPtr(argv[0], 0, SWIGTYPE_p_std__string, 0);
int res = SWIG_AsPtr_std_string(argv[0], (std::string**)(0));
_v = SWIG_CheckState(res);
if (_v) {
return _wrap_new_USysError__SWIG_1(self, args);
......@@ -3645,28 +3695,24 @@ static swig_type_info _swigt__p_UException = {"_p_UException", "UException *", 0
static swig_type_info _swigt__p_USysError = {"_p_USysError", "USysError *", 0, 0, (void*)0, 0};
static swig_type_info _swigt__p_UTimeOut = {"_p_UTimeOut", "UTimeOut *", 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_std__string = {"_p_std__string", "std::string *", 0, 0, (void*)0, 0};
static swig_type_info *swig_type_initial[] = {
&_swigt__p_UException,
&_swigt__p_USysError,
&_swigt__p_UTimeOut,
&_swigt__p_char,
&_swigt__p_std__string,
};
static swig_cast_info _swigc__p_UException[] = { {&_swigt__p_UException, 0, 0, 0}, {&_swigt__p_UTimeOut, _p_UTimeOutTo_p_UException, 0, 0}, {&_swigt__p_USysError, _p_USysErrorTo_p_UException, 0, 0},{0, 0, 0, 0}};
static swig_cast_info _swigc__p_USysError[] = { {&_swigt__p_USysError, 0, 0, 0},{0, 0, 0, 0}};
static swig_cast_info _swigc__p_UTimeOut[] = { {&_swigt__p_UTimeOut, 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_std__string[] = { {&_swigt__p_std__string, 0, 0, 0},{0, 0, 0, 0}};
static swig_cast_info *swig_cast_initial[] = {
_swigc__p_UException,
_swigc__p_USysError,
_swigc__p_UTimeOut,
_swigc__p_char,
_swigc__p_std__string,
};
......
/* ----------------------------------------------------------------------------
* This file was automatically generated by SWIG (http://www.swig.org).
* Version 3.0.6
* Version 3.0.7
*
* 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
......@@ -3000,7 +3000,7 @@ static swig_module_info swig_module = {swig_types, 7, 0, 0, 0, 0};
#endif
#define SWIG_name "_pyUniSet"
#define SWIGVERSION 0x030006
#define SWIGVERSION 0x030007
#define SWIG_VERSION SWIGVERSION
......@@ -3084,98 +3084,6 @@ namespace swig {
#include "PyUInterface.h"
SWIGINTERN swig_type_info*
SWIG_pchar_descriptor(void)
{
static int init = 0;
static swig_type_info* info = 0;
if (!init) {
info = SWIG_TypeQuery("_p_char");
init = 1;
}
return info;
}
SWIGINTERN int
SWIG_AsCharPtrAndSize(PyObject *obj, char** cptr, size_t* psize, int *alloc)
{
#if PY_VERSION_HEX>=0x03000000
if (PyUnicode_Check(obj))
#else
if (PyString_Check(obj))
#endif
{
char *cstr; Py_ssize_t len;
#if PY_VERSION_HEX>=0x03000000
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
a UTF-8 representation.
TODO(bhy) More detailed explanation */
return SWIG_RuntimeError;
}
obj = PyUnicode_AsUTF8String(obj);
PyBytes_AsStringAndSize(obj, &cstr, &len);
if(alloc) *alloc = SWIG_NEWOBJ;
#else
PyString_AsStringAndSize(obj, &cstr, &len);
#endif
if (cptr) {
if (alloc) {
/*
In python the user should not be able to modify the inner
string representation. To warranty that, if you define
SWIG_PYTHON_SAFE_CSTRINGS, a new/copy of the python string
buffer is always returned.
The default behavior is just to return the pointer value,
so, be careful.
*/
#if defined(SWIG_PYTHON_SAFE_CSTRINGS)
if (*alloc != SWIG_OLDOBJ)
#else
if (*alloc == SWIG_NEWOBJ)
#endif
{
*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
assert(0); /* Should never reach here in Python 3 */
#endif
*cptr = SWIG_Python_str_AsChar(obj);
}
}
if (psize) *psize = len + 1;
#if PY_VERSION_HEX>=0x03000000
Py_XDECREF(obj);
#endif
return SWIG_OK;
} else {
swig_type_info* pchar_descriptor = SWIG_pchar_descriptor();
if (pchar_descriptor) {
void* vptr = 0;
if (SWIG_ConvertPtr(obj, &vptr, pchar_descriptor, 0) == SWIG_OK) {
if (cptr) *cptr = (char *) vptr;
if (psize) *psize = vptr ? (strlen((char *)vptr) + 1) : 0;
if (alloc) *alloc = SWIG_OLDOBJ;
return SWIG_OK;
}
}
}
return SWIG_TypeError;
}
#include <limits.h>
#if !defined(SWIG_NO_LLONG_MAX)
# if !defined(LLONG_MAX) && defined(__GNUC__) && defined (__LONG_LONG_MAX__)
......@@ -3324,43 +3232,103 @@ SWIG_AsVal_int (PyObject * obj, int *val)
#define SWIG_From_long PyLong_FromLong
SWIGINTERNINLINE PyObject *
SWIG_FromCharPtrAndSize(const char* carray, size_t size)
SWIGINTERNINLINE PyObject*
SWIG_From_int (int value)
{
if (carray) {
if (size > INT_MAX) {
swig_type_info* pchar_descriptor = SWIG_pchar_descriptor();
return pchar_descriptor ?
SWIG_InternalNewPointerObj(const_cast< char * >(carray), pchar_descriptor, 0) : SWIG_Py_Void();
} else {
#if PY_VERSION_HEX >= 0x03000000
#if PY_VERSION_HEX >= 0x03010000
return PyUnicode_DecodeUTF8(carray, static_cast< int >(size), "surrogateescape");
return PyInt_FromLong((long) value);
}
SWIGINTERN swig_type_info*
SWIG_pchar_descriptor(void)
{
static int init = 0;
static swig_type_info* info = 0;
if (!init) {
info = SWIG_TypeQuery("_p_char");
init = 1;
}
return info;
}
SWIGINTERN int
SWIG_AsCharPtrAndSize(PyObject *obj, char** cptr, size_t* psize, int *alloc)
{
#if PY_VERSION_HEX>=0x03000000
if (PyUnicode_Check(obj))
#else
if (PyString_Check(obj))
#endif
{
char *cstr; Py_ssize_t len;
#if PY_VERSION_HEX>=0x03000000
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
a UTF-8 representation.
TODO(bhy) More detailed explanation */
return SWIG_RuntimeError;
}
obj = PyUnicode_AsUTF8String(obj);
PyBytes_AsStringAndSize(obj, &cstr, &len);
if(alloc) *alloc = SWIG_NEWOBJ;
#else
return PyUnicode_FromStringAndSize(carray, static_cast< int >(size));
PyString_AsStringAndSize(obj, &cstr, &len);
#endif
if (cptr) {
if (alloc) {
/*
In python the user should not be able to modify the inner
string representation. To warranty that, if you define
SWIG_PYTHON_SAFE_CSTRINGS, a new/copy of the python string
buffer is always returned.
The default behavior is just to return the pointer value,
so, be careful.
*/
#if defined(SWIG_PYTHON_SAFE_CSTRINGS)
if (*alloc != SWIG_OLDOBJ)
#else
return PyString_FromStringAndSize(carray, static_cast< int >(size));
if (*alloc == SWIG_NEWOBJ)
#endif
{
*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
assert(0); /* Should never reach here in Python 3 */
#endif
*cptr = SWIG_Python_str_AsChar(obj);
}
}
if (psize) *psize = len + 1;
#if PY_VERSION_HEX>=0x03000000
Py_XDECREF(obj);
#endif
return SWIG_OK;
} else {
return SWIG_Py_Void();
swig_type_info* pchar_descriptor = SWIG_pchar_descriptor();
if (pchar_descriptor) {
void* vptr = 0;
if (SWIG_ConvertPtr(obj, &vptr, pchar_descriptor, 0) == SWIG_OK) {
if (cptr) *cptr = (char *) vptr;
if (psize) *psize = vptr ? (strlen((char *)vptr) + 1) : 0;
if (alloc) *alloc = SWIG_OLDOBJ;
return SWIG_OK;
}
}
}
return SWIG_TypeError;
}
SWIGINTERNINLINE PyObject *
SWIG_FromCharPtr(const char *cptr)
{
return SWIG_FromCharPtrAndSize(cptr, (cptr ? strlen(cptr) : 0));
}
SWIGINTERNINLINE PyObject*
SWIG_From_int (int value)
{
return PyInt_FromLong((long) value);
}
SWIGINTERNINLINE PyObject*
......@@ -3375,12 +3343,11 @@ extern "C" {
SWIGINTERN PyObject *_wrap_uniset_init_params(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
PyObject *resultobj = 0;
UTypes::Params *arg1 = (UTypes::Params *) 0 ;
char *arg2 = (char *) 0 ;
std::string *arg2 = 0 ;
void *argp1 = 0 ;
int res1 = 0 ;
int res2 ;
char *buf2 = 0 ;
int alloc2 = 0 ;
void *argp2 = 0 ;
int res2 = 0 ;
PyObject * obj0 = 0 ;
PyObject * obj1 = 0 ;
......@@ -3390,23 +3357,24 @@ SWIGINTERN PyObject *_wrap_uniset_init_params(PyObject *SWIGUNUSEDPARM(self), Py
SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "uniset_init_params" "', argument " "1"" of type '" "UTypes::Params *""'");
}
arg1 = reinterpret_cast< UTypes::Params * >(argp1);
res2 = SWIG_AsCharPtrAndSize(obj1, &buf2, NULL, &alloc2);
res2 = SWIG_ConvertPtr(obj1, &argp2, SWIGTYPE_p_std__string, 0 | 0);
if (!SWIG_IsOK(res2)) {
SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "uniset_init_params" "', argument " "2"" of type '" "char const *""'");
SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "uniset_init_params" "', argument " "2"" of type '" "std::string const &""'");
}
arg2 = reinterpret_cast< char * >(buf2);
if (!argp2) {
SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "uniset_init_params" "', argument " "2"" of type '" "std::string const &""'");
}
arg2 = reinterpret_cast< std::string * >(argp2);
try {
pyUInterface::uniset_init_params(arg1,(char const *)arg2);
pyUInterface::uniset_init_params(arg1,(std::string const &)*arg2);
}
catch(UException &_e) {
SWIG_Python_Raise(SWIG_NewPointerObj((new UException(static_cast< const UException& >(_e))),SWIGTYPE_p_UException,SWIG_POINTER_OWN), "UException", SWIGTYPE_p_UException); SWIG_fail;
}
resultobj = SWIG_Py_Void();
if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
return resultobj;
fail:
if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
return NULL;
}
......@@ -3415,14 +3383,13 @@ SWIGINTERN PyObject *_wrap_uniset_init(PyObject *SWIGUNUSEDPARM(self), PyObject
PyObject *resultobj = 0;
int arg1 ;
char **arg2 = (char **) 0 ;
char *arg3 = (char *) 0 ;
std::string *arg3 = 0 ;
int val1 ;
int ecode1 = 0 ;
void *argp2 = 0 ;
int res2 = 0 ;
int res3 ;
char *buf3 = 0 ;
int alloc3 = 0 ;
void *argp3 = 0 ;
int res3 = 0 ;
PyObject * obj0 = 0 ;
PyObject * obj1 = 0 ;
PyObject * obj2 = 0 ;
......@@ -3438,23 +3405,24 @@ SWIGINTERN PyObject *_wrap_uniset_init(PyObject *SWIGUNUSEDPARM(self), PyObject
SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "uniset_init" "', argument " "2"" of type '" "char **""'");
}
arg2 = reinterpret_cast< char ** >(argp2);
res3 = SWIG_AsCharPtrAndSize(obj2, &buf3, NULL, &alloc3);
res3 = SWIG_ConvertPtr(obj2, &argp3, SWIGTYPE_p_std__string, 0 | 0);
if (!SWIG_IsOK(res3)) {
SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "uniset_init" "', argument " "3"" of type '" "char const *""'");
SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "uniset_init" "', argument " "3"" of type '" "std::string const &""'");
}
if (!argp3) {
SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "uniset_init" "', argument " "3"" of type '" "std::string const &""'");
}
arg3 = reinterpret_cast< char * >(buf3);
arg3 = reinterpret_cast< std::string * >(argp3);
try {
pyUInterface::uniset_init(arg1,arg2,(char const *)arg3);
pyUInterface::uniset_init(arg1,arg2,(std::string const &)*arg3);
}
catch(UException &_e) {
SWIG_Python_Raise(SWIG_NewPointerObj((new UException(static_cast< const UException& >(_e))),SWIGTYPE_p_UException,SWIG_POINTER_OWN), "UException", SWIGTYPE_p_UException); SWIG_fail;
}
resultobj = SWIG_Py_Void();
if (alloc3 == SWIG_NEWOBJ) delete[] buf3;
return resultobj;
fail:
if (alloc3 == SWIG_NEWOBJ) delete[] buf3;
return NULL;
}
......@@ -3525,25 +3493,25 @@ fail:
SWIGINTERN PyObject *_wrap_getSensorID(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
PyObject *resultobj = 0;
char *arg1 = (char *) 0 ;
int res1 ;
char *buf1 = 0 ;
int alloc1 = 0 ;
std::string *arg1 = 0 ;
void *argp1 = 0 ;
int res1 = 0 ;
PyObject * obj0 = 0 ;
long result;
if (!PyArg_ParseTuple(args,(char *)"O:getSensorID",&obj0)) SWIG_fail;
res1 = SWIG_AsCharPtrAndSize(obj0, &buf1, NULL, &alloc1);
res1 = SWIG_ConvertPtr(obj0, &argp1, SWIGTYPE_p_std__string, 0 | 0);
if (!SWIG_IsOK(res1)) {
SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "getSensorID" "', argument " "1"" of type '" "char const *""'");
SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "getSensorID" "', argument " "1"" of type '" "std::string const &""'");
}
arg1 = reinterpret_cast< char * >(buf1);
result = (long)pyUInterface::getSensorID((char const *)arg1);
if (!argp1) {
SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "getSensorID" "', argument " "1"" of type '" "std::string const &""'");
}
arg1 = reinterpret_cast< std::string * >(argp1);
result = (long)pyUInterface::getSensorID((std::string const &)*arg1);
resultobj = SWIG_From_long(static_cast< long >(result));
if (alloc1 == SWIG_NEWOBJ) delete[] buf1;
return resultobj;
fail:
if (alloc1 == SWIG_NEWOBJ) delete[] buf1;
return NULL;
}
......@@ -3554,7 +3522,7 @@ SWIGINTERN PyObject *_wrap_getShortName(PyObject *SWIGUNUSEDPARM(self), PyObject
long val1 ;
int ecode1 = 0 ;
PyObject * obj0 = 0 ;
char *result = 0 ;
std::string result;
if (!PyArg_ParseTuple(args,(char *)"O:getShortName",&obj0)) SWIG_fail;
ecode1 = SWIG_AsVal_long(obj0, &val1);
......@@ -3562,8 +3530,8 @@ SWIGINTERN PyObject *_wrap_getShortName(PyObject *SWIGUNUSEDPARM(self), PyObject
SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "getShortName" "', argument " "1"" of type '" "long""'");
}
arg1 = static_cast< long >(val1);
result = (char *)pyUInterface::getShortName(arg1);
resultobj = SWIG_FromCharPtr((const char *)result);
result = pyUInterface::getShortName(arg1);
resultobj = SWIG_NewPointerObj((new std::string(static_cast< const std::string& >(result))), SWIGTYPE_p_std__string, SWIG_POINTER_OWN | 0 );
return resultobj;
fail:
return NULL;
......@@ -3576,7 +3544,7 @@ SWIGINTERN PyObject *_wrap_getName(PyObject *SWIGUNUSEDPARM(self), PyObject *arg
long val1 ;
int ecode1 = 0 ;
PyObject * obj0 = 0 ;
char *result = 0 ;
std::string result;
if (!PyArg_ParseTuple(args,(char *)"O:getName",&obj0)) SWIG_fail;
ecode1 = SWIG_AsVal_long(obj0, &val1);
......@@ -3584,8 +3552,8 @@ SWIGINTERN PyObject *_wrap_getName(PyObject *SWIGUNUSEDPARM(self), PyObject *arg
SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "getName" "', argument " "1"" of type '" "long""'");
}
arg1 = static_cast< long >(val1);
result = (char *)pyUInterface::getName(arg1);
resultobj = SWIG_FromCharPtr((const char *)result);
result = pyUInterface::getName(arg1);
resultobj = SWIG_NewPointerObj((new std::string(static_cast< const std::string& >(result))), SWIGTYPE_p_std__string, SWIG_POINTER_OWN | 0 );
return resultobj;
fail:
return NULL;
......@@ -3598,7 +3566,7 @@ SWIGINTERN PyObject *_wrap_getTextName(PyObject *SWIGUNUSEDPARM(self), PyObject
long val1 ;
int ecode1 = 0 ;
PyObject * obj0 = 0 ;
char *result = 0 ;
std::string result;
if (!PyArg_ParseTuple(args,(char *)"O:getTextName",&obj0)) SWIG_fail;
ecode1 = SWIG_AsVal_long(obj0, &val1);
......@@ -3606,8 +3574,8 @@ SWIGINTERN PyObject *_wrap_getTextName(PyObject *SWIGUNUSEDPARM(self), PyObject
SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "getTextName" "', argument " "1"" of type '" "long""'");
}
arg1 = static_cast< long >(val1);
result = (char *)pyUInterface::getTextName(arg1);
resultobj = SWIG_FromCharPtr((const char *)result);
result = pyUInterface::getTextName(arg1);
resultobj = SWIG_NewPointerObj((new std::string(static_cast< const std::string& >(result))), SWIGTYPE_p_std__string, SWIG_POINTER_OWN | 0 );
return resultobj;
fail:
return NULL;
......@@ -3616,11 +3584,11 @@ fail:
SWIGINTERN PyObject *_wrap_getConfFileName(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
PyObject *resultobj = 0;
char *result = 0 ;
std::string result;
if (!PyArg_ParseTuple(args,(char *)":getConfFileName")) SWIG_fail;
result = (char *)pyUInterface::getConfFileName();
resultobj = SWIG_FromCharPtr((const char *)result);
result = pyUInterface::getConfFileName();
resultobj = SWIG_NewPointerObj((new std::string(static_cast< const std::string& >(result))), SWIGTYPE_p_std__string, SWIG_POINTER_OWN | 0 );
return resultobj;
fail:
return NULL;
......@@ -3905,7 +3873,9 @@ fail:
SWIGINTERN PyObject *_wrap_new_UException(PyObject *self, PyObject *args) {
int argc;
PyObject *argv[2];
PyObject *argv[2] = {
0
};
int ii;
if (!PyTuple_Check(args)) SWIG_fail;
......@@ -3970,7 +3940,7 @@ SWIGINTERN PyObject *_wrap_UException_getError(PyObject *SWIGUNUSEDPARM(self), P
void *argp1 = 0 ;
int res1 = 0 ;
PyObject * obj0 = 0 ;
char *result = 0 ;
std::string result;
if (!PyArg_ParseTuple(args,(char *)"O:UException_getError",&obj0)) SWIG_fail;
res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_UException, 0 | 0 );
......@@ -3978,8 +3948,8 @@ SWIGINTERN PyObject *_wrap_UException_getError(PyObject *SWIGUNUSEDPARM(self), P
SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "UException_getError" "', argument " "1"" of type '" "UException *""'");
}
arg1 = reinterpret_cast< UException * >(argp1);
result = (char *)(arg1)->getError();
resultobj = SWIG_FromCharPtr((const char *)result);
result = (arg1)->getError();
resultobj = SWIG_NewPointerObj((new std::string(static_cast< const std::string& >(result))), SWIGTYPE_p_std__string, SWIG_POINTER_OWN | 0 );
return resultobj;
fail:
return NULL;
......@@ -4093,7 +4063,9 @@ fail:
SWIGINTERN PyObject *_wrap_new_UTimeOut(PyObject *self, PyObject *args) {
int argc;
PyObject *argv[2];
PyObject *argv[2] = {
0
};
int ii;
if (!PyTuple_Check(args)) SWIG_fail;
......@@ -4190,7 +4162,9 @@ fail:
SWIGINTERN PyObject *_wrap_new_USysError(PyObject *self, PyObject *args) {
int argc;
PyObject *argv[2];
PyObject *argv[2] = {
0
};
int ii;
if (!PyTuple_Check(args)) SWIG_fail;
......
......@@ -52,16 +52,14 @@ UModbus::~UModbus()
delete mb;
}
// --------------------------------------------------------------------------
void UModbus::prepare( const char* _ip, int _port )throw(UException)
void UModbus::prepare( const string& _ip, int _port )throw(UException)
{
if( !mb )
throw UException("(connect): mb=NULL?!");
string s(_ip);
if( mb->isConnection() )
{
if( _port == port && s == ip )
if( _port == port && _ip == ip )
return;
mb->disconnect();
......@@ -69,28 +67,26 @@ void UModbus::prepare( const char* _ip, int _port )throw(UException)
//cerr << "************** Prepare: " << string(_ip) << ":" << port << endl;
// strncpy(char *dest, const char *src, size_t n);
ip = s;
ip = _ip;
port = _port;
}
// --------------------------------------------------------------------------
void UModbus::connect( const char* _ip, int _port )throw(UException)
void UModbus::connect( const string& _ip, int _port )throw(UException)
{
if( !mb )
throw UException("(connect): mb=NULL?!");
string s(_ip);
if( mb->isConnection() )
{
if( _port == port && s == ip )
if( _port == port && _ip == ip )
return;
mb->disconnect();
}
ip = s;
ip = _ip;
port = _port;
ost::InetAddress ia(_ip);
ost::InetAddress ia(_ip.c_str());
try
{
......@@ -126,13 +122,12 @@ bool UModbus::getBit( int addr, int mbreg, int mbfunc )throw(UException)
return mbread(addr, mbreg, mbfunc, "unsigned");
}
// --------------------------------------------------------------------------
long UModbus::mbread( int mbaddr, int mbreg, int mbfunc, const char* s_vtype, int nbit,
const char* new_ip, int new_port )throw(UException)
long UModbus::mbread(int mbaddr, int mbreg, int mbfunc, const string& s_vtype, int nbit,
const string& new_ip, int new_port )throw(UException)
{
using namespace VTypes;
// const char* n_ip = strcmp(new_ip,"") ? new_ip : ip;
const char* n_ip = (new_ip != 0) ? new_ip : ip.c_str();
string n_ip( ( new_ip.empty() ? ip : new_ip ) );
int n_port = ( new_port > 0 ) ? new_port : port;
connect(n_ip, n_port);
......@@ -290,9 +285,9 @@ long UModbus::data2value( VTypes::VType vtype, ModbusRTU::ModbusData* data )
return 0;
}
//---------------------------------------------------------------------------
void UModbus::mbwrite( int mbaddr, int mbreg, int val, int mbfunc, const char* new_ip, int new_port )throw(UException)
void UModbus::mbwrite( int mbaddr, int mbreg, int val, int mbfunc, const string& new_ip, int new_port )throw(UException)
{
const char* n_ip = (new_ip != 0) ? new_ip : ip.c_str();
string n_ip( ( new_ip.empty() ? ip : new_ip ) );
int n_port = ( new_port > 0 ) ? new_port : port;
connect(n_ip, n_port);
......
......@@ -13,14 +13,13 @@
class UModbus
{
public:
// UModbus( int argc, char** argv )throw(UException);
// UModbus( UTypes::Params* p )throw(UException);
UModbus();
~UModbus();
inline const char* getUIType()
inline std::string getUIType()
{
return "modbus";
return string("modbus");
}
inline bool isWriteFunction( int mbfunc )
......@@ -29,9 +28,9 @@ class UModbus
}
// выставление паметров связи, без установления соединения (!)
void prepare( const char* ip, int port )throw(UException);
void prepare( const std::string& ip, int port )throw(UException);
void connect( const char* ip, int port )throw(UException);
void connect( const std::string& ip, int port )throw(UException);
inline int conn_port()
{
return port;
......@@ -56,8 +55,8 @@ class UModbus
* будет сделано переподключение..
*/
long mbread( int addr, int mbreg, int mbfunc,
const char* vtype, int nbit = -1,
const char* ip = 0, int port = -1 )throw(UException);
const std::string& vtype, int nbit = -1,
const std::string& ip = "", int port = -1 )throw(UException);
long getWord( int addr, int mbreg, int mbfunc = 0x4 )throw(UException);
long getByte( int addr, int mbreg, int mbfunc = 0x4 )throw(UException);
......@@ -68,7 +67,7 @@ class UModbus
* чтобы были заданы в UModbus::connect(). Если заданы другие ip и port,
* будет сделана переподключение..
*/
void mbwrite( int addr, int mbreg, int val, int mbfunc, const char* ip = 0, int port = -1 )throw(UException);
void mbwrite( int addr, int mbreg, int val, int mbfunc, const std::string& ip = "", int port = -1 )throw(UException);
protected:
long data2value( VTypes::VType vt, ModbusRTU::ModbusData* data );
......
......@@ -3,6 +3,7 @@
* to regenerate the wrappers run:
* swig -python UInterface.i
***********************************************************/
%include <std_string.i>
%module pyUModbus
%{
......
/* ----------------------------------------------------------------------------
* This file was automatically generated by SWIG (http://www.swig.org).
* Version 3.0.6
* Version 3.0.7
*
* 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
......@@ -2975,9 +2975,8 @@ SWIG_Python_NonDynamicSetAttr(PyObject *obj, PyObject *name, PyObject *value) {
#define SWIGTYPE_p_UTypes__Params swig_types[4]
#define SWIGTYPE_p_char swig_types[5]
#define SWIGTYPE_p_p_char swig_types[6]
#define SWIGTYPE_p_std__string swig_types[7]
static swig_type_info *swig_types[9];
static swig_module_info swig_module = {swig_types, 8, 0, 0, 0, 0};
static swig_type_info *swig_types[8];
static swig_module_info swig_module = {swig_types, 7, 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)
......@@ -3001,7 +3000,7 @@ static swig_module_info swig_module = {swig_types, 8, 0, 0, 0, 0};
#endif
#define SWIG_name "_pyUModbus"
#define SWIGVERSION 0x030006
#define SWIGVERSION 0x030007
#define SWIG_VERSION SWIGVERSION
......@@ -3082,6 +3081,9 @@ namespace swig {
}
#include <string>
#include "UModbus.h"
......@@ -3123,10 +3125,10 @@ SWIG_FromCharPtrAndSize(const char* carray, size_t size)
}
SWIGINTERNINLINE PyObject *
SWIG_FromCharPtr(const char *cptr)
{
return SWIG_FromCharPtrAndSize(cptr, (cptr ? strlen(cptr) : 0));
SWIGINTERNINLINE PyObject *
SWIG_From_std_string (const std::string& s)
{
return SWIG_FromCharPtrAndSize(s.data(), s.size());
}
......@@ -3358,7 +3360,35 @@ SWIG_AsCharPtrAndSize(PyObject *obj, char** cptr, size_t* psize, int *alloc)
}
SWIGINTERN int
SWIG_AsPtr_std_string (PyObject * obj, std::string **val)
{
char* buf = 0 ; size_t size = 0; int alloc = SWIG_OLDOBJ;
if (SWIG_IsOK((SWIG_AsCharPtrAndSize(obj, &buf, &size, &alloc)))) {
if (buf) {
if (val) *val = new std::string(buf, size - 1);
if (alloc == SWIG_NEWOBJ) delete[] buf;
return SWIG_NEWOBJ;
} else {
if (val) *val = 0;
return SWIG_OLDOBJ;
}
} else {
static int init = 0;
static swig_type_info* descriptor = 0;
if (!init) {
descriptor = SWIG_TypeQuery("std::string" " *");
init = 1;
}
if (descriptor) {
std::string *vptr;
int res = SWIG_ConvertPtr(obj, (void**)&vptr, descriptor, 0);
if (SWIG_IsOK(res) && val) *val = vptr;
return res;
}
}
return SWIG_ERROR;
}
SWIGINTERNINLINE PyObject*
......@@ -3370,6 +3400,9 @@ SWIGINTERNINLINE PyObject*
#define SWIG_From_long PyLong_FromLong
#ifdef __cplusplus
extern "C" {
#endif
......@@ -3413,7 +3446,7 @@ SWIGINTERN PyObject *_wrap_UModbus_getUIType(PyObject *SWIGUNUSEDPARM(self), PyO
void *argp1 = 0 ;
int res1 = 0 ;
PyObject * obj0 = 0 ;
char *result = 0 ;
std::string result;
if (!PyArg_ParseTuple(args,(char *)"O:UModbus_getUIType",&obj0)) SWIG_fail;
res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_UModbus, 0 | 0 );
......@@ -3421,8 +3454,8 @@ SWIGINTERN PyObject *_wrap_UModbus_getUIType(PyObject *SWIGUNUSEDPARM(self), PyO
SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "UModbus_getUIType" "', argument " "1"" of type '" "UModbus *""'");
}
arg1 = reinterpret_cast< UModbus * >(argp1);
result = (char *)(arg1)->getUIType();
resultobj = SWIG_FromCharPtr((const char *)result);
result = (arg1)->getUIType();
resultobj = SWIG_From_std_string(static_cast< std::string >(result));
return resultobj;
fail:
return NULL;
......@@ -3463,13 +3496,11 @@ fail:
SWIGINTERN PyObject *_wrap_UModbus_prepare(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
PyObject *resultobj = 0;
UModbus *arg1 = (UModbus *) 0 ;
char *arg2 = (char *) 0 ;
std::string *arg2 = 0 ;
int arg3 ;
void *argp1 = 0 ;
int res1 = 0 ;
int res2 ;
char *buf2 = 0 ;
int alloc2 = 0 ;
int res2 = SWIG_OLDOBJ ;
int val3 ;
int ecode3 = 0 ;
PyObject * obj0 = 0 ;
......@@ -3482,28 +3513,34 @@ SWIGINTERN PyObject *_wrap_UModbus_prepare(PyObject *SWIGUNUSEDPARM(self), PyObj
SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "UModbus_prepare" "', argument " "1"" of type '" "UModbus *""'");
}
arg1 = reinterpret_cast< UModbus * >(argp1);
res2 = SWIG_AsCharPtrAndSize(obj1, &buf2, NULL, &alloc2);
if (!SWIG_IsOK(res2)) {
SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "UModbus_prepare" "', argument " "2"" of type '" "char const *""'");
{
std::string *ptr = (std::string *)0;
res2 = SWIG_AsPtr_std_string(obj1, &ptr);
if (!SWIG_IsOK(res2)) {
SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "UModbus_prepare" "', argument " "2"" of type '" "std::string const &""'");
}
if (!ptr) {
SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "UModbus_prepare" "', argument " "2"" of type '" "std::string const &""'");
}
arg2 = ptr;
}
arg2 = reinterpret_cast< char * >(buf2);
ecode3 = SWIG_AsVal_int(obj2, &val3);
if (!SWIG_IsOK(ecode3)) {
SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "UModbus_prepare" "', argument " "3"" of type '" "int""'");
}
arg3 = static_cast< int >(val3);
try {
(arg1)->prepare((char const *)arg2,arg3);
(arg1)->prepare((std::string const &)*arg2,arg3);
}
catch(UException &_e) {
SWIG_Python_Raise(SWIG_NewPointerObj((new UException(static_cast< const UException& >(_e))),SWIGTYPE_p_UException,SWIG_POINTER_OWN), "UException", SWIGTYPE_p_UException); SWIG_fail;
}
resultobj = SWIG_Py_Void();
if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
if (SWIG_IsNewObj(res2)) delete arg2;
return resultobj;
fail:
if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
if (SWIG_IsNewObj(res2)) delete arg2;
return NULL;
}
......@@ -3511,13 +3548,11 @@ fail:
SWIGINTERN PyObject *_wrap_UModbus_connect(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
PyObject *resultobj = 0;
UModbus *arg1 = (UModbus *) 0 ;
char *arg2 = (char *) 0 ;
std::string *arg2 = 0 ;
int arg3 ;
void *argp1 = 0 ;
int res1 = 0 ;
int res2 ;
char *buf2 = 0 ;
int alloc2 = 0 ;
int res2 = SWIG_OLDOBJ ;
int val3 ;
int ecode3 = 0 ;
PyObject * obj0 = 0 ;
......@@ -3530,28 +3565,34 @@ SWIGINTERN PyObject *_wrap_UModbus_connect(PyObject *SWIGUNUSEDPARM(self), PyObj
SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "UModbus_connect" "', argument " "1"" of type '" "UModbus *""'");
}
arg1 = reinterpret_cast< UModbus * >(argp1);
res2 = SWIG_AsCharPtrAndSize(obj1, &buf2, NULL, &alloc2);
if (!SWIG_IsOK(res2)) {
SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "UModbus_connect" "', argument " "2"" of type '" "char const *""'");
{
std::string *ptr = (std::string *)0;
res2 = SWIG_AsPtr_std_string(obj1, &ptr);
if (!SWIG_IsOK(res2)) {
SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "UModbus_connect" "', argument " "2"" of type '" "std::string const &""'");
}
if (!ptr) {
SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "UModbus_connect" "', argument " "2"" of type '" "std::string const &""'");
}
arg2 = ptr;
}
arg2 = reinterpret_cast< char * >(buf2);
ecode3 = SWIG_AsVal_int(obj2, &val3);
if (!SWIG_IsOK(ecode3)) {
SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "UModbus_connect" "', argument " "3"" of type '" "int""'");
}
arg3 = static_cast< int >(val3);
try {
(arg1)->connect((char const *)arg2,arg3);
(arg1)->connect((std::string const &)*arg2,arg3);
}
catch(UException &_e) {
SWIG_Python_Raise(SWIG_NewPointerObj((new UException(static_cast< const UException& >(_e))),SWIGTYPE_p_UException,SWIG_POINTER_OWN), "UException", SWIGTYPE_p_UException); SWIG_fail;
}
resultobj = SWIG_Py_Void();
if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
if (SWIG_IsNewObj(res2)) delete arg2;
return resultobj;
fail:
if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
if (SWIG_IsNewObj(res2)) delete arg2;
return NULL;
}
......@@ -3593,7 +3634,7 @@ SWIGINTERN PyObject *_wrap_UModbus_conn_ip(PyObject *SWIGUNUSEDPARM(self), PyObj
}
arg1 = reinterpret_cast< UModbus * >(argp1);
result = (arg1)->conn_ip();
resultobj = SWIG_NewPointerObj((new std::string(static_cast< const std::string& >(result))), SWIGTYPE_p_std__string, SWIG_POINTER_OWN | 0 );
resultobj = SWIG_From_std_string(static_cast< std::string >(result));
return resultobj;
fail:
return NULL;
......@@ -3658,9 +3699,9 @@ SWIGINTERN PyObject *_wrap_UModbus_mbread__SWIG_0(PyObject *SWIGUNUSEDPARM(self)
int arg2 ;
int arg3 ;
int arg4 ;
char *arg5 = (char *) 0 ;
std::string *arg5 = 0 ;
int arg6 ;
char *arg7 = (char *) 0 ;
std::string *arg7 = 0 ;
int arg8 ;
void *argp1 = 0 ;
int res1 = 0 ;
......@@ -3670,14 +3711,10 @@ SWIGINTERN PyObject *_wrap_UModbus_mbread__SWIG_0(PyObject *SWIGUNUSEDPARM(self)
int ecode3 = 0 ;
int val4 ;
int ecode4 = 0 ;
int res5 ;
char *buf5 = 0 ;
int alloc5 = 0 ;
int res5 = SWIG_OLDOBJ ;
int val6 ;
int ecode6 = 0 ;
int res7 ;
char *buf7 = 0 ;
int alloc7 = 0 ;
int res7 = SWIG_OLDOBJ ;
int val8 ;
int ecode8 = 0 ;
PyObject * obj0 = 0 ;
......@@ -3711,40 +3748,52 @@ SWIGINTERN PyObject *_wrap_UModbus_mbread__SWIG_0(PyObject *SWIGUNUSEDPARM(self)
SWIG_exception_fail(SWIG_ArgError(ecode4), "in method '" "UModbus_mbread" "', argument " "4"" of type '" "int""'");
}
arg4 = static_cast< int >(val4);
res5 = SWIG_AsCharPtrAndSize(obj4, &buf5, NULL, &alloc5);
if (!SWIG_IsOK(res5)) {
SWIG_exception_fail(SWIG_ArgError(res5), "in method '" "UModbus_mbread" "', argument " "5"" of type '" "char const *""'");
{
std::string *ptr = (std::string *)0;
res5 = SWIG_AsPtr_std_string(obj4, &ptr);
if (!SWIG_IsOK(res5)) {
SWIG_exception_fail(SWIG_ArgError(res5), "in method '" "UModbus_mbread" "', argument " "5"" of type '" "std::string const &""'");
}
if (!ptr) {
SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "UModbus_mbread" "', argument " "5"" of type '" "std::string const &""'");
}
arg5 = ptr;
}
arg5 = reinterpret_cast< char * >(buf5);
ecode6 = SWIG_AsVal_int(obj5, &val6);
if (!SWIG_IsOK(ecode6)) {
SWIG_exception_fail(SWIG_ArgError(ecode6), "in method '" "UModbus_mbread" "', argument " "6"" of type '" "int""'");
}
arg6 = static_cast< int >(val6);
res7 = SWIG_AsCharPtrAndSize(obj6, &buf7, NULL, &alloc7);
if (!SWIG_IsOK(res7)) {
SWIG_exception_fail(SWIG_ArgError(res7), "in method '" "UModbus_mbread" "', argument " "7"" of type '" "char const *""'");
{
std::string *ptr = (std::string *)0;
res7 = SWIG_AsPtr_std_string(obj6, &ptr);
if (!SWIG_IsOK(res7)) {
SWIG_exception_fail(SWIG_ArgError(res7), "in method '" "UModbus_mbread" "', argument " "7"" of type '" "std::string const &""'");
}
if (!ptr) {
SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "UModbus_mbread" "', argument " "7"" of type '" "std::string const &""'");
}
arg7 = ptr;
}
arg7 = reinterpret_cast< char * >(buf7);
ecode8 = SWIG_AsVal_int(obj7, &val8);
if (!SWIG_IsOK(ecode8)) {
SWIG_exception_fail(SWIG_ArgError(ecode8), "in method '" "UModbus_mbread" "', argument " "8"" of type '" "int""'");
}
arg8 = static_cast< int >(val8);
try {
result = (long)(arg1)->mbread(arg2,arg3,arg4,(char const *)arg5,arg6,(char const *)arg7,arg8);
result = (long)(arg1)->mbread(arg2,arg3,arg4,(std::string const &)*arg5,arg6,(std::string const &)*arg7,arg8);
}
catch(UException &_e) {
SWIG_Python_Raise(SWIG_NewPointerObj((new UException(static_cast< const UException& >(_e))),SWIGTYPE_p_UException,SWIG_POINTER_OWN), "UException", SWIGTYPE_p_UException); SWIG_fail;
}
resultobj = SWIG_From_long(static_cast< long >(result));
if (alloc5 == SWIG_NEWOBJ) delete[] buf5;
if (alloc7 == SWIG_NEWOBJ) delete[] buf7;
if (SWIG_IsNewObj(res5)) delete arg5;
if (SWIG_IsNewObj(res7)) delete arg7;
return resultobj;
fail:
if (alloc5 == SWIG_NEWOBJ) delete[] buf5;
if (alloc7 == SWIG_NEWOBJ) delete[] buf7;
if (SWIG_IsNewObj(res5)) delete arg5;
if (SWIG_IsNewObj(res7)) delete arg7;
return NULL;
}
......@@ -3755,9 +3804,9 @@ SWIGINTERN PyObject *_wrap_UModbus_mbread__SWIG_1(PyObject *SWIGUNUSEDPARM(self)
int arg2 ;
int arg3 ;
int arg4 ;
char *arg5 = (char *) 0 ;
std::string *arg5 = 0 ;
int arg6 ;
char *arg7 = (char *) 0 ;
std::string *arg7 = 0 ;
void *argp1 = 0 ;
int res1 = 0 ;
int val2 ;
......@@ -3766,14 +3815,10 @@ SWIGINTERN PyObject *_wrap_UModbus_mbread__SWIG_1(PyObject *SWIGUNUSEDPARM(self)
int ecode3 = 0 ;
int val4 ;
int ecode4 = 0 ;
int res5 ;
char *buf5 = 0 ;
int alloc5 = 0 ;
int res5 = SWIG_OLDOBJ ;
int val6 ;
int ecode6 = 0 ;
int res7 ;
char *buf7 = 0 ;
int alloc7 = 0 ;
int res7 = SWIG_OLDOBJ ;
PyObject * obj0 = 0 ;
PyObject * obj1 = 0 ;
PyObject * obj2 = 0 ;
......@@ -3804,35 +3849,47 @@ SWIGINTERN PyObject *_wrap_UModbus_mbread__SWIG_1(PyObject *SWIGUNUSEDPARM(self)
SWIG_exception_fail(SWIG_ArgError(ecode4), "in method '" "UModbus_mbread" "', argument " "4"" of type '" "int""'");
}
arg4 = static_cast< int >(val4);
res5 = SWIG_AsCharPtrAndSize(obj4, &buf5, NULL, &alloc5);
if (!SWIG_IsOK(res5)) {
SWIG_exception_fail(SWIG_ArgError(res5), "in method '" "UModbus_mbread" "', argument " "5"" of type '" "char const *""'");
{
std::string *ptr = (std::string *)0;
res5 = SWIG_AsPtr_std_string(obj4, &ptr);
if (!SWIG_IsOK(res5)) {
SWIG_exception_fail(SWIG_ArgError(res5), "in method '" "UModbus_mbread" "', argument " "5"" of type '" "std::string const &""'");
}
if (!ptr) {
SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "UModbus_mbread" "', argument " "5"" of type '" "std::string const &""'");
}
arg5 = ptr;
}
arg5 = reinterpret_cast< char * >(buf5);
ecode6 = SWIG_AsVal_int(obj5, &val6);
if (!SWIG_IsOK(ecode6)) {
SWIG_exception_fail(SWIG_ArgError(ecode6), "in method '" "UModbus_mbread" "', argument " "6"" of type '" "int""'");
}
arg6 = static_cast< int >(val6);
res7 = SWIG_AsCharPtrAndSize(obj6, &buf7, NULL, &alloc7);
if (!SWIG_IsOK(res7)) {
SWIG_exception_fail(SWIG_ArgError(res7), "in method '" "UModbus_mbread" "', argument " "7"" of type '" "char const *""'");
{
std::string *ptr = (std::string *)0;
res7 = SWIG_AsPtr_std_string(obj6, &ptr);
if (!SWIG_IsOK(res7)) {
SWIG_exception_fail(SWIG_ArgError(res7), "in method '" "UModbus_mbread" "', argument " "7"" of type '" "std::string const &""'");
}
if (!ptr) {
SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "UModbus_mbread" "', argument " "7"" of type '" "std::string const &""'");
}
arg7 = ptr;
}
arg7 = reinterpret_cast< char * >(buf7);
try {
result = (long)(arg1)->mbread(arg2,arg3,arg4,(char const *)arg5,arg6,(char const *)arg7);
result = (long)(arg1)->mbread(arg2,arg3,arg4,(std::string const &)*arg5,arg6,(std::string const &)*arg7);
}
catch(UException &_e) {
SWIG_Python_Raise(SWIG_NewPointerObj((new UException(static_cast< const UException& >(_e))),SWIGTYPE_p_UException,SWIG_POINTER_OWN), "UException", SWIGTYPE_p_UException); SWIG_fail;
}
resultobj = SWIG_From_long(static_cast< long >(result));
if (alloc5 == SWIG_NEWOBJ) delete[] buf5;
if (alloc7 == SWIG_NEWOBJ) delete[] buf7;
if (SWIG_IsNewObj(res5)) delete arg5;
if (SWIG_IsNewObj(res7)) delete arg7;
return resultobj;
fail:
if (alloc5 == SWIG_NEWOBJ) delete[] buf5;
if (alloc7 == SWIG_NEWOBJ) delete[] buf7;
if (SWIG_IsNewObj(res5)) delete arg5;
if (SWIG_IsNewObj(res7)) delete arg7;
return NULL;
}
......@@ -3843,7 +3900,7 @@ SWIGINTERN PyObject *_wrap_UModbus_mbread__SWIG_2(PyObject *SWIGUNUSEDPARM(self)
int arg2 ;
int arg3 ;
int arg4 ;
char *arg5 = (char *) 0 ;
std::string *arg5 = 0 ;
int arg6 ;
void *argp1 = 0 ;
int res1 = 0 ;
......@@ -3853,9 +3910,7 @@ SWIGINTERN PyObject *_wrap_UModbus_mbread__SWIG_2(PyObject *SWIGUNUSEDPARM(self)
int ecode3 = 0 ;
int val4 ;
int ecode4 = 0 ;
int res5 ;
char *buf5 = 0 ;
int alloc5 = 0 ;
int res5 = SWIG_OLDOBJ ;
int val6 ;
int ecode6 = 0 ;
PyObject * obj0 = 0 ;
......@@ -3887,28 +3942,34 @@ SWIGINTERN PyObject *_wrap_UModbus_mbread__SWIG_2(PyObject *SWIGUNUSEDPARM(self)
SWIG_exception_fail(SWIG_ArgError(ecode4), "in method '" "UModbus_mbread" "', argument " "4"" of type '" "int""'");
}
arg4 = static_cast< int >(val4);
res5 = SWIG_AsCharPtrAndSize(obj4, &buf5, NULL, &alloc5);
if (!SWIG_IsOK(res5)) {
SWIG_exception_fail(SWIG_ArgError(res5), "in method '" "UModbus_mbread" "', argument " "5"" of type '" "char const *""'");
{
std::string *ptr = (std::string *)0;
res5 = SWIG_AsPtr_std_string(obj4, &ptr);
if (!SWIG_IsOK(res5)) {
SWIG_exception_fail(SWIG_ArgError(res5), "in method '" "UModbus_mbread" "', argument " "5"" of type '" "std::string const &""'");
}
if (!ptr) {
SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "UModbus_mbread" "', argument " "5"" of type '" "std::string const &""'");
}
arg5 = ptr;
}
arg5 = reinterpret_cast< char * >(buf5);
ecode6 = SWIG_AsVal_int(obj5, &val6);
if (!SWIG_IsOK(ecode6)) {
SWIG_exception_fail(SWIG_ArgError(ecode6), "in method '" "UModbus_mbread" "', argument " "6"" of type '" "int""'");
}
arg6 = static_cast< int >(val6);
try {
result = (long)(arg1)->mbread(arg2,arg3,arg4,(char const *)arg5,arg6);
result = (long)(arg1)->mbread(arg2,arg3,arg4,(std::string const &)*arg5,arg6);
}
catch(UException &_e) {
SWIG_Python_Raise(SWIG_NewPointerObj((new UException(static_cast< const UException& >(_e))),SWIGTYPE_p_UException,SWIG_POINTER_OWN), "UException", SWIGTYPE_p_UException); SWIG_fail;
}
resultobj = SWIG_From_long(static_cast< long >(result));
if (alloc5 == SWIG_NEWOBJ) delete[] buf5;
if (SWIG_IsNewObj(res5)) delete arg5;
return resultobj;
fail:
if (alloc5 == SWIG_NEWOBJ) delete[] buf5;
if (SWIG_IsNewObj(res5)) delete arg5;
return NULL;
}
......@@ -3919,7 +3980,7 @@ SWIGINTERN PyObject *_wrap_UModbus_mbread__SWIG_3(PyObject *SWIGUNUSEDPARM(self)
int arg2 ;
int arg3 ;
int arg4 ;
char *arg5 = (char *) 0 ;
std::string *arg5 = 0 ;
void *argp1 = 0 ;
int res1 = 0 ;
int val2 ;
......@@ -3928,9 +3989,7 @@ SWIGINTERN PyObject *_wrap_UModbus_mbread__SWIG_3(PyObject *SWIGUNUSEDPARM(self)
int ecode3 = 0 ;
int val4 ;
int ecode4 = 0 ;
int res5 ;
char *buf5 = 0 ;
int alloc5 = 0 ;
int res5 = SWIG_OLDOBJ ;
PyObject * obj0 = 0 ;
PyObject * obj1 = 0 ;
PyObject * obj2 = 0 ;
......@@ -3959,30 +4018,38 @@ SWIGINTERN PyObject *_wrap_UModbus_mbread__SWIG_3(PyObject *SWIGUNUSEDPARM(self)
SWIG_exception_fail(SWIG_ArgError(ecode4), "in method '" "UModbus_mbread" "', argument " "4"" of type '" "int""'");
}
arg4 = static_cast< int >(val4);
res5 = SWIG_AsCharPtrAndSize(obj4, &buf5, NULL, &alloc5);
if (!SWIG_IsOK(res5)) {
SWIG_exception_fail(SWIG_ArgError(res5), "in method '" "UModbus_mbread" "', argument " "5"" of type '" "char const *""'");
{
std::string *ptr = (std::string *)0;
res5 = SWIG_AsPtr_std_string(obj4, &ptr);
if (!SWIG_IsOK(res5)) {
SWIG_exception_fail(SWIG_ArgError(res5), "in method '" "UModbus_mbread" "', argument " "5"" of type '" "std::string const &""'");
}
if (!ptr) {
SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "UModbus_mbread" "', argument " "5"" of type '" "std::string const &""'");
}
arg5 = ptr;
}
arg5 = reinterpret_cast< char * >(buf5);
try {
result = (long)(arg1)->mbread(arg2,arg3,arg4,(char const *)arg5);
result = (long)(arg1)->mbread(arg2,arg3,arg4,(std::string const &)*arg5);
}
catch(UException &_e) {
SWIG_Python_Raise(SWIG_NewPointerObj((new UException(static_cast< const UException& >(_e))),SWIGTYPE_p_UException,SWIG_POINTER_OWN), "UException", SWIGTYPE_p_UException); SWIG_fail;
}
resultobj = SWIG_From_long(static_cast< long >(result));
if (alloc5 == SWIG_NEWOBJ) delete[] buf5;
if (SWIG_IsNewObj(res5)) delete arg5;
return resultobj;
fail:
if (alloc5 == SWIG_NEWOBJ) delete[] buf5;
if (SWIG_IsNewObj(res5)) delete arg5;
return NULL;
}
SWIGINTERN PyObject *_wrap_UModbus_mbread(PyObject *self, PyObject *args) {
int argc;
PyObject *argv[9];
PyObject *argv[9] = {
0
};
int ii;
if (!PyTuple_Check(args)) SWIG_fail;
......@@ -4011,7 +4078,7 @@ SWIGINTERN PyObject *_wrap_UModbus_mbread(PyObject *self, PyObject *args) {
_v = SWIG_CheckState(res);
}
if (_v) {
int res = SWIG_AsCharPtrAndSize(argv[4], 0, NULL, 0);
int res = SWIG_AsPtr_std_string(argv[4], (std::string**)(0));
_v = SWIG_CheckState(res);
if (_v) {
return _wrap_UModbus_mbread__SWIG_3(self, args);
......@@ -4042,7 +4109,7 @@ SWIGINTERN PyObject *_wrap_UModbus_mbread(PyObject *self, PyObject *args) {
_v = SWIG_CheckState(res);
}
if (_v) {
int res = SWIG_AsCharPtrAndSize(argv[4], 0, NULL, 0);
int res = SWIG_AsPtr_std_string(argv[4], (std::string**)(0));
_v = SWIG_CheckState(res);
if (_v) {
{
......@@ -4079,7 +4146,7 @@ SWIGINTERN PyObject *_wrap_UModbus_mbread(PyObject *self, PyObject *args) {
_v = SWIG_CheckState(res);
}
if (_v) {
int res = SWIG_AsCharPtrAndSize(argv[4], 0, NULL, 0);
int res = SWIG_AsPtr_std_string(argv[4], (std::string**)(0));
_v = SWIG_CheckState(res);
if (_v) {
{
......@@ -4087,7 +4154,7 @@ SWIGINTERN PyObject *_wrap_UModbus_mbread(PyObject *self, PyObject *args) {
_v = SWIG_CheckState(res);
}
if (_v) {
int res = SWIG_AsCharPtrAndSize(argv[6], 0, NULL, 0);
int res = SWIG_AsPtr_std_string(argv[6], (std::string**)(0));
_v = SWIG_CheckState(res);
if (_v) {
return _wrap_UModbus_mbread__SWIG_1(self, args);
......@@ -4120,7 +4187,7 @@ SWIGINTERN PyObject *_wrap_UModbus_mbread(PyObject *self, PyObject *args) {
_v = SWIG_CheckState(res);
}
if (_v) {
int res = SWIG_AsCharPtrAndSize(argv[4], 0, NULL, 0);
int res = SWIG_AsPtr_std_string(argv[4], (std::string**)(0));
_v = SWIG_CheckState(res);
if (_v) {
{
......@@ -4128,7 +4195,7 @@ SWIGINTERN PyObject *_wrap_UModbus_mbread(PyObject *self, PyObject *args) {
_v = SWIG_CheckState(res);
}
if (_v) {
int res = SWIG_AsCharPtrAndSize(argv[6], 0, NULL, 0);
int res = SWIG_AsPtr_std_string(argv[6], (std::string**)(0));
_v = SWIG_CheckState(res);
if (_v) {
{
......@@ -4150,10 +4217,10 @@ SWIGINTERN PyObject *_wrap_UModbus_mbread(PyObject *self, PyObject *args) {
fail:
SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number or type of arguments for overloaded function 'UModbus_mbread'.\n"
" Possible C/C++ prototypes are:\n"
" UModbus::mbread(int,int,int,char const *,int,char const *,int)\n"
" UModbus::mbread(int,int,int,char const *,int,char const *)\n"
" UModbus::mbread(int,int,int,char const *,int)\n"
" UModbus::mbread(int,int,int,char const *)\n");
" UModbus::mbread(int,int,int,std::string const &,int,std::string const &,int)\n"
" UModbus::mbread(int,int,int,std::string const &,int,std::string const &)\n"
" UModbus::mbread(int,int,int,std::string const &,int)\n"
" UModbus::mbread(int,int,int,std::string const &)\n");
return 0;
}
......@@ -4261,7 +4328,9 @@ fail:
SWIGINTERN PyObject *_wrap_UModbus_getWord(PyObject *self, PyObject *args) {
int argc;
PyObject *argv[5];
PyObject *argv[5] = {
0
};
int ii;
if (!PyTuple_Check(args)) SWIG_fail;
......@@ -4430,7 +4499,9 @@ fail:
SWIGINTERN PyObject *_wrap_UModbus_getByte(PyObject *self, PyObject *args) {
int argc;
PyObject *argv[5];
PyObject *argv[5] = {
0
};
int ii;
if (!PyTuple_Check(args)) SWIG_fail;
......@@ -4599,7 +4670,9 @@ fail:
SWIGINTERN PyObject *_wrap_UModbus_getBit(PyObject *self, PyObject *args) {
int argc;
PyObject *argv[5];
PyObject *argv[5] = {
0
};
int ii;
if (!PyTuple_Check(args)) SWIG_fail;
......@@ -4672,7 +4745,7 @@ SWIGINTERN PyObject *_wrap_UModbus_mbwrite__SWIG_0(PyObject *SWIGUNUSEDPARM(self
int arg3 ;
int arg4 ;
int arg5 ;
char *arg6 = (char *) 0 ;
std::string *arg6 = 0 ;
int arg7 ;
void *argp1 = 0 ;
int res1 = 0 ;
......@@ -4684,9 +4757,7 @@ SWIGINTERN PyObject *_wrap_UModbus_mbwrite__SWIG_0(PyObject *SWIGUNUSEDPARM(self
int ecode4 = 0 ;
int val5 ;
int ecode5 = 0 ;
int res6 ;
char *buf6 = 0 ;
int alloc6 = 0 ;
int res6 = SWIG_OLDOBJ ;
int val7 ;
int ecode7 = 0 ;
PyObject * obj0 = 0 ;
......@@ -4723,28 +4794,34 @@ SWIGINTERN PyObject *_wrap_UModbus_mbwrite__SWIG_0(PyObject *SWIGUNUSEDPARM(self
SWIG_exception_fail(SWIG_ArgError(ecode5), "in method '" "UModbus_mbwrite" "', argument " "5"" of type '" "int""'");
}
arg5 = static_cast< int >(val5);
res6 = SWIG_AsCharPtrAndSize(obj5, &buf6, NULL, &alloc6);
if (!SWIG_IsOK(res6)) {
SWIG_exception_fail(SWIG_ArgError(res6), "in method '" "UModbus_mbwrite" "', argument " "6"" of type '" "char const *""'");
{
std::string *ptr = (std::string *)0;
res6 = SWIG_AsPtr_std_string(obj5, &ptr);
if (!SWIG_IsOK(res6)) {
SWIG_exception_fail(SWIG_ArgError(res6), "in method '" "UModbus_mbwrite" "', argument " "6"" of type '" "std::string const &""'");
}
if (!ptr) {
SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "UModbus_mbwrite" "', argument " "6"" of type '" "std::string const &""'");
}
arg6 = ptr;
}
arg6 = reinterpret_cast< char * >(buf6);
ecode7 = SWIG_AsVal_int(obj6, &val7);
if (!SWIG_IsOK(ecode7)) {
SWIG_exception_fail(SWIG_ArgError(ecode7), "in method '" "UModbus_mbwrite" "', argument " "7"" of type '" "int""'");
}
arg7 = static_cast< int >(val7);
try {
(arg1)->mbwrite(arg2,arg3,arg4,arg5,(char const *)arg6,arg7);
(arg1)->mbwrite(arg2,arg3,arg4,arg5,(std::string const &)*arg6,arg7);
}
catch(UException &_e) {
SWIG_Python_Raise(SWIG_NewPointerObj((new UException(static_cast< const UException& >(_e))),SWIGTYPE_p_UException,SWIG_POINTER_OWN), "UException", SWIGTYPE_p_UException); SWIG_fail;
}
resultobj = SWIG_Py_Void();
if (alloc6 == SWIG_NEWOBJ) delete[] buf6;
if (SWIG_IsNewObj(res6)) delete arg6;
return resultobj;
fail:
if (alloc6 == SWIG_NEWOBJ) delete[] buf6;
if (SWIG_IsNewObj(res6)) delete arg6;
return NULL;
}
......@@ -4756,7 +4833,7 @@ SWIGINTERN PyObject *_wrap_UModbus_mbwrite__SWIG_1(PyObject *SWIGUNUSEDPARM(self
int arg3 ;
int arg4 ;
int arg5 ;
char *arg6 = (char *) 0 ;
std::string *arg6 = 0 ;
void *argp1 = 0 ;
int res1 = 0 ;
int val2 ;
......@@ -4767,9 +4844,7 @@ SWIGINTERN PyObject *_wrap_UModbus_mbwrite__SWIG_1(PyObject *SWIGUNUSEDPARM(self
int ecode4 = 0 ;
int val5 ;
int ecode5 = 0 ;
int res6 ;
char *buf6 = 0 ;
int alloc6 = 0 ;
int res6 = SWIG_OLDOBJ ;
PyObject * obj0 = 0 ;
PyObject * obj1 = 0 ;
PyObject * obj2 = 0 ;
......@@ -4803,23 +4878,29 @@ SWIGINTERN PyObject *_wrap_UModbus_mbwrite__SWIG_1(PyObject *SWIGUNUSEDPARM(self
SWIG_exception_fail(SWIG_ArgError(ecode5), "in method '" "UModbus_mbwrite" "', argument " "5"" of type '" "int""'");
}
arg5 = static_cast< int >(val5);
res6 = SWIG_AsCharPtrAndSize(obj5, &buf6, NULL, &alloc6);
if (!SWIG_IsOK(res6)) {
SWIG_exception_fail(SWIG_ArgError(res6), "in method '" "UModbus_mbwrite" "', argument " "6"" of type '" "char const *""'");
{
std::string *ptr = (std::string *)0;
res6 = SWIG_AsPtr_std_string(obj5, &ptr);
if (!SWIG_IsOK(res6)) {
SWIG_exception_fail(SWIG_ArgError(res6), "in method '" "UModbus_mbwrite" "', argument " "6"" of type '" "std::string const &""'");
}
if (!ptr) {
SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "UModbus_mbwrite" "', argument " "6"" of type '" "std::string const &""'");
}
arg6 = ptr;
}
arg6 = reinterpret_cast< char * >(buf6);
try {
(arg1)->mbwrite(arg2,arg3,arg4,arg5,(char const *)arg6);
(arg1)->mbwrite(arg2,arg3,arg4,arg5,(std::string const &)*arg6);
}
catch(UException &_e) {
SWIG_Python_Raise(SWIG_NewPointerObj((new UException(static_cast< const UException& >(_e))),SWIGTYPE_p_UException,SWIG_POINTER_OWN), "UException", SWIGTYPE_p_UException); SWIG_fail;
}
resultobj = SWIG_Py_Void();
if (alloc6 == SWIG_NEWOBJ) delete[] buf6;
if (SWIG_IsNewObj(res6)) delete arg6;
return resultobj;
fail:
if (alloc6 == SWIG_NEWOBJ) delete[] buf6;
if (SWIG_IsNewObj(res6)) delete arg6;
return NULL;
}
......@@ -4889,7 +4970,9 @@ fail:
SWIGINTERN PyObject *_wrap_UModbus_mbwrite(PyObject *self, PyObject *args) {
int argc;
PyObject *argv[8];
PyObject *argv[8] = {
0
};
int ii;
if (!PyTuple_Check(args)) SWIG_fail;
......@@ -4956,7 +5039,7 @@ SWIGINTERN PyObject *_wrap_UModbus_mbwrite(PyObject *self, PyObject *args) {
_v = SWIG_CheckState(res);
}
if (_v) {
int res = SWIG_AsCharPtrAndSize(argv[5], 0, NULL, 0);
int res = SWIG_AsPtr_std_string(argv[5], (std::string**)(0));
_v = SWIG_CheckState(res);
if (_v) {
return _wrap_UModbus_mbwrite__SWIG_1(self, args);
......@@ -4993,7 +5076,7 @@ SWIGINTERN PyObject *_wrap_UModbus_mbwrite(PyObject *self, PyObject *args) {
_v = SWIG_CheckState(res);
}
if (_v) {
int res = SWIG_AsCharPtrAndSize(argv[5], 0, NULL, 0);
int res = SWIG_AsPtr_std_string(argv[5], (std::string**)(0));
_v = SWIG_CheckState(res);
if (_v) {
{
......@@ -5014,8 +5097,8 @@ SWIGINTERN PyObject *_wrap_UModbus_mbwrite(PyObject *self, PyObject *args) {
fail:
SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number or type of arguments for overloaded function 'UModbus_mbwrite'.\n"
" Possible C/C++ prototypes are:\n"
" UModbus::mbwrite(int,int,int,int,char const *,int)\n"
" UModbus::mbwrite(int,int,int,int,char const *)\n"
" UModbus::mbwrite(int,int,int,int,std::string const &,int)\n"
" UModbus::mbwrite(int,int,int,int,std::string const &)\n"
" UModbus::mbwrite(int,int,int,int)\n");
return 0;
}
......@@ -5257,24 +5340,28 @@ fail:
SWIGINTERN PyObject *_wrap_new_UException__SWIG_1(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
PyObject *resultobj = 0;
std::string *arg1 = 0 ;
void *argp1 = 0 ;
int res1 = 0 ;
int res1 = SWIG_OLDOBJ ;
PyObject * obj0 = 0 ;
UException *result = 0 ;
if (!PyArg_ParseTuple(args,(char *)"O:new_UException",&obj0)) SWIG_fail;
res1 = SWIG_ConvertPtr(obj0, &argp1, SWIGTYPE_p_std__string, 0 | 0);
if (!SWIG_IsOK(res1)) {
SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "new_UException" "', argument " "1"" of type '" "std::string const &""'");
}
if (!argp1) {
SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "new_UException" "', argument " "1"" of type '" "std::string const &""'");
{
std::string *ptr = (std::string *)0;
res1 = SWIG_AsPtr_std_string(obj0, &ptr);
if (!SWIG_IsOK(res1)) {
SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "new_UException" "', argument " "1"" of type '" "std::string const &""'");
}
if (!ptr) {
SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "new_UException" "', argument " "1"" of type '" "std::string const &""'");
}
arg1 = ptr;
}
arg1 = reinterpret_cast< std::string * >(argp1);
result = (UException *)new UException((std::string const &)*arg1);
resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_UException, SWIG_POINTER_NEW | 0 );
if (SWIG_IsNewObj(res1)) delete arg1;
return resultobj;
fail:
if (SWIG_IsNewObj(res1)) delete arg1;
return NULL;
}
......@@ -5306,7 +5393,9 @@ fail:
SWIGINTERN PyObject *_wrap_new_UException(PyObject *self, PyObject *args) {
int argc;
PyObject *argv[2];
PyObject *argv[2] = {
0
};
int ii;
if (!PyTuple_Check(args)) SWIG_fail;
......@@ -5319,7 +5408,7 @@ SWIGINTERN PyObject *_wrap_new_UException(PyObject *self, PyObject *args) {
}
if (argc == 1) {
int _v;
int res = SWIG_ConvertPtr(argv[0], 0, SWIGTYPE_p_std__string, 0);
int res = SWIG_AsPtr_std_string(argv[0], (std::string**)(0));
_v = SWIG_CheckState(res);
if (_v) {
return _wrap_new_UException__SWIG_1(self, args);
......@@ -5371,7 +5460,7 @@ SWIGINTERN PyObject *_wrap_UException_getError(PyObject *SWIGUNUSEDPARM(self), P
void *argp1 = 0 ;
int res1 = 0 ;
PyObject * obj0 = 0 ;
char *result = 0 ;
std::string result;
if (!PyArg_ParseTuple(args,(char *)"O:UException_getError",&obj0)) SWIG_fail;
res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_UException, 0 | 0 );
......@@ -5379,8 +5468,8 @@ SWIGINTERN PyObject *_wrap_UException_getError(PyObject *SWIGUNUSEDPARM(self), P
SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "UException_getError" "', argument " "1"" of type '" "UException *""'");
}
arg1 = reinterpret_cast< UException * >(argp1);
result = (char *)(arg1)->getError();
resultobj = SWIG_FromCharPtr((const char *)result);
result = (arg1)->getError();
resultobj = SWIG_From_std_string(static_cast< std::string >(result));
return resultobj;
fail:
return NULL;
......@@ -5390,11 +5479,10 @@ fail:
SWIGINTERN PyObject *_wrap_UException_err_set(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
PyObject *resultobj = 0;
UException *arg1 = (UException *) 0 ;
std::string arg2 ;
std::string *arg2 = 0 ;
void *argp1 = 0 ;
int res1 = 0 ;
void *argp2 ;
int res2 = 0 ;
int res2 = SWIG_OLDOBJ ;
PyObject * obj0 = 0 ;
PyObject * obj1 = 0 ;
......@@ -5405,22 +5493,22 @@ SWIGINTERN PyObject *_wrap_UException_err_set(PyObject *SWIGUNUSEDPARM(self), Py
}
arg1 = reinterpret_cast< UException * >(argp1);
{
res2 = SWIG_ConvertPtr(obj1, &argp2, SWIGTYPE_p_std__string, 0 | 0);
std::string *ptr = (std::string *)0;
res2 = SWIG_AsPtr_std_string(obj1, &ptr);
if (!SWIG_IsOK(res2)) {
SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "UException_err_set" "', argument " "2"" of type '" "std::string""'");
}
if (!argp2) {
SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "UException_err_set" "', argument " "2"" of type '" "std::string""'");
} else {
std::string * temp = reinterpret_cast< std::string * >(argp2);
arg2 = *temp;
if (SWIG_IsNewObj(res2)) delete temp;
SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "UException_err_set" "', argument " "2"" of type '" "std::string const &""'");
}
if (!ptr) {
SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "UException_err_set" "', argument " "2"" of type '" "std::string const &""'");
}
arg2 = ptr;
}
if (arg1) (arg1)->err = arg2;
if (arg1) (arg1)->err = *arg2;
resultobj = SWIG_Py_Void();
if (SWIG_IsNewObj(res2)) delete arg2;
return resultobj;
fail:
if (SWIG_IsNewObj(res2)) delete arg2;
return NULL;
}
......@@ -5431,7 +5519,7 @@ SWIGINTERN PyObject *_wrap_UException_err_get(PyObject *SWIGUNUSEDPARM(self), Py
void *argp1 = 0 ;
int res1 = 0 ;
PyObject * obj0 = 0 ;
std::string result;
std::string *result = 0 ;
if (!PyArg_ParseTuple(args,(char *)"O:UException_err_get",&obj0)) SWIG_fail;
res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_UException, 0 | 0 );
......@@ -5439,8 +5527,8 @@ SWIGINTERN PyObject *_wrap_UException_err_get(PyObject *SWIGUNUSEDPARM(self), Py
SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "UException_err_get" "', argument " "1"" of type '" "UException *""'");
}
arg1 = reinterpret_cast< UException * >(argp1);
result = ((arg1)->err);
resultobj = SWIG_NewPointerObj((new std::string(static_cast< const std::string& >(result))), SWIGTYPE_p_std__string, SWIG_POINTER_OWN | 0 );
result = (std::string *) & ((arg1)->err);
resultobj = SWIG_From_std_string(static_cast< std::string >(*result));
return resultobj;
fail:
return NULL;
......@@ -5470,31 +5558,37 @@ fail:
SWIGINTERN PyObject *_wrap_new_UTimeOut__SWIG_1(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
PyObject *resultobj = 0;
std::string *arg1 = 0 ;
void *argp1 = 0 ;
int res1 = 0 ;
int res1 = SWIG_OLDOBJ ;
PyObject * obj0 = 0 ;
UTimeOut *result = 0 ;
if (!PyArg_ParseTuple(args,(char *)"O:new_UTimeOut",&obj0)) SWIG_fail;
res1 = SWIG_ConvertPtr(obj0, &argp1, SWIGTYPE_p_std__string, 0 | 0);
if (!SWIG_IsOK(res1)) {
SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "new_UTimeOut" "', argument " "1"" of type '" "std::string const &""'");
}
if (!argp1) {
SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "new_UTimeOut" "', argument " "1"" of type '" "std::string const &""'");
{
std::string *ptr = (std::string *)0;
res1 = SWIG_AsPtr_std_string(obj0, &ptr);
if (!SWIG_IsOK(res1)) {
SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "new_UTimeOut" "', argument " "1"" of type '" "std::string const &""'");
}
if (!ptr) {
SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "new_UTimeOut" "', argument " "1"" of type '" "std::string const &""'");
}
arg1 = ptr;
}
arg1 = reinterpret_cast< std::string * >(argp1);
result = (UTimeOut *)new UTimeOut((std::string const &)*arg1);
resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_UTimeOut, 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_UTimeOut(PyObject *self, PyObject *args) {
int argc;
PyObject *argv[2];
PyObject *argv[2] = {
0
};
int ii;
if (!PyTuple_Check(args)) SWIG_fail;
......@@ -5507,7 +5601,7 @@ SWIGINTERN PyObject *_wrap_new_UTimeOut(PyObject *self, PyObject *args) {
}
if (argc == 1) {
int _v;
int res = SWIG_ConvertPtr(argv[0], 0, SWIGTYPE_p_std__string, 0);
int res = SWIG_AsPtr_std_string(argv[0], (std::string**)(0));
_v = SWIG_CheckState(res);
if (_v) {
return _wrap_new_UTimeOut__SWIG_1(self, args);
......@@ -5567,31 +5661,37 @@ fail:
SWIGINTERN PyObject *_wrap_new_USysError__SWIG_1(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
PyObject *resultobj = 0;
std::string *arg1 = 0 ;
void *argp1 = 0 ;
int res1 = 0 ;
int res1 = SWIG_OLDOBJ ;
PyObject * obj0 = 0 ;
USysError *result = 0 ;
if (!PyArg_ParseTuple(args,(char *)"O:new_USysError",&obj0)) SWIG_fail;
res1 = SWIG_ConvertPtr(obj0, &argp1, SWIGTYPE_p_std__string, 0 | 0);
if (!SWIG_IsOK(res1)) {
SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "new_USysError" "', argument " "1"" of type '" "std::string const &""'");
}
if (!argp1) {
SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "new_USysError" "', argument " "1"" of type '" "std::string const &""'");
{
std::string *ptr = (std::string *)0;
res1 = SWIG_AsPtr_std_string(obj0, &ptr);
if (!SWIG_IsOK(res1)) {
SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "new_USysError" "', argument " "1"" of type '" "std::string const &""'");
}
if (!ptr) {
SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "new_USysError" "', argument " "1"" of type '" "std::string const &""'");
}
arg1 = ptr;
}
arg1 = reinterpret_cast< std::string * >(argp1);
result = (USysError *)new USysError((std::string const &)*arg1);
resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_USysError, 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_USysError(PyObject *self, PyObject *args) {
int argc;
PyObject *argv[2];
PyObject *argv[2] = {
0
};
int ii;
if (!PyTuple_Check(args)) SWIG_fail;
......@@ -5604,7 +5704,7 @@ SWIGINTERN PyObject *_wrap_new_USysError(PyObject *self, PyObject *args) {
}
if (argc == 1) {
int _v;
int res = SWIG_ConvertPtr(argv[0], 0, SWIGTYPE_p_std__string, 0);
int res = SWIG_AsPtr_std_string(argv[0], (std::string**)(0));
_v = SWIG_CheckState(res);
if (_v) {
return _wrap_new_USysError__SWIG_1(self, args);
......@@ -5706,7 +5806,6 @@ static swig_type_info _swigt__p_UTimeOut = {"_p_UTimeOut", "UTimeOut *", 0, 0, (
static swig_type_info _swigt__p_UTypes__Params = {"_p_UTypes__Params", "UTypes::Params *", 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_p_char = {"_p_p_char", "char **", 0, 0, (void*)0, 0};
static swig_type_info _swigt__p_std__string = {"_p_std__string", "std::string *", 0, 0, (void*)0, 0};
static swig_type_info *swig_type_initial[] = {
&_swigt__p_UException,
......@@ -5716,7 +5815,6 @@ static swig_type_info *swig_type_initial[] = {
&_swigt__p_UTypes__Params,
&_swigt__p_char,
&_swigt__p_p_char,
&_swigt__p_std__string,
};
static swig_cast_info _swigc__p_UException[] = { {&_swigt__p_UException, 0, 0, 0}, {&_swigt__p_UTimeOut, _p_UTimeOutTo_p_UException, 0, 0}, {&_swigt__p_USysError, _p_USysErrorTo_p_UException, 0, 0},{0, 0, 0, 0}};
......@@ -5726,7 +5824,6 @@ static swig_cast_info _swigc__p_UTimeOut[] = { {&_swigt__p_UTimeOut, 0, 0, 0},{
static swig_cast_info _swigc__p_UTypes__Params[] = { {&_swigt__p_UTypes__Params, 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_p_char[] = { {&_swigt__p_p_char, 0, 0, 0},{0, 0, 0, 0}};
static swig_cast_info _swigc__p_std__string[] = { {&_swigt__p_std__string, 0, 0, 0},{0, 0, 0, 0}};
static swig_cast_info *swig_cast_initial[] = {
_swigc__p_UException,
......@@ -5736,7 +5833,6 @@ static swig_cast_info *swig_cast_initial[] = {
_swigc__p_UTypes__Params,
_swigc__p_char,
_swigc__p_p_char,
_swigc__p_std__string,
};
......
# This file was automatically generated by SWIG (http://www.swig.org).
# Version 3.0.6
# Version 3.0.7
#
# Do not make changes to this file unless you know what you are doing--modify
# the SWIG interface file instead.
......@@ -134,11 +134,11 @@ class UConnector:
def setValue(self, id, val, node):
return _pyUConnector.UConnector_setValue(self, id, val, node)
def getSensorID(self, arg2):
return _pyUConnector.UConnector_getSensorID(self, arg2)
def getSensorID(self, name):
return _pyUConnector.UConnector_getSensorID(self, name)
def getNodeID(self, arg2):
return _pyUConnector.UConnector_getNodeID(self, arg2)
def getNodeID(self, name):
return _pyUConnector.UConnector_getNodeID(self, name)
def getShortName(self, id):
return _pyUConnector.UConnector_getShortName(self, id)
......
# This file was automatically generated by SWIG (http://www.swig.org).
# Version 3.0.6
# Version 3.0.7
#
# Do not make changes to this file unless you know what you are doing--modify
# the SWIG interface file instead.
......
# This file was automatically generated by SWIG (http://www.swig.org).
# Version 3.0.6
# Version 3.0.7
#
# Do not make changes to this file unless you know what you are doing--modify
# the SWIG interface file instead.
......@@ -113,8 +113,8 @@ class UModbus:
def setTimeout(self, msec):
return _pyUModbus.UModbus_setTimeout(self, msec)
def mbread(self, addr, mbreg, mbfunc, vtype, nbit=-1, ip=None, port=-1):
return _pyUModbus.UModbus_mbread(self, addr, mbreg, mbfunc, vtype, nbit, ip, port)
def mbread(self, *args):
return _pyUModbus.UModbus_mbread(self, *args)
def getWord(self, addr, mbreg, mbfunc=0x4):
return _pyUModbus.UModbus_getWord(self, addr, mbreg, mbfunc)
......@@ -125,8 +125,8 @@ class UModbus:
def getBit(self, addr, mbreg, mbfunc=0x2):
return _pyUModbus.UModbus_getBit(self, addr, mbreg, mbfunc)
def mbwrite(self, addr, mbreg, val, mbfunc, ip=None, port=-1):
return _pyUModbus.UModbus_mbwrite(self, addr, mbreg, val, mbfunc, ip, port)
def mbwrite(self, *args):
return _pyUModbus.UModbus_mbwrite(self, *args)
UModbus_swigregister = _pyUModbus.UModbus_swigregister
UModbus_swigregister(UModbus)
......
# This file was automatically generated by SWIG (http://www.swig.org).
# Version 3.0.6
# Version 3.0.7
#
# Do not make changes to this file unless you know what you are doing--modify
# the SWIG interface file instead.
......@@ -90,8 +90,8 @@ def setValue(id, val):
return _pyUniSet.setValue(id, val)
setValue = _pyUniSet.setValue
def getSensorID(arg1):
return _pyUniSet.getSensorID(arg1)
def getSensorID(name):
return _pyUniSet.getSensorID(name)
getSensorID = _pyUniSet.getSensorID
def getShortName(id):
......
......@@ -51,25 +51,23 @@ ObjectRepositoryFactory::~ObjectRepositoryFactory()
* \param section - полное имя секции начиная с Root.
* \exception ORepFailed - генерируется если произошла при получении доступа к секции
*/
bool ObjectRepositoryFactory::createSection( const char* name, const char* in_section)throw(ORepFailed, InvalidObjectName )
bool ObjectRepositoryFactory::createSection(const string& name, const string& in_section)throw(ORepFailed, InvalidObjectName)
{
const string str(name);
char bad = ORepHelpers::checkBadSymbols(str);
char bad = ORepHelpers::checkBadSymbols(name);
if (bad != 0)
{
ostringstream err;
err << "ObjectRepository(registration): (InvalidObjectName) " << str;
err << "ObjectRepository(registration): (InvalidObjectName) " << name;
err << " содержит недопустимый символ " << bad;
throw ( InvalidObjectName(err.str().c_str()) );
}
ulogrep << "CreateSection: name = " << name << " in section = " << in_section << endl;
if( sizeof(in_section) == 0 )
if( in_section.empty() )
{
ulogrep << "CreateSection: in_section=0" << endl;
ulogrep << "CreateSection: in_section..empty" << endl;
return createRootSection(name);
}
......@@ -78,12 +76,6 @@ bool ObjectRepositoryFactory::createSection( const char* name, const char* in_se
CosNaming::NamingContext_var ctx = ORepHelpers::getContext(in_section, argc, argv, uconf->getNSName() );
return createContext( name, ctx.in() );
}
bool ObjectRepositoryFactory::createSection(const string& name, const string& in_section)throw(ORepFailed, InvalidObjectName)
{
return createSection(name.c_str(), in_section.c_str());
}
// -------------------------------------------------------------------------------------------------------
/*!
* \param fullName - полное имя создаваемой секции
......@@ -108,23 +100,16 @@ bool ObjectRepositoryFactory::createSectionF(const string& fullName)throw(ORepFa
}
// ---------------------------------------------------------------------------------------------------------------
bool ObjectRepositoryFactory::createRootSection(const char* name)
bool ObjectRepositoryFactory::createRootSection( const string& name )
{
CORBA::ORB_var orb = uconf->getORB();
CosNaming::NamingContext_var ctx = ORepHelpers::getRootNamingContext(orb, uconf->getNSName());
return createContext(name, ctx);
}
bool ObjectRepositoryFactory::createRootSection(const string& name)
{
return createRootSection( name.c_str() );
}
// -----------------------------------------------------------------------------------------------------------
bool ObjectRepositoryFactory::createContext(const char* cname, CosNaming::NamingContext_ptr ctx)
bool ObjectRepositoryFactory::createContext( const string& cname, CosNaming::NamingContext_ptr ctx )
{
CosNaming::Name_var nc = omniURI::stringToName(cname);
CosNaming::Name_var nc = omniURI::stringToName(cname.c_str());
try
{
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment