Ignore:
Timestamp:
Sep 18, 1999, 2:08:23 PM (26 years ago)
Author:
ansari
Message:

apres grenoble

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Poubelle/archTOI.old/archeopsfile.cc

    r405 r407  
    55#define utilitaires_de_block_archeops
    66#include "archeopsfile.h"
     7#include "gyrohandler.h"
     8
    79extern "C" {
    810#include "compress.h"
     
    4143  block_type_modele         peekBlock;
    4244 
    43   SSTHandler sstHandler;
    44   GPSParser  gpsParser;
     45  SSTHandler   sstHandler;
     46  GyroHandler  gyroHandler;
     47  GPSParser    gpsParser;
    4548};
    4649
     
    8588
    8689BlockSet::BlockSet(BlockSet const& x)
    87 : sstHandler(x.sstHandler)
     90: sstHandler(x.sstHandler), gyroHandler(x.gyroHandler)
    8891{
    8992  lastParam      = NULL;
     
    567570       blockSet->sstHandler.ProcessBlock((block_type_sst*)&blockSet->curBlock);
    568571     }
     572     case block_gyro : {
     573       blockSet->gyroHandler.ProcessBlock((block_type_gyro*)&blockSet->curBlock);
     574     }
    569575     case block_gps : {
    570576       blockSet->gpsParser.ProcessBlock((block_type_gps*)&blockSet->curBlock);
     
    673679  static char* buffer = 0;
    674680  static int4  debswp = debut_block_mesure;
    675   static int4  longmax = taille_maxi_block_archeops*20;
     681  static int4  longmax = taille_maxi_block_archeops*20; 
    676682  if (!buffer) {
    677683    buffer = new char[longmax];
     
    680686#endif
    681687  }
    682   fseek(f,pos,SEEK_SET);
    683   size_t read = fread(buffer,1,taille_maxi_block_archeops*2,f);
    684   //if (read<taille_maxi_block_archeops*2) return -1;
    685   for (int i=4; i<read; i+=4) {
    686     if (*(int4*)(buffer+i) == debswp) {
    687       cout << "trying to skip " << i << " bytes to pos="<<pos+i << endl;
    688       return pos+i;
     688  size_t read = longmax;
     689  while (read == longmax) {
     690    fseek(f,pos,SEEK_SET);
     691    read = fread(buffer,1,longmax,f);
     692    //if (read<taille_maxi_block_archeops*2) return -1;
     693    // EA 150999 changed i+=4 to i++ -> unaligned, but can lose bytes in flight recorder
     694    for (size_t i=4; i<read; i++) {
     695      if (*(int4*)(buffer+i) == debswp) {
     696        cout << "trying to skip " << i << " bytes to pos="<<pos+i << endl;
     697        return pos+i;
     698      }
    689699    }
     700    pos += read;
    690701  }
    691702  cout << "cannot find block start" << endl;
     
    758769}
    759770
     771int ArcheopsFile::getReglageBlockNum() {
     772  if (!lastReglage()) return -1;
     773  return numero_block(lastReglage());
     774}
     775
     776
    760777int ArcheopsFile::getSSTBlockNum() {
    761778  if (!lastSST()) return -1;
     
    864881}
    865882
     883double ArcheopsFile::getGainAmpli(int ibolo) {
     884     return gain_ampli(lastReglage()->reglage.bolo[ibolo]);
     885}
    866886
    867887// SST, gyros...
     
    895915}
    896916
    897 long ArcheopsFile::getGyro(int igyro, int imesure) {   
    898   if (igyro<0 || igyro>2) return 0;
    899   if (imesure<0 || imesure>= nb_per_block*2) return 0;
    900   block_type_gyro* blk = lastGyro() ;
    901   if (!blk) return 0;
    902 #if version_num<=25
    903   return blk->gyros[igyro][imesure]-32768.;
    904 #else
    905   return blk->gyro[igyro][imesure]-32768.;
    906 #endif
    907 }
     917long ArcheopsFile::getGyroRaw(int igyro, int imesure) {   
     918  return blockSet->gyroHandler.getRawSignal(imesure, igyro);
     919}
     920
     921double ArcheopsFile::getGyroTens(int igyro, int imesure) {   
     922  return blockSet->gyroHandler.getSignal(imesure, igyro);
     923}
     924
     925double ArcheopsFile::getGyroSpeed(int igyro, int imesure) {   
     926  return blockSet->gyroHandler.getSpeed(imesure, igyro);
     927}
     928
     929
    908930
    909931
Note: See TracChangeset for help on using the changeset viewer.