Changeset 2805 in Sophya for trunk/SophyaLib/BaseTools/swsegdb.h
- Timestamp:
- Jun 9, 2005, 6:20:00 PM (20 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/SophyaLib/BaseTools/swsegdb.h
r2698 r2805 12 12 #include <typeinfo> 13 13 14 namespace SOPHYA {15 16 ////////////////////////////////////////////////////////////////17 //// ------------- Class DataSwapperInterface --------------- //18 //// ---------------- Class SwSegDataBlock ------------------ //19 ////////////////////////////////////////////////////////////////20 21 14 /*! 22 15 \class SOPHYA::DataSwapperInterface … … 25 18 with SOPHYA::SwSegDataBlock classes. 26 19 */ 27 template <class T>28 class DataSwapperInterface {29 public:30 virtual ~DataSwapperInterface() { }31 //! Swap out the data array pointed by \b d with size \b sz32 virtual int_8 WriteToSwap(const T * d, size_t sz, int_8 idx, int_8 oswp=0, bool osw=false) = 0;33 //! Swap in the data array pointed by \b d with size \b sz34 virtual void ReadFromSwap(int_8 idx, int_8 swp, T* d, size_t sz) = 0;35 };36 37 //! Segmented data structure with swap management38 20 /*! 39 21 \class SOPHYA::SwSegDataBlock … … 41 23 Segmented data structure with swap space management. 42 24 */ 25 26 namespace SOPHYA { 27 28 //////////////////////////////////////////////////////////////// 29 //// ------------- Class DataSwapperInterface --------------- // 30 //// ---------------- Class SwSegDataBlock ------------------ // 31 //////////////////////////////////////////////////////////////// 32 33 template <class T> 34 class DataSwapperInterface { 35 public: 36 virtual ~DataSwapperInterface() { } 37 /*! Swap out the data array pointed by \b d with size \b sz 38 Return the swap position which might be used later to retrieve the data from swap 39 \param d : Pointer to the memory segment 40 \param sz : Number of elements (type T) 41 \param idx : An integer which might be used to identify the data (optional) 42 \param oswp : Old swap position, if the data has already been swapped 43 \param osw : true -> data has already been swapped 44 */ 45 virtual int_8 WriteToSwap(const T * d, size_t sz, int_8 idx, int_8 oswp=0, bool osw=false) = 0; 46 /*! Swap in the data array pointed by \b d with size \b sz 47 Retrieves the data from swap space and copies it to \b d 48 \param idx : optional data identifier 49 \param swp : swap position (obtained from a previous call to WriteToSwap() 50 \param d : pointer to T , where the data will be copied from swap space 51 \param sz : Number of data elements (type T) 52 */ 53 virtual void ReadFromSwap(int_8 idx, int_8 swp, T* d, size_t sz) = 0; 54 }; 55 43 56 template <class T> 44 57 class SwSegDataBlock : public SegDBInterface<T> { … … 172 185 } 173 186 187 //! \cond 174 188 typedef struct { 175 189 size_t nref; // Number of references to the data structure … … 183 197 DataSwapperInterface<T> * swapper; // Data swapper 184 198 } SWSDREF; 185 199 //! \endcond 186 200 SWSDREF * mSRef; // SWSDREF structure for reference sharing 187 201 };
Note:
See TracChangeset
for help on using the changeset viewer.