Changeset 2808 in Sophya for trunk/SophyaLib/HiStats/swppfdtable.cc
- Timestamp:
- Jun 14, 2005, 1:25:05 PM (20 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/SophyaLib/HiStats/swppfdtable.cc
r2699 r2808 9 9 This class can be used to organize data in table (row-column) form. 10 10 Each column holds homogeneous data (same data type), while different 11 columns can be used for different data types (integer, float, string ...) 11 columns can be used for different data types 12 (integer, float, string ...). 13 A PPF stream is used as swap space. Due to limitations in the current 14 implementation of PPF streams, read operations (acces to table data) cannot 15 be performed when a table is being filled. 16 17 \warning 18 - When creating a table, the output PPF stream (POutPersist) must not be closed 19 (destroyed) before the call to the SwPPFDataTable object. 20 - It is not possible to make a complete (deep) copy of a table SwPPFDataTable 21 Copy constructor and equal operator shares the data. 22 - Although the destructor DOES NOT save the 23 table object itself to the memory. You have to use the << operator on the 24 output PPF stream being used as swap 25 12 26 \sa SOPHYA::MuTyV 13 \sa SOPHYA:: BaseDataTable14 \sa SOPHYA:: ObjFileIO<DataTable>27 \sa SOPHYA::DataTable 28 \sa SOPHYA::SwSegDataBlock SOPHYA::PPFDataSwapper 15 29 16 30 \code 17 31 #include "swppfdtable.h" 18 32 // ... 19 DataTable dt(64); 33 { 34 // ---- Creation of the table 35 // Create the swap stream 36 POutPersist so("myswtable.ppf"); 37 SwPPFDataTable dt(so, 64); 38 // define table columns 20 39 dt.AddFloatColumn("X0_f"); 21 40 dt.AddFloatColumn("X1_f"); 22 41 dt.AddDoubleColumn("X0X0pX1X1_d"); 23 double x[5]; 42 // Fill the table 43 MuTyV x[5]; 24 44 for(int i=0; i<63; i++) { 25 45 x[0] = (i%9)-4.; x[1] = (i/9)-3.; x[2] = x[0]*x[0]+x[1]*x[1]; … … 28 48 // Printing table info 29 49 cout << dt ; 30 // Saving object into a PPF file 31 POutPersist po("dtable.ppf"); 32 po << dt ; 50 // Swap out all data and write the table structure to the PPF stream 51 so << dt ; 52 // .... 53 } 54 { 55 // ---- Accessing information from a previously created table 56 SwPPFDataTable dt; 57 PInPersist si("myswtable.ppf"); 58 si >> dt; 59 // Printing table info 60 cout << dt ; 61 } 33 62 \endcode 34 63 */ 35 /*! Default constructor with optional specification of block (or segment) size - 36 NOT intented for general use 37 */ 64 //! Default constructor with optional specification of block (or segment) size 38 65 SwPPFDataTable::SwPPFDataTable(sa_size_t segsz) 39 66 : BaseDataTable(segsz), … … 205 232 206 233 234 /*! 235 Implements the action defined in the BaseDataTable interface. 236 In the current implementation, throws an exception (ParmError) 237 if the table contains some data already. 238 */ 207 239 sa_size_t SwPPFDataTable::AddColumn(FieldType ft, string const & cnom) 208 240 { … … 271 303 } 272 304 305 //! Adds a line (or row to the table) with r_8* input data. 306 /*! 307 The min/max values for each column is updated, in addition 308 to the actions performed by the base class AddLine() 309 */ 273 310 sa_size_t SwPPFDataTable::AddLine(const r_8* data) 274 311 { … … 284 321 } 285 322 323 //! Adds a line (or row to the table) with input data as an array of MuTyV 324 /*! 325 The min/max values for each column is updated, in addition 326 to the actions performed by the base class AddLine() 327 */ 286 328 sa_size_t SwPPFDataTable::AddLine(const MuTyV * data) 287 329 {
Note:
See TracChangeset
for help on using the changeset viewer.