Salome HOME
Writing binary VTK files in MEDCoupling
[tools/medcoupling.git] / src / MEDCoupling / MEDCouplingRefCountObject.cxx
index c8de20ea996aef5ae3d3f85be783a7c5c690a308..7f9f493f699e17bb262483694325c10affc72de7 100644 (file)
@@ -46,6 +46,28 @@ 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;
+}
+
 RefCountObject::RefCountObject():_cnt(1)
 {
 }
@@ -54,6 +76,15 @@ RefCountObject::RefCountObject(const RefCountObject& other):_cnt(1)
 {
 }
 
+/*!
+ * Do nothing here ! It is not a bug ( I hope :) ) because all subclasses that
+ * copies using operator= should not copy the ref counter of \a other !
+ */
+RefCountObject& RefCountObject::operator=(const RefCountObject& other)
+{
+  return *this;
+}
+
 bool RefCountObject::decrRef() const
 {
   bool ret=((--_cnt)==0);