X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;ds=sidebyside;f=src%2FMEDCoupling%2FMEDCouplingRefCountObject.hxx;h=2c1e1640069331255f1aaea5189876c53e3f9759;hb=30e370a928f879a1c9be2bd685cda6cabec223cf;hp=0eb1f4deab79b22645baefbc315f65b06b63abc6;hpb=6851143382a6cea567b6e68f8092cbb4b1df2e16;p=tools%2Fmedcoupling.git diff --git a/src/MEDCoupling/MEDCouplingRefCountObject.hxx b/src/MEDCoupling/MEDCouplingRefCountObject.hxx index 0eb1f4dea..2c1e16400 100644 --- a/src/MEDCoupling/MEDCouplingRefCountObject.hxx +++ b/src/MEDCoupling/MEDCouplingRefCountObject.hxx @@ -1,9 +1,9 @@ -// Copyright (C) 2007-2013 CEA/DEN, EDF R&D +// Copyright (C) 2007-2014 CEA/DEN, EDF R&D // // This library is free software; you can redistribute it and/or // modify it under the terms of the GNU Lesser General Public // License as published by the Free Software Foundation; either -// version 2.1 of the License. +// version 2.1 of the License, or (at your option) any later version. // // This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of @@ -23,32 +23,35 @@ #include "MEDCoupling.hxx" +#include +#include +#include #include namespace ParaMEDMEM { typedef enum - { - C_DEALLOC = 2, - CPP_DEALLOC = 3 - } DeallocType; + { + C_DEALLOC = 2, + CPP_DEALLOC = 3 + } DeallocType; typedef enum - { - ON_CELLS = 0, - ON_NODES = 1, - ON_GAUSS_PT = 2, - ON_GAUSS_NE = 3, - ON_NODES_KR = 4 - } TypeOfField; + { + ON_CELLS = 0, + ON_NODES = 1, + ON_GAUSS_PT = 2, + ON_GAUSS_NE = 3, + ON_NODES_KR = 4 + } TypeOfField; typedef enum - { - NO_TIME = 4, - ONE_TIME = 5, - LINEAR_TIME = 6, - CONST_ON_TIME_INTERVAL = 7 - } TypeOfTimeDiscretization; + { + NO_TIME = 4, + ONE_TIME = 5, + LINEAR_TIME = 6, + CONST_ON_TIME_INTERVAL = 7 + } TypeOfTimeDiscretization; typedef bool (*FunctionToEvaluate)(const double *pos, double *res); @@ -56,22 +59,48 @@ namespace ParaMEDMEM MEDCOUPLING_EXPORT int MEDCouplingVersion(); MEDCOUPLING_EXPORT void MEDCouplingVersionMajMinRel(int& maj, int& minor, int& releas); MEDCOUPLING_EXPORT int MEDCouplingSizeOfVoidStar(); + MEDCOUPLING_EXPORT bool MEDCouplingByteOrder(); + MEDCOUPLING_EXPORT const char *MEDCouplingByteOrderStr(); + + class BigMemoryObject + { + public: + MEDCOUPLING_EXPORT std::size_t getHeapMemorySize() const; + MEDCOUPLING_EXPORT std::string getHeapMemorySizeStr() const; + MEDCOUPLING_EXPORT std::vector getDirectChildren() const; + MEDCOUPLING_EXPORT std::vector getAllTheProgeny() const; + MEDCOUPLING_EXPORT bool isObjectInTheProgeny(const BigMemoryObject *obj) const; + MEDCOUPLING_EXPORT static std::size_t GetHeapMemorySizeOfObjs(const std::vector& objs); + MEDCOUPLING_EXPORT virtual std::size_t getHeapMemorySizeWithoutChildren() const = 0; + MEDCOUPLING_EXPORT virtual std::vector getDirectChildrenWithNull() const = 0; + MEDCOUPLING_EXPORT virtual ~BigMemoryObject(); + private: + static std::size_t GetHeapMemoryOfSet(std::set& s1, std::set& s2); + }; - class MEDCOUPLING_EXPORT RefCountObject + class RefCountObjectOnly { protected: - RefCountObject(); - RefCountObject(const RefCountObject& other); + MEDCOUPLING_EXPORT RefCountObjectOnly(); + MEDCOUPLING_EXPORT RefCountObjectOnly(const RefCountObjectOnly& other); public: - bool decrRef() const; - void incrRef() const; - virtual std::size_t getHeapMemorySize() const = 0; - int getRCValue() const; + MEDCOUPLING_EXPORT bool decrRef() const; + MEDCOUPLING_EXPORT void incrRef() const; + MEDCOUPLING_EXPORT int getRCValue() const; + MEDCOUPLING_EXPORT RefCountObjectOnly& operator=(const RefCountObjectOnly& other); protected: - virtual ~RefCountObject(); + virtual ~RefCountObjectOnly(); private: mutable int _cnt; }; + + class RefCountObject : public RefCountObjectOnly, public BigMemoryObject + { + protected: + MEDCOUPLING_EXPORT RefCountObject(); + MEDCOUPLING_EXPORT RefCountObject(const RefCountObject& other); + MEDCOUPLING_EXPORT virtual ~RefCountObject(); + }; } #endif