Salome HOME
Addition of new reference coords including degenerated cells.
[modules/med.git] / src / MEDCoupling / MEDCouplingRefCountObject.hxx
index c466315b385c8be839985c9763fcb16a32de7b27..e0bf7950f5b8241bf1092fbcdbdb3cea90683ceb 100644 (file)
@@ -1,4 +1,4 @@
-// Copyright (C) 2007-2012  CEA/DEN, EDF R&D
+// Copyright (C) 2007-2013  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
 //
 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
 //
+// Author : Anthony Geay (CEA/DEN)
 
 #ifndef __PARAMEDMEM_MEDCOUPLINGREFCOUNTOBJECT_HXX__
 #define __PARAMEDMEM_MEDCOUPLINGREFCOUNTOBJECT_HXX__
 
 #include "MEDCoupling.hxx"
 
+#include <set>
+#include <vector>
+#include <string>
+#include <cstddef>
+
 namespace ParaMEDMEM
 {
   typedef enum
@@ -49,19 +55,49 @@ namespace ParaMEDMEM
 
   typedef bool (*FunctionToEvaluate)(const double *pos, double *res);
 
-  class MEDCOUPLING_EXPORT RefCountObject
+  MEDCOUPLING_EXPORT const char *MEDCouplingVersionStr();
+  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 static std::size_t GetHeapMemorySizeOfObjs(const std::vector<const BigMemoryObject *>& objs);
+    MEDCOUPLING_EXPORT virtual std::size_t getHeapMemorySizeWithoutChildren() const = 0;
+    MEDCOUPLING_EXPORT virtual std::vector<const BigMemoryObject *> getDirectChildren() const = 0;
+    MEDCOUPLING_EXPORT virtual ~BigMemoryObject();
+  private:
+    static std::size_t GetHeapMemoryOfSet(std::set<const BigMemoryObject *>& s1, std::set<const BigMemoryObject *>& s2);
+  };
+  
+  class RefCountObjectOnly
   {
   protected:
-    RefCountObject();
-    RefCountObject(const RefCountObject& other);
+    MEDCOUPLING_EXPORT RefCountObjectOnly();
+    MEDCOUPLING_EXPORT RefCountObjectOnly(const RefCountObjectOnly& other);
   public:
-    bool decrRef() const;
-    void incrRef() 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