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

Public Member Functions

 WriterCRC32C (LOG_CHN *log_chn, int level, WriterInterface *wr)
 
 ~WriterCRC32C ()
 
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
 
uint32_t fCrc32
 

Additional Inherited Members

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

Detailed Description

Definition at line 1000 of file mlogger.cxx.

Constructor & Destructor Documentation

◆ WriterCRC32C()

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

Definition at line 1003 of file mlogger.cxx.

1004 {
1005 if (fTrace)
1006 printf("WriterCRC32C: path [%s], level %d\n", log_chn->path.c_str(), level);
1007
1008 assert(wr != NULL);
1009
1010 fLevel = level;
1011 fWr = wr;
1012 fCrc32 = 0;
1013 }
uint32_t fCrc32
Definition mlogger.cxx:1109
WriterInterface * fWr
Definition mlogger.cxx:1108
std::string path
Definition mlogger.cxx:250

◆ ~WriterCRC32C()

WriterCRC32C::~WriterCRC32C ( )
inline

Definition at line 1015 of file mlogger.cxx.

1016 {
1017 if (fTrace)
1018 printf("WriterCRC32C: destructor\n");
1019 DELETE(fWr);
1020 }
#define DELETE(ptr)
Definition mlogger.cxx:342

Member Function Documentation

◆ wr_close()

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

Implements WriterInterface.

Definition at line 1064 of file mlogger.cxx.

1065 {
1066 std::string x = xpathname(log_chn->path.c_str(), fLevel);
1067 std::string f = x + ".crc32c";
1068
1069 if (fTrace)
1070 printf("WriterCRC32C: close path [%s], level %d, file [%s]\n", log_chn->path.c_str(), fLevel, f.c_str());
1071
1072 log_chn->handle = 0;
1073
1074 cm_msg(MLOG, "CRC32C", "File \'%s\' CRC32C checksum: 0x%08lx, %.0f bytes", x.c_str(), (unsigned long)fCrc32, fBytesIn);
1075
1076 FILE *fp = fopen_wx(f.c_str());
1077 if (!fp) {
1078 cm_msg(MERROR, "WriterCRC32C::wr_close", "Cannot write CRC32C to file \'%s\', fopen() errno %d (%s)", f.c_str(), errno, strerror(errno));
1079 } else {
1080 fprintf(fp, "%08lx %.0f %s\n", (unsigned long)fCrc32, fBytesIn, x.c_str());
1081 fclose(fp);
1082 }
1083
1084 /* close downstream writer */
1085
1086 int status = fWr->wr_close(log_chn, run_number);
1087
1088 fBytesIn += 0;
1090
1091 if (status != SUCCESS) {
1092 return status;
1093 }
1094
1095 return SUCCESS;
1096 }
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 WriterCRC32C::wr_get_chain ( )
inlinevirtual

Implements WriterInterface.

Definition at line 1102 of file mlogger.cxx.

1102 {
1103 return "CRC32C | " + fWr->wr_get_chain();
1104 }
virtual std::string wr_get_chain()=0
Here is the call graph for this function:

◆ wr_get_file_ext()

std::string WriterCRC32C::wr_get_file_ext ( )
inlinevirtual

Reimplemented from WriterInterface.

Definition at line 1098 of file mlogger.cxx.

1098 {
1099 return fWr->wr_get_file_ext();
1100 }
virtual std::string wr_get_file_ext()
Definition mlogger.cxx:388
Here is the call graph for this function:

◆ wr_open()

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

Implements WriterInterface.

Definition at line 1022 of file mlogger.cxx.

1023 {
1024 int status;
1025
1026 if (fTrace)
1027 printf("WriterCRC32C: open path [%s], level %d\n", log_chn->path.c_str(), fLevel);
1028
1029 status = fWr->wr_open(log_chn, run_number);
1030
1031 fBytesIn += 0;
1033
1034 if (status != SUCCESS) {
1035 return status;
1036 }
1037
1038 log_chn->handle = 9999;
1039
1040 fCrc32 = 0;
1041
1042 return SUCCESS;
1043 }
virtual int wr_open(LOG_CHN *log_chn, int run_number)=0
Here is the call graph for this function:

◆ wr_write()

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

Implements WriterInterface.

Definition at line 1045 of file mlogger.cxx.

1046 {
1047 if (fTrace)
1048 printf("WriterCRC32C: write path [%s], size %d\n", log_chn->path.c_str(), size);
1049
1050 fCrc32 = crc32c(fCrc32, data, size);
1051
1052 int status = fWr->wr_write(log_chn, data, size);
1053
1054 fBytesIn += size;
1056
1057 if (status != SUCCESS) {
1058 return status;
1059 }
1060
1061 return SUCCESS;
1062 }
virtual int wr_write(LOG_CHN *log_chn, const void *data, const int size)=0
uint32_t crc32c(uint32_t crc, const void *buf, size_t len)
Definition crc32c.cxx:391
void * data
Definition mana.cxx:268
Here is the call graph for this function:

Member Data Documentation

◆ fCrc32

uint32_t WriterCRC32C::fCrc32
private

Definition at line 1109 of file mlogger.cxx.

◆ fLevel

int WriterCRC32C::fLevel
private

Definition at line 1107 of file mlogger.cxx.

◆ fWr

WriterInterface* WriterCRC32C::fWr
private

Definition at line 1108 of file mlogger.cxx.


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