#include "hades.h"
#include "hpario.h"
#include "hparhadasciifileio.h"
#include "hspectrometer.h"
#include <string.h>
ClassImp(HParHadAsciiFileIo)
HParHadAsciiFileIo::HParHadAsciiFileIo() {
fActive = 0;
}
HParHadAsciiFileIo::HParHadAsciiFileIo(Int_t typ) {
fActive = 0;
SetAsciiType(typ);
}
HParHadAsciiFileIo::HParHadAsciiFileIo(const Char_t* typ) {
fActive = 0;
SetAsciiType(typ);
}
HParHadAsciiFileIo::~HParHadAsciiFileIo() {
}
HAsciiRaw* HParHadAsciiFileIo::GetRawAscii() {
return &fRaw;
}
HAsciiKey* HParHadAsciiFileIo::GetKeyAscii() {
return &fKey;
}
void HParHadAsciiFileIo::SetAsciiType(Int_t typ) {
if (typ > 0) fActive = 1;
else fActive = 0;
}
void HParHadAsciiFileIo::SetAsciiType(const Char_t* typ) {
using namespace HadAsciiAuxiliaryFunctions;
Char_t buf1[10];
Char_t buf2[10];
strtrunc(buf1,typ);
strtolower(buf2,buf1);
if (strcompare(buf2,"key") == 0) fActive = 0;
else if (strcompare(buf2,"raw") == 0) fActive = 1;
else {
cerr << "Error in <HParHadAsciiFileIo::SetAsciiType>: "
<< "ASCII data type not recognised (now set to default \'key\').\n";
fActive = 0;
}
}
Int_t HParHadAsciiFileIo::GetAsciiType() {
return fActive;
}
Bool_t HParHadAsciiFileIo::open(Text_t* fname, Text_t* status) {
switch(fActive) {
case 0: fKey.OpenFile(fname,status);
case 1: fRaw.OpenFile(fname,status);
}
gHades->getSetup()->activateParIo(this);
return kTRUE;
}
void HParHadAsciiFileIo::close() {
fKey.CloseFile();
fRaw.CloseFile();
if (detParIoList) detParIoList->Delete();
}
void HParHadAsciiFileIo::print() {
if (check()) {
printf("Ascii I/O is opened\n");
detParIoList->ls();
}
else printf("No pointer to file\n");
detParIoList->ls();
}
void HParHadAsciiFileIo::openfilelist(const Char_t* filename) {
(fActive) ? fRaw.OpenFileList(filename) : fKey.OpenFileList(filename);
gHades->getSetup()->activateParIo(this);
}
Last change: Sat May 22 13:06:23 2010
Last generated: 2010-05-22 13:06
This page has been automatically generated. If you have any comments or suggestions about the page layout send a mail to ROOT support, or contact the developers with any questions or problems regarding ROOT.