Commit 3292a996 authored by Reza  ANSARI's avatar Reza ANSARI
Browse files

Ajout de la classe P4VisMtxDBDescReader et du programme p4vdblist.cc pour...

Ajout de la classe P4VisMtxDBDescReader et du programme p4vdblist.cc pour lister la description des fichiers de visibilites pour un run (repertoire), Reza 15/07/2018
parent 96da9418
......@@ -10,13 +10,13 @@ MYINCLISTHERE = p4autils.h visip4reader.h visp4winreader.h p4gnugain.h p4gvcor.h
MYOLISTHERE = $(OBJ)/p4autils.o $(OBJ)/visip4reader.o $(OBJ)/visp4winreader.o $(OBJ)/p4gnugain.o $(OBJ)/p4gvcor.o $(OBJ)/p4phcor.o
# Define our target list
all : rdvisip4 visi2ntac visi2dtacx visi2tmfreq tstutls p4conv2fits msvis2dt visiavg filt_blind ckconvphases vis2ra
all : rdvisip4 visi2ntac visi2dtacx visi2tmfreq tstutls p4conv2fits msvis2dt visiavg filt_blind ckconvphases vis2ra p4vdblist
clean :
rm -f $(EXE)/rdvisip4 $(EXE)/visi2ntac $(EXE)/visi2dtacx $(EXE)/visi2tmfreq $(EXE)/p4conv2fits $(EXE)/msvis2dt $(EXE)/visiavg \
$(EXE)/filt_blind $(EXE)/ckconvphases $(EXE)/vis2ra
$(EXE)/filt_blind $(EXE)/ckconvphases $(EXE)/vis2ra $(EXE)/p4vdblist
rm -f $(OBJ)/rdvisip4.o $(OBJ)/visi2ntac.o $(OBJ)/visi2dtacx.o $(OBJ)/visi2tmfreq.o $(OBJ)/p4conv2fits.o $(OBJ)/msvis2dt.o $(OBJ)/visiavg.o \
$(OBJ)/filt_blind.o $(OBJ)/ckconvphases.o $(OBJ)/vis2ra.o
$(OBJ)/filt_blind.o $(OBJ)/ckconvphases.o $(OBJ)/vis2ra.o $(OBJ)/p4vdblist.o
rm -f $(MYOLISTHERE)
depend :
......@@ -136,6 +136,16 @@ $(OBJ)/rdvisip4.o : rdvisip4.cc $(MYINCLISTHERE)
######
## programme de tests de base pour diverses classes / fonctions
p4vdblist : $(EXE)/p4vdblist
echo '---p4vdblist made'
$(EXE)/p4vdblist : $(OBJ)/p4vdblist.o $(MYOLISTHERE)
$(CXXLINK) -o $(EXE)/p4vdblist $(OBJ)/p4vdblist.o $(MYOLISTHERE) $(SOPHYAEXTSLBLIST)
$(OBJ)/p4vdblist.o : tstutls.cc $(MYINCLISTHERE)
$(CXXCOMPILE) -o $(OBJ)/p4vdblist.o p4vdblist.cc
######
## programme pour lister la description des fichiers de la base de donnees de Visibilites
tstutls : $(EXE)/tstutls
echo '---tstutls made'
......
......@@ -482,3 +482,38 @@ void VisiP4ReaderDB::OpenFiles(size_t vdbidx)
fgopenok_=true;
return;
}
/* --Methode-- */
P4VisMtxDBDescReader::P4VisMtxDBDescReader(string const & path)
{
string filename=path+'/'+"vmtxdbdesc.txt";
std::ifstream is(filename.c_str(), std::ifstream::in);
string line;
size_t iv, nl;
int ms1,ms2,fs;
char date1[64], date2[64], tu1[64], tu2[64];
while (!is.eof()) {
line = "";
getline(is, line);
if ((is.good() || is.eof()) && (line.length()>0) && (line[0]!='#')) {
sscanf(line.c_str(),"%d %d %d %s %s UT %s %s", &fs, &ms1, &ms2, date1,tu1,date2,tu2);
VDBEL2 dbel;
dbel.filenum = fs;
dbel.ser_start = ms1;
dbel.ser_end = ms2;
dbel.tu_start = TimeStamp(date1,tu1);
dbel.tu_end = TimeStamp(date2,tu2);
vdb_.push_back(dbel);
}
}
return;
}
int P4VisMtxDBDescReader::getInfo(size_t k, int & ser_start, int & ser_end, TimeStamp & tustart, TimeStamp & tuend)
{
if (k >= vdb_.size()) throw RangeCheckError("P4VisMtxDBDescReader::getInfo() Out of range k >= vdb_.size()");
ser_start=vdb_[k].ser_start; ser_end=vdb_[k].ser_end;
tustart=vdb_[k].tu_start; tuend=vdb_[k].tu_end;
return vdb_[k].filenum;
}
......@@ -221,5 +221,20 @@ protected:
// For compatibility for old code
typedef VisiP4ReaderNoDB VisiP4Reader;
/*! \brief Reads the Data description file vmtxdbdesc.txt written by TAcq/VisMtxDBWriter class */
class P4VisMtxDBDescReader {
public:
//! Constructor, reads the database description file path/vmtxdbdesc.txt
P4VisMtxDBDescReader(string const & path);
//! return the number of items in the description file
inline size_t size() const { return vdb_.size(); }
//! return the number of visibility files (or items in the description file) -
inline size_t getNFiles() const { return vdb_.size(); }
//! return the file number
int getInfo(size_t k, int & ser_start, int & ser_end, TimeStamp & tmstart, TimeStamp & tmend);
protected:
typedef struct { int filenum, ser_start, ser_end; TimeStamp tu_start, tu_end; } VDBEL2;
std::vector< VDBEL2 > vdb_;
};
#endif
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment