0027241: Create a complete test case to verify reading of all attribute types from...
[occt.git] / src / StdLPersistent / StdLPersistent_HArray2.hxx
index 045bcb5..c4941fc 100644 (file)
 #define _StdLPersistent_HArray2_HeaderFile
 
 #include <StdObjMgt_Persistent.hxx>
+#include <StdObjMgt_ReadData.hxx>
+
+#include <NCollection_DefineHArray2.hxx>
 
 #include <TColStd_HArray2OfInteger.hxx>
 #include <TColStd_HArray2OfReal.hxx>
 
 
+DEFINE_HARRAY2 (StdLPersistent_HArray2OfPersistent,
+                NCollection_Array2<Handle(StdObjMgt_Persistent)>)
+
+
 class StdLPersistent_HArray2
 {
-  class commonBase : public StdObjMgt_Persistent
+  class base : public StdObjMgt_Persistent
   {
   public:
     //! Read persistent data from a file.
@@ -42,7 +49,7 @@ class StdLPersistent_HArray2
 
 protected:
   template <class ArrayClass>
-  class base : public commonBase
+  class instance : public base
   {
   public:
     typedef Handle(ArrayClass) ArrayHandle;
@@ -60,23 +67,19 @@ protected:
                                 theLowerCol, theUpperCol);
     }
 
-  protected:
-    Handle(ArrayClass) myArray;
-  };
+    virtual void readValue (StdObjMgt_ReadData&    theReadData,
+                            const Standard_Integer theRow,
+                            const Standard_Integer theCol)
+      { theReadData >> myArray->ChangeValue (theRow, theCol); }
 
-private:
-  template <class ArrayClass>
-  class instance : public base<ArrayClass>
-  {
   protected:
-    Standard_EXPORT virtual void readValue (StdObjMgt_ReadData&    theReadData,
-                                            const Standard_Integer theRow,
-                                            const Standard_Integer theCol);
+    Handle(ArrayClass) myArray;
   };
 
 public:
-  typedef instance<TColStd_HArray2OfInteger> Integer;
-  typedef instance<TColStd_HArray2OfReal>    Real;
+  typedef instance<TColStd_HArray2OfInteger>           Integer;
+  typedef instance<TColStd_HArray2OfReal>              Real;
+  typedef instance<StdLPersistent_HArray2OfPersistent> Persistent;
 };
 
 #endif