MIDAS
Loading...
Searching...
No Matches
WriterCRC32Zlib Class Reference
Inheritance diagram for WriterCRC32Zlib:
Collaboration diagram for WriterCRC32Zlib:

Public Member Functions

 WriterCRC32Zlib (LOG_CHN *log_chn, int level, WriterInterface *wr)
 
 ~WriterCRC32Zlib ()
 
int wr_open (LOG_CHN *log_chn, int run_number)
 
int wr_write (LOG_CHN *log_chn, const void *data, const int size)
 
int wr_close (LOG_CHN *log_chn, int run_number)
 
std::string wr_get_file_ext ()
 
std::string wr_get_chain ()
 
- Public Member Functions inherited from WriterInterface
 WriterInterface ()
 
virtual ~WriterInterface ()
 

Private Attributes

int fLevel
 
WriterInterfacefWr
 
uLong fCrc32
 

Additional Inherited Members

- Public Attributes inherited from WriterInterface
bool fTrace
 
double fBytesIn
 
double fBytesOut
 

Detailed Description

Definition at line 910 of file mlogger.cxx.

Constructor & Destructor Documentation

◆ WriterCRC32Zlib()

WriterCRC32Zlib::WriterCRC32Zlib ( LOG_CHN log_chn,
int  level,
WriterInterface wr 
)
inline

Definition at line 913 of file mlogger.cxx.

914 {
915 if (fTrace)
916 printf("WriterCRC32Zlib: path [%s], level %d\n", log_chn->path.c_str(), level);
917
918 assert(wr != NULL);
919
920 fLevel = level;
921 fWr = wr;
922 fCrc32 = 0;
923 }
WriterInterface * fWr
Definition mlogger.cxx:1018
TH1X EXPRT * h1_book(const char *name, const char *title, int bins, double min, double max)
Definition rmidas.h:24
Here is the call graph for this function:

◆ ~WriterCRC32Zlib()

WriterCRC32Zlib::~WriterCRC32Zlib ( )
inline

Definition at line 925 of file mlogger.cxx.

926 {
927 if (fTrace)
928 printf("WriterCRC32Zlib: destructor\n");
929 DELETE(fWr);
930 }
#define DELETE(ptr)
Definition mlogger.cxx:368
Here is the call graph for this function:

Member Function Documentation

◆ wr_close()

int WriterCRC32Zlib::wr_close ( LOG_CHN log_chn,
int  run_number 
)
inlinevirtual

Implements WriterInterface.

Definition at line 974 of file mlogger.cxx.

975 {
976 std::string x = xpathname(log_chn->path.c_str(), fLevel);
977 std::string f = x + ".crc32zlib";
978
979 if (fTrace)
980 printf("WriterCRC32Zlib: close path [%s], level %d, file [%s]\n", log_chn->path.c_str(), fLevel, f.c_str());
981
982 log_chn->handle = 0;
983
984 cm_msg(MLOG, "CRC32Zlib", "File \'%s\' CRC32-zlib checksum: 0x%08lx, %.0f bytes", x.c_str(), (unsigned long)fCrc32, fBytesIn);
985
986 FILE *fp = fopen_wx(f.c_str());
987 if (!fp) {
988 cm_msg(MERROR, "WriterCRC32Zlib::wr_close", "Cannot write CRC32Zlib to file \'%s\', fopen() errno %d (%s)", f.c_str(), errno, strerror(errno));
989 } else {
990 fprintf(fp, "%08lx %.0f %s\n", (unsigned long)fCrc32, fBytesIn, x.c_str());
991 fclose(fp);
992 }
993
994 /* close downstream writer */
995
997
998 fBytesIn += 0;
1000
1001 if (status != SUCCESS) {
1002 return status;
1003 }
1004
1005 return SUCCESS;
1006 }
virtual int wr_close(LOG_CHN *log_chn, int run_number)=0
#define SUCCESS
Definition mcstd.h:54
#define MLOG
Definition midas.h:563
#define MERROR
Definition midas.h:559
INT cm_msg(INT message_type, const char *filename, INT line, const char *routine, const char *format,...)
Definition midas.cxx:915
INT run_number[2]
Definition mana.cxx:246
static FILE * fopen_wx(const char *filename)
Definition mlogger.cxx:386
static std::string xpathname(const char *xpath, int level)
Definition mlogger.cxx:372
static FILE * fp
DWORD status
Definition odbhist.cxx:39
Here is the call graph for this function:

◆ wr_get_chain()

std::string WriterCRC32Zlib::wr_get_chain ( )
inlinevirtual

Implements WriterInterface.

Definition at line 1012 of file mlogger.cxx.

1012 {
1013 return "CRC32ZLIB | " + fWr->wr_get_chain();
1014 }
virtual std::string wr_get_chain()=0
Here is the call graph for this function:

◆ wr_get_file_ext()

std::string WriterCRC32Zlib::wr_get_file_ext ( )
inlinevirtual

Reimplemented from WriterInterface.

Definition at line 1008 of file mlogger.cxx.

1008 {
1009 return fWr->wr_get_file_ext();
1010 }
virtual std::string wr_get_file_ext()
Definition mlogger.cxx:414
Here is the call graph for this function:

◆ wr_open()

int WriterCRC32Zlib::wr_open ( LOG_CHN log_chn,
int  run_number 
)
inlinevirtual

Implements WriterInterface.

Definition at line 932 of file mlogger.cxx.

933 {
934 int status;
935
936 if (fTrace)
937 printf("WriterCRC32Zlib: open path [%s], level %d\n", log_chn->path.c_str(), fLevel);
938
940
941 fBytesIn += 0;
943
944 if (status != SUCCESS) {
945 return status;
946 }
947
948 log_chn->handle = 9999;
949
950 fCrc32 = crc32(0, Z_NULL, 0);
951
952 return SUCCESS;
953 }
virtual int wr_open(LOG_CHN *log_chn, int run_number)=0
Here is the call graph for this function:

◆ wr_write()

int WriterCRC32Zlib::wr_write ( LOG_CHN log_chn,
const void data,
const int  size 
)
inlinevirtual

Implements WriterInterface.

Definition at line 955 of file mlogger.cxx.

956 {
957 if (fTrace)
958 printf("WriterCRC32Zlib: write path [%s], size %d\n", log_chn->path.c_str(), size);
959
960 fCrc32 = crc32(fCrc32, (const Bytef*)data, size);
961
962 int status = fWr->wr_write(log_chn, data, size);
963
964 fBytesIn += size;
966
967 if (status != SUCCESS) {
968 return status;
969 }
970
971 return SUCCESS;
972 }
virtual int wr_write(LOG_CHN *log_chn, const void *data, const int size)=0
void * data
Definition mana.cxx:268
Here is the call graph for this function:

Member Data Documentation

◆ fCrc32

uLong WriterCRC32Zlib::fCrc32
private

Definition at line 1019 of file mlogger.cxx.

◆ fLevel

int WriterCRC32Zlib::fLevel
private

Definition at line 1017 of file mlogger.cxx.

◆ fWr

WriterInterface* WriterCRC32Zlib::fWr
private

Definition at line 1018 of file mlogger.cxx.


The documentation for this class was generated from the following file: