seg2.c File Reference

#include <stdio.h>
#include <ctype.h>
#include <stdlib.h>
#include <unistd.h>
#include <time.h>
#include <string.h>
#include <assert.h>
#include <sys/types.h>
#include "common.h"

Include dependency graph for seg2.c:

Go to the source code of this file.

Functions

int AddString (FILE *f, char *str)
int WriteFileDescriptorBlock (FILE *f)
 Only Write File descriptor Block.
int UpdateFileDescriptorBlock (FILE *f, int channelS0)
 UPDATE FILE DESCRIPTOR BLOCK WHEN ADDING A CHANNEL.
int WriteTraceDescriptorBlock (FILE *f, int channel)
 write a SEG-2 file descriptor block
FILE * OpenFullSeg2 (char *path, int channel)
FILE * OpenSeg2Channel (int channel)
 open an seg2 file for output
void AppendChannelToSeg2File (int channel, FILE *fid)
 Function exact copy Only data are written in the file identified by fid the data after TraceDescriptorBlock in the file identified by seg2File.
void CloseFullSeg2File ()
void CloseSeg2File (int channel)
 end a SEG2 channel file The seg2 header is updated according to the previous information structure
void AbortSeg2File (int channel)
 cancel a SEG2 channel file
void AddSeg2Data (int channel)
 process one channel

Variables

FILE * seg2ChannelFile [MAX_CHANNEL]
char seg2ChannelFileName [MAX_CHANNEL][128]
int KFULLSEG = 1
FILE * seg2File = NULL
char seg2FileName [128]
int NbrChan = 0
int CurChan = 0


Function Documentation

void AbortSeg2File ( int  channel  ) 

cancel a SEG2 channel file

Parameters:
channel the channel to cancel

Definition at line 453 of file seg2.c.

References PrintDebug, seg2ChannelFile, and seg2ChannelFileName.

Referenced by AddSeg2Data().

void AddSeg2Data ( int  channel  ) 

process one channel

Definition at line 466 of file seg2.c.

References AbortSeg2File(), HWConfigType::data, HWConfig, infoHeader, InfoHeaderType::npts, Titan2SRType::npts, OpenSeg2Channel(), PrintError, seg2ChannelFile, seg2ChannelFileName, HWConfigType::srExp, and HWConfigType::srObs.

Referenced by EndSuperFrame().

Here is the call graph for this function:

int AddString ( FILE *  f,
char *  str 
)

Definition at line 58 of file seg2.c.

Referenced by WriteFileDescriptorBlock(), and WriteTraceDescriptorBlock().

void AppendChannelToSeg2File ( int  channel,
FILE *  fid 
)

Function exact copy Only data are written in the file identified by fid the data after TraceDescriptorBlock in the file identified by seg2File.

Definition at line 368 of file seg2.c.

References infoHeader, and seg2File.

Referenced by CloseSeg2File().

void CloseFullSeg2File ( void   ) 

Definition at line 379 of file seg2.c.

References CurChan, NbrChan, and seg2File.

Referenced by FlushDataFiles().

void CloseSeg2File ( int  channel  ) 

end a SEG2 channel file The seg2 header is updated according to the previous information structure

Parameters:
channel the channel to close

Definition at line 396 of file seg2.c.

References AppendChannelToSeg2File(), CurChan, FileName(), fileNameOptions, KFULLSEG, NbrChan, noWrite, OpenFullSeg2(), PrintError, Rename(), seg2ChannelFile, seg2ChannelFileName, seg2File, UpdateFileDescriptorBlock(), UpdateInfoHeader(), and WriteTraceDescriptorBlock().

Referenced by FlushDataFiles().

Here is the call graph for this function:

FILE* OpenFullSeg2 ( char *  path,
int  channel 
)

Definition at line 311 of file seg2.c.

References ADD_CHANNEL_CODE, ADD_NETWORK_CODE, FileName(), fileNameOptions, KFULLSEG, PrintLog, seg2File, and WriteFileDescriptorBlock().

Referenced by CloseSeg2File().

Here is the call graph for this function:

FILE* OpenSeg2Channel ( int  channel  ) 

open an seg2 file for output

Parameters:
channel the channel number
Returns:
the correponding FILE* pointer, NULL on error

Definition at line 338 of file seg2.c.

References FILE_BUFFER_SIZE, InitInfoHeader(), NbrChan, OpenTempFile(), PrintError, seg2ChannelFile, and seg2ChannelFileName.

Referenced by AddSeg2Data().

Here is the call graph for this function:

int UpdateFileDescriptorBlock ( FILE *  f,
int  channelS0 
)

UPDATE FILE DESCRIPTOR BLOCK WHEN ADDING A CHANNEL.

Parameters:
f : the file to write to
channelS0 : the ieme channel to process,(first processed channel is 0)
Returns:
0

Definition at line 194 of file seg2.c.

Referenced by CloseSeg2File().

int WriteFileDescriptorBlock ( FILE *  f  ) 

Only Write File descriptor Block.

Parameters:
f the file to write to

Definition at line 83 of file seg2.c.

References AddString(), correctedTime, infoHeader, and NbrChan.

Referenced by OpenFullSeg2().

Here is the call graph for this function:

int WriteTraceDescriptorBlock ( FILE *  f,
int  channel 
)

write a SEG-2 file descriptor block

Parameters:
f the file to write to
channel the channel to process : number between zero and MAX_CHANNEL
Returns:
0

Definition at line 222 of file seg2.c.

References AddString(), Titan2SRType::base, currentFile, HWConfigType::gain, HWConfig, infoHeader, HWConfigType::LSB, InfoHeaderType::npts, HWConfigType::selectedGain, and InfoHeaderType::sr.

Referenced by CloseSeg2File().

Here is the call graph for this function:


Variable Documentation

int CurChan = 0

Definition at line 56 of file seg2.c.

Referenced by CloseFullSeg2File(), and CloseSeg2File().

int KFULLSEG = 1

Definition at line 49 of file seg2.c.

Referenced by CloseSeg2File(), and OpenFullSeg2().

int NbrChan = 0

Definition at line 55 of file seg2.c.

Referenced by CloseFullSeg2File(), CloseSeg2File(), OpenSeg2Channel(), and WriteFileDescriptorBlock().

FILE* seg2ChannelFile[MAX_CHANNEL]

Initial value:

 {
        NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,
        NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,
        NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,
        NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,
        NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,
}

Definition at line 39 of file seg2.c.

Referenced by AbortSeg2File(), AddSeg2Data(), CloseSeg2File(), and OpenSeg2Channel().

char seg2ChannelFileName[MAX_CHANNEL][128]

Definition at line 47 of file seg2.c.

Referenced by AbortSeg2File(), AddSeg2Data(), CloseSeg2File(), and OpenSeg2Channel().

FILE* seg2File = NULL

Definition at line 53 of file seg2.c.

Referenced by AppendChannelToSeg2File(), CloseFullSeg2File(), CloseSeg2File(), and OpenFullSeg2().

char seg2FileName[128]

Definition at line 54 of file seg2.c.


Generated on Tue Jul 22 23:11:57 2008 for Titan2Reader by  doxygen 1.5.6