From 083b88baf0c1380ed8db95f7287d43ec32a14804 Mon Sep 17 00:00:00 2001 From: ageay Date: Tue, 16 Oct 2012 13:42:22 +0000 Subject: [PATCH] version of MED in medcoupling library. --- src/MEDCoupling/MEDCouplingRefCountObject.cxx | 8 ++++++++ src/MEDCoupling/MEDCouplingRefCountObject.hxx | 1 + src/MEDCoupling_Swig/MEDCouplingCommon.i | 14 ++++++++++++++ 3 files changed, 23 insertions(+) diff --git a/src/MEDCoupling/MEDCouplingRefCountObject.cxx b/src/MEDCoupling/MEDCouplingRefCountObject.cxx index 51ae08cdb..e55612456 100644 --- a/src/MEDCoupling/MEDCouplingRefCountObject.cxx +++ b/src/MEDCoupling/MEDCouplingRefCountObject.cxx @@ -33,6 +33,14 @@ int ParaMEDMEM::MEDCouplingVersion() return SALOMEMED_VERSION; } +void ParaMEDMEM::MEDCouplingVersionMajMinRel(int& maj, int& minor, int& releas) +{ + int ver=SALOMEMED_VERSION; + maj=(ver & 0xFF0000) >> 16; + minor=(ver & 0xFF00) >> 8; + releas=(ver & 0xFF); +} + RefCountObject::RefCountObject():_cnt(1) { } diff --git a/src/MEDCoupling/MEDCouplingRefCountObject.hxx b/src/MEDCoupling/MEDCouplingRefCountObject.hxx index 51e77e19d..4b784739c 100644 --- a/src/MEDCoupling/MEDCouplingRefCountObject.hxx +++ b/src/MEDCoupling/MEDCouplingRefCountObject.hxx @@ -52,6 +52,7 @@ namespace ParaMEDMEM const char *MEDCouplingVersionStr(); int MEDCouplingVersion(); + void MEDCouplingVersionMajMinRel(int& maj, int& minor, int& releas); class MEDCOUPLING_EXPORT RefCountObject { diff --git a/src/MEDCoupling_Swig/MEDCouplingCommon.i b/src/MEDCoupling_Swig/MEDCouplingCommon.i index 085293b0c..804712b87 100644 --- a/src/MEDCoupling_Swig/MEDCouplingCommon.i +++ b/src/MEDCoupling_Swig/MEDCouplingCommon.i @@ -328,6 +328,7 @@ using namespace INTERP_KERNEL; %feature("unref") MEDCouplingMultiFields "$this->decrRef();" %rename(assign) *::operator=; +%ignore ParaMEDMEM::MEDCouplingVersionMajMinRel; %ignore ParaMEDMEM::RefCountObject::decrRef; %ignore ParaMEDMEM::MemArray::operator=; %ignore ParaMEDMEM::MemArray::operator[]; @@ -7057,6 +7058,19 @@ namespace ParaMEDMEM }; } +%inline %{ + PyObject *MEDCouplingVersionMajMinRel() + { + int tmp0=0,tmp1=0,tmp2=0; + MEDCouplingVersionMajMinRel(tmp0,tmp1,tmp2); + PyObject *res = PyList_New(3); + PyList_SetItem(res,0,SWIG_From_int(tmp0)); + PyList_SetItem(res,1,SWIG_From_int(tmp1)); + PyList_SetItem(res,2,SWIG_From_int(tmp2)); + return res; + } +%} + %pythoncode %{ import os __filename=os.environ.get('PYTHONSTARTUP') -- 2.39.2