source: Sophya/trunk/SophyaExt/FitsIOServer/fitsswapper.h@ 2964

Last change on this file since 2964 was 2896, checked in by ansari, 20 years ago

Correction suite modifs commentaire pour doxygen - Reza 12/01/2006

File size: 2.1 KB
RevLine 
[2782]1// This may look like C code, but it is really -*- C++ -*-
2// Gestion de block de donnees swapable
3// C. Magneville R. Ansari Mai 2005
4// LAL (Orsay) / IN2P3-CNRS DAPNIA/SPP (Saclay) / CEA
5#ifndef FITSSWAPPER_H
6#define FITSSWAPPER_H
7
8
9#include "machdefs.h"
10#include "swsegdb.h"
[2857]11#include "fitsinoutfile.h"
12#include "fitsblkrw.h"
[2782]13
14/*!
15 \class SOPHYA::FITSDataSwapper
16 \ingroup FitsIOServer
[2857]17 Implementation of SOPHYA::DataSwapperInterface interface on FITS files
18 (FitsInOutFile) to be used with SOPHYA::SwSegDataBlock classes.
[2782]19*/
20
[2896]21namespace SOPHYA {
22
[2782]23template <class T>
24class FITSDataSwapper : public DataSwapperInterface<T> {
25public:
[2857]26 FITSDataSwapper()
[2864]27 : fcol(0) , rowos(1)
[2857]28 {
29 }
[2864]30 FITSDataSwapper(FitsInOutFile & ios, int col)
31 : fios(ios) , fcol(col), rowos(1)
[2857]32 {
33 }
[2782]34
[2864]35 inline FitsInOutFile & InOutStream() { return fios; }
36 void SetInOutStream(FitsInOutFile & ios, int col)
[2857]37 {
38 fios = ios;
39 fcol = col;
40 rowos = 1;
[2864]41 /* On ne fait pas de check sur type HDU - Reza , 30/12/2005
[2857]42 if ( fios != NULL) {
43 fhdu = fios->CurrentHDU();
44 if (fios->CurrentHDUType() != BINARY_TBL)
45 throw FitsIOException("FITSDataSwapper<T>::SetInOutStream() CurrHDU not a BINARY_TBL");
[2864]46 } */
[2857]47 }
[2782]48
49 // Operateur = , on recopie les pointeurs des streams
[2857]50 FITSDataSwapper<T>& operator = (FITSDataSwapper<T> const & a)
51 {
52 fios = a.fios;
53 fcol = a.fcol;
54 rowos = a.rowos;
55 }
[2782]56
[2857]57 virtual int_8 WriteToSwap(const T * d, size_t sz, int_8 idx, int_8 oswp=0, bool osw=false)
58 {
[2864]59 /* fios->MoveAbsToHDU(fhdu); On suppose qu'on est sur le bon HDU - Reza 30/12/2005 */
[2857]60 long row = rowos;
61 if (osw) row = oswp;
[2864]62 FitsBlockRW<T>::WriteColumnData(fios, fcol, row, 1, d, sz);
[2857]63 if (!osw) rowos += sz;
64 return row;
65 }
[2782]66
[2857]67 virtual void ReadFromSwap(int_8 idx, int_8 swp, T* d, size_t sz)
68 {
[2864]69 FitsBlockRW<T>::ReadColumnData(fios, fcol, swp, 1, d, sz);
[2857]70 }
71
[2864]72 virtual DataSwapperInterface<T>* Clone()
73 {
74 FITSDataSwapper<T> * rsw = new FITSDataSwapper<T>(fios, fcol) ;
75 return rsw;
76 }
77
[2782]78protected:
[2864]79 FitsInOutFile fios;
80 int fcol;
[2782]81 long rowos;
82};
83
84} // Fin du namespace
85
86#endif
Note: See TracBrowser for help on using the repository browser.