Ignore:
Timestamp:
04/15/13 12:12:26 (11 years ago)
Author:
Takeshi Nakazato
Message:

New Development: No

JIRA Issue: No

Ready for Test: Yes

Interface Changes: No

What Interface Changed: Please list interface changes

Test Programs: List test programs

Put in Release Notes: Yes/No?

Module(s): Module Names change impacts.

Description: Describe your changes here...

Refactoring NRO NEWSTAR filler. Introduced map and internal structure
to represent names and associated properties for each fields in
scan header.


File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/external-alma/atnf/PKSIO/NROFITSDataset.h

    r2784 r2812  
    3939
    4040#include <string>
     41#include <map>
    4142
    4243using namespace std ;
     
    9798
    9899 protected:
     100  // stracture representing property of fields
     101  struct FieldProperty {
     102    //string name;    // field name
     103    int size;         // data size [byte]
     104    //string unit;    // unit of the field
     105    long offset;      // offset from the head of scan record [byte]
     106  };
     107
    99108  // fill header information
    100109  int fillHeader( int sameEndian ) ;
    101110
    102111  // Read char data
    103   int readHeader( string &v, char *name ) ;
    104   int readTable( char *v, char *name, int clen, int idx=0 ) ;
    105   int readTable( vector<char *> &v, char *name, int idx=0 ) ;
    106   int readColumn( vector<string> &v, char *name, int idx=0 ) ;
     112  int readHeader( string &v, const char *name ) ;
     113  int readTable( char *v, const char *name, int clen, int idx=0 ) ;
     114  int readTable( vector<char *> &v, const char *name, int idx=0 ) ;
     115  int readColumn( vector<string> &v, const char *name, int idx=0 ) ;
    107116
    108117  // Read int data
    109   int readHeader( int &v, char *name) ;
    110   int readTable( int &v, char *name, int b, int idx=0 ) ;
    111   int readTable( vector<int> &v, char *name, int b, int idx=0 ) ;
    112   int readColumn( vector<int> &v, char *name, int b, int idx=0 ) ;
     118  int readHeader( int &v, const char *name) ;
     119  int readTable( int &v, const char *name, int b, int idx=0 ) ;
     120  int readTable( vector<int> &v, const char *name, int b, int idx=0 ) ;
     121  int readColumn( vector<int> &v, const char *name, int b, int idx=0 ) ;
    113122
    114123  // Read float data
    115   int readHeader( float &v, char *name) ;
    116   int readTable( float &v, char *name, int b, int idx=0 ) ;
    117   int readTable( vector<float> &v, char *name, int b, int idx=0 ) ;
    118   int readColumn( vector<float> &v, char *name, int b, int idx=0 ) ;
     124  int readHeader( float &v, const char *name) ;
     125  int readTable( float &v, const char *name, int b, int idx=0 ) ;
     126  int readTable( vector<float> &v, const char *name, int b, int idx=0 ) ;
     127  int readColumn( vector<float> &v, const char *name, int b, int idx=0 ) ;
    119128
    120129  // Read double data
    121   int readHeader( double &v, char *name) ;
    122   int readTable( double &v, char *name, int b, int idx=0 ) ;
    123   int readTable( vector<double> &v, char *name, int b, int idx=0 ) ;
    124   int readColumn( vector<double> &v, char *name, int b, int idx=0 ) ;
     130  int readHeader( double &v, const char *name) ;
     131  int readTable( double &v, const char *name, int b, int idx=0 ) ;
     132  int readTable( vector<double> &v, const char *name, int b, int idx=0 ) ;
     133  int readColumn( vector<double> &v, const char *name, int b, int idx=0 ) ;
    125134
    126135  // read ARRY
     
    143152
    144153  // get offset bytes for attributes
    145   long getOffset( char *name ) ;
     154  long getOffset( const char *name ) ;
    146155
    147156  // move pointer to target position
    148   int movePointer( char *name, int idx=0 ) ;
    149 
    150   // convert frequency frame
    151 //   virtual double toLSR( double v, double t, double x, double y ) ;
     157  int movePointer( const char *name, int idx=0 ) ;
    152158
    153159  // number of column for scan header
     
    163169  vector<int> arrayid_ ;
    164170
    165   // field names
    166   vector<string> names_ ;
    167 
    168   // field units
    169   vector<string> units_ ;
    170 
    171   // sizes of each field
    172   vector<int> sizes_ ; 
    173 
    174   // offsets from the beginning of the file
    175   vector<long> offsets_ ;
     171  // field properties
     172  // Key   = field name
     173  // Value = field properties
     174  map<string, FieldProperty> properties_ ;
    176175
    177176  // spectral data
Note: See TracChangeset for help on using the changeset viewer.