Commit 38a745c4 authored by seb's avatar seb
Browse files

- wrapped Debug.h

- wrapped std::vector<std::string>


git-svn-id: https://scm.blissgarden.org/svn/lima/trunk@179 45c4679d-1946-429d-baad-37912b19538b
parent bd71eaaf
%ExportedHeaderCode
#include <Debug.h>
using namespace lima;
%End
enum DebType {
DebFatal, DebError, DebWarning, DebTrace,
DebFunct, DebParam, DebReturn, DebAlways,
};
enum DebFormat {
DebFmtDateTime, DebFmtModule, DebFmtObj, DebFmtFunct,
DebFmtFileLine, DebFmtType,
};
enum DebModule {
DebModNone, DebModCommon, DebModHardware, DebModControl,
DebModSimu, DebModEspia, DebModEspiaSerial, DebModFocla,
DebModFrelon, DebModFrelonSerial, DebModMaxipix,
};
typedef const char *ConstStr;
/*------------------------------------------------------------------
* class DebParams
*------------------------------------------------------------------*/
class DebParams
{
%TypeHeaderCode
#include <Debug.h>
using namespace lima;
%End
public:
typedef long long Flags;
typedef std::vector<std::string> NameList;
DebParams(DebModule mod = DebModNone,
ConstStr class_name = NULL, ConstStr name_space = NULL);
void setModule(DebModule mod);
DebModule getModule() const;
void setClassName(ConstStr class_name);
ConstStr getClassName() const;
void setNameSpace(ConstStr name_space);
ConstStr getNameSpace() const;
bool checkModule() const;
bool checkType(DebType type) const;
static void setModuleFlags(Flags mod_flags);
static Flags getModuleFlags();
static void setFormatFlags(Flags fmt_flags);
static Flags getFormatFlags();
static void setTypeFlags(Flags type_flags);
static Flags getTypeFlags();
static ConstStr getTypeName(DebType type);
static ConstStr getFormatName(DebFormat fmt);
static ConstStr getModuleName(DebModule mod);
};
/*------------------------------------------------------------------
* global inline functions
*------------------------------------------------------------------*/
DebParams::Flags DebFlag(int val);
bool DebHasFlag(DebParams::Flags flags, int val);
......@@ -21,6 +21,41 @@ return PyString_FromStringAndSize(sipCpp->data(),sipCpp->length());
};
%MappedType std::vector<std::string>
{
%TypeHeaderCode
#include <string>
#include <vector>
%End
%ConvertToTypeCode
if (sipIsErr == NULL)
{
bool aReturnFlag = PyList_Check(sipPy);
for(int i = 0;aReturnFlag && i < PyList_Size(sipPy);++i)
aReturnFlag = PyString_Check(PyList_GetItem(sipPy,i));
return aReturnFlag;
}
*sipCppPtr = new std::vector<std::string>(PyList_Size(sipPy));
for(int i = 0;i < PyList_Size(sipPy);++i)
(*sipCppPtr)->operator[](i) = PyString_AsString(PyList_GetItem(sipPy,i));
return sipGetState(sipTransferObj);
%End
%ConvertFromTypeCode
PyObject* aReturnListPt = PyList_New(sipCpp->size());
std::vector<std::string>::iterator vIter = sipCpp->begin();
for(int i = 0;vIter != sipCpp->end();++vIter,++i)
PyList_SetItem(aReturnListPt,i,PyString_FromStringAndSize(vIter->data(),vIter->length()));
return aReturnListPt;
%End
};
%ModuleHeaderCode
extern "C" { void lima_import_array();}
%End
......
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