+ int ver=SALOMEMED_VERSION;
+ maj=(ver & 0xFF0000) >> 16;
+ minor=(ver & 0xFF00) >> 8;
+ releas=(ver & 0xFF);
+}
+
+int ParaMEDMEM::MEDCouplingSizeOfVoidStar()
+{
+ return 8*sizeof(std::size_t);
+}
+
+/*!
+ * If true is returned it is a LittleEndian machine.
+ * If false it is a BigEndian machine.
+ * \return the coding mode of integers of the machine.
+ */
+bool ParaMEDMEM::MEDCouplingByteOrder()
+{
+ unsigned int x(1);
+ unsigned char *xc(reinterpret_cast<unsigned char *>(&x));
+ return xc[0]==1;
+}
+
+const char *ParaMEDMEM::MEDCouplingByteOrderStr()
+{
+ static const char LITTLEENDIAN_STR[]="LittleEndian";
+ static const char BIGENDIAN_STR[]="BigEndian";
+ if(MEDCouplingByteOrder())
+ return LITTLEENDIAN_STR;
+ else
+ return BIGENDIAN_STR;
+}
+
+//=
+
+std::size_t BigMemoryObject::getHeapMemorySize() const
+{
+ std::size_t ret(getHeapMemorySizeWithoutChildren());
+ std::vector<const BigMemoryObject *> v(getDirectChildren());
+ std::set<const BigMemoryObject *> s1,s2(v.begin(),v.end());
+ return ret+GetHeapMemoryOfSet(s1,s2);
+}
+
+std::size_t BigMemoryObject::GetHeapMemorySizeOfObjs(const std::vector<const BigMemoryObject *>& objs)
+{
+ std::size_t ret(0);
+ std::set<const BigMemoryObject *> s1,s2;
+ for(std::vector<const BigMemoryObject *>::const_iterator it0=objs.begin();it0!=objs.end();it0++)
+ {
+ if(*it0)
+ if(s1.find(*it0)==s1.end())
+ {
+ std::vector<const BigMemoryObject *> vTmp((*it0)->getDirectChildren());
+ s2.insert(vTmp.begin(),vTmp.end());
+ ret+=(*it0)->getHeapMemorySizeWithoutChildren();
+ s1.insert(*it0);
+ }
+ }
+ return ret+GetHeapMemoryOfSet(s1,s2);
+}
+
+std::size_t BigMemoryObject::GetHeapMemoryOfSet(std::set<const BigMemoryObject *>& s1, std::set<const BigMemoryObject *>& s2)
+{
+ std::size_t ret(0);
+ while(!s2.empty())
+ {
+ std::set<const BigMemoryObject *> s3;
+ for(std::set<const BigMemoryObject *>::const_iterator it=s2.begin();it!=s2.end();it++)
+ {
+ if(s1.find(*it)==s1.end())
+ {
+ ret+=(*it)->getHeapMemorySizeWithoutChildren();
+ s1.insert(*it);
+ std::vector<const BigMemoryObject *> v2((*it)->getDirectChildren());
+ for(std::vector<const BigMemoryObject *>::const_iterator it2=v2.begin();it2!=v2.end();it2++)
+ if(s1.find(*it2)==s1.end())
+ s3.insert(*it2);
+ }
+ }
+ s2=s3;
+ }
+ return ret;