//
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
-// Author : Anthony Geay (CEA/DEN)
+// Author : Anida Khizar (CEA/DES)
#ifndef __MEDFILTERENTITY_HXX__
#define __MEDFILTERENTITY_HXX__
#include "MEDCouplingPartDefinition.hxx"
#include "med.h"
+#include <memory>
namespace MEDCoupling
{
class MEDFilterEntity
{
public:
- MEDFilterEntity() { _filter = new med_filter; }
- ~MEDFilterEntity() { delete _filter; }
+ MEDFilterEntity() { _filter = std::make_shared<med_filter>(); }
void init() { *_filter = MED_FILTER_INIT; }
inline void fill(med_idt fid, mcIdType nbOfEntity, mcIdType nbOfValuesPerEntity, mcIdType nbOfConstituentPerValue,
const med_int constituentSelect, const med_switch_mode switchMode, const med_storage_mode storageMode, const char * const profileName,
const PartDefinition* pd);
- const med_filter *getPtr() const { return _filter; }
- void close() { MEDfilterClose(_filter); }
+ const med_filter *getPtr() const { return _filter.get(); }
+ void close() { MEDfilterClose(_filter.get()); }
private:
- med_filter *_filter;
+ std::shared_ptr<med_filter> _filter;
};
}
MEDfilterBlockOfEntityCr(fid,ToMedInt(nbOfEntity),ToMedInt(nbOfValuesPerEntity),ToMedInt(nbOfConstituentPerValue),
constituentSelect,switchMode,storageMode,profileName,
/*start*/ToMedInt(strt+1),/*stride*/ToMedInt(step),/*count*/1,/*blocksize*/ToMedInt(nbOfEltsToLoad),
- /*lastblocksize=useless because count=1*/0,_filter);
+ /*lastblocksize=useless because count=1*/0,_filter.get());
return;
}
const DataArrayPartDefinition *dpd(dynamic_cast<const DataArrayPartDefinition *>(pd));
MEDfilterEntityCr(fid,ToMedInt(nbOfEntity),ToMedInt(nbOfValuesPerEntity),ToMedInt(nbOfConstituentPerValue),
constituentSelect,switchMode,storageMode,profileName,
ToMedInt(nbOfEltsToLoad), dpdPlus1.data(),
- _filter);
+ _filter.get());
return;
}
throw INTERP_KERNEL::Exception("MEDFilterEntity::fill : empty part definition !");