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 884 of file mlogger.cxx.

Constructor & Destructor Documentation

◆ WriterCRC32Zlib()

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

Definition at line 887 of file mlogger.cxx.

888 {
889 if (fTrace)
890 printf("WriterCRC32Zlib: path [%s], level %d\n", log_chn->path.c_str(), level);
891
892 assert(wr != NULL);
893
894 fLevel = level;
895 fWr = wr;
896 fCrc32 = 0;
897 }
WriterInterface * fWr
Definition mlogger.cxx:992
std::string path
Definition mlogger.cxx:250

◆ ~WriterCRC32Zlib()

WriterCRC32Zlib::~WriterCRC32Zlib ( )
inline

Definition at line 899 of file mlogger.cxx.

900 {
901 if (fTrace)
902 printf("WriterCRC32Zlib: destructor\n");
903 DELETE(fWr);
904 }
#define DELETE(ptr)
Definition mlogger.cxx:342

Member Function Documentation

◆ wr_close()

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

Implements WriterInterface.

Definition at line 948 of file mlogger.cxx.

949 {
950 std::string x = xpathname(log_chn->path.c_str(), fLevel);
951 std::string f = x + ".crc32zlib";
952
953 if (fTrace)
954 printf("WriterCRC32Zlib: close path [%s], level %d, file [%s]\n", log_chn->path.c_str(), fLevel, f.c_str());
955
956 log_chn->handle = 0;
957
958 cm_msg(MLOG, "CRC32Zlib", "File \'%s\' CRC32-zlib checksum: 0x%08lx, %.0f bytes", x.c_str(), (unsigned long)fCrc32, fBytesIn);
959
960 FILE *fp = fopen_wx(f.c_str());
961 if (!fp) {
962 cm_msg(MERROR, "WriterCRC32Zlib::wr_close", "Cannot write CRC32Zlib to file \'%s\', fopen() errno %d (%s)", f.c_str(), errno, strerror(errno));
963 } else {
964 fprintf(fp, "%08lx %.0f %s\n", (unsigned long)fCrc32, fBytesIn, x.c_str());
965 fclose(fp);
966 }
967
968 /* close downstream writer */
969
970 int status = fWr->wr_close(log_chn, run_number);
971
972 fBytesIn += 0;
974
975 if (status != SUCCESS) {
976 return status;
977 }
978
979 return SUCCESS;
980 }
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:931
INT run_number[2]
Definition mana.cxx:246
static FILE * fopen_wx(const char *filename)
Definition mlogger.cxx:360
static std::string xpathname(const char *xpath, int level)
Definition mlogger.cxx:346
static FILE * fp
DWORD status
Definition odbhist.cxx:39
INT handle
Definition mlogger.cxx:249
Here is the call graph for this function:

◆ wr_get_chain()

std::string WriterCRC32Zlib::wr_get_chain ( )
inlinevirtual

Implements WriterInterface.

Definition at line 986 of file mlogger.cxx.

986 {
987 return "CRC32ZLIB | " + fWr->wr_get_chain();
988 }
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 982 of file mlogger.cxx.

982 {
983 return fWr->wr_get_file_ext();
984 }
virtual std::string wr_get_file_ext()
Definition mlogger.cxx:388
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 906 of file mlogger.cxx.

907 {
908 int status;
909
910 if (fTrace)
911 printf("WriterCRC32Zlib: open path [%s], level %d\n", log_chn->path.c_str(), fLevel);
912
913 status = fWr->wr_open(log_chn, run_number);
914
915 fBytesIn += 0;
917
918 if (status != SUCCESS) {
919 return status;
920 }
921
922 log_chn->handle = 9999;
923
924 fCrc32 = crc32(0, Z_NULL, 0);
925
926 return SUCCESS;
927 }
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 929 of file mlogger.cxx.

930 {
931 if (fTrace)
932 printf("WriterCRC32Zlib: write path [%s], size %d\n", log_chn->path.c_str(), size);
933
934 fCrc32 = crc32(fCrc32, (const Bytef*)data, size);
935
936 int status = fWr->wr_write(log_chn, data, size);
937
938 fBytesIn += size;
940
941 if (status != SUCCESS) {
942 return status;
943 }
944
945 return SUCCESS;
946 }
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 993 of file mlogger.cxx.

◆ fLevel

int WriterCRC32Zlib::fLevel
private

Definition at line 991 of file mlogger.cxx.

◆ fWr

WriterInterface* WriterCRC32Zlib::fWr
private

Definition at line 992 of file mlogger.cxx.


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