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

Constructor & Destructor Documentation

◆ WriterCRC32C()

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

Definition at line 1029 of file mlogger.cxx.

1030 {
1031 if (fTrace)
1032 printf("WriterCRC32C: path [%s], level %d\n", log_chn->path.c_str(), level);
1033
1034 assert(wr != NULL);
1035
1036 fLevel = level;
1037 fWr = wr;
1038 fCrc32 = 0;
1039 }
uint32_t fCrc32
Definition mlogger.cxx:1135
WriterInterface * fWr
Definition mlogger.cxx:1134
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:

◆ ~WriterCRC32C()

WriterCRC32C::~WriterCRC32C ( )
inline

Definition at line 1041 of file mlogger.cxx.

1042 {
1043 if (fTrace)
1044 printf("WriterCRC32C: destructor\n");
1045 DELETE(fWr);
1046 }
#define DELETE(ptr)
Definition mlogger.cxx:368
Here is the call graph for this function:

Member Function Documentation

◆ wr_close()

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

Implements WriterInterface.

Definition at line 1090 of file mlogger.cxx.

1091 {
1092 std::string x = xpathname(log_chn->path.c_str(), fLevel);
1093 std::string f = x + ".crc32c";
1094
1095 if (fTrace)
1096 printf("WriterCRC32C: close path [%s], level %d, file [%s]\n", log_chn->path.c_str(), fLevel, f.c_str());
1097
1098 log_chn->handle = 0;
1099
1100 cm_msg(MLOG, "CRC32C", "File \'%s\' CRC32C checksum: 0x%08lx, %.0f bytes", x.c_str(), (unsigned long)fCrc32, fBytesIn);
1101
1102 FILE *fp = fopen_wx(f.c_str());
1103 if (!fp) {
1104 cm_msg(MERROR, "WriterCRC32C::wr_close", "Cannot write CRC32C to file \'%s\', fopen() errno %d (%s)", f.c_str(), errno, strerror(errno));
1105 } else {
1106 fprintf(fp, "%08lx %.0f %s\n", (unsigned long)fCrc32, fBytesIn, x.c_str());
1107 fclose(fp);
1108 }
1109
1110 /* close downstream writer */
1111
1113
1114 fBytesIn += 0;
1116
1117 if (status != SUCCESS) {
1118 return status;
1119 }
1120
1121 return SUCCESS;
1122 }
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 WriterCRC32C::wr_get_chain ( )
inlinevirtual

Implements WriterInterface.

Definition at line 1128 of file mlogger.cxx.

1128 {
1129 return "CRC32C | " + fWr->wr_get_chain();
1130 }
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 1124 of file mlogger.cxx.

1124 {
1125 return fWr->wr_get_file_ext();
1126 }
virtual std::string wr_get_file_ext()
Definition mlogger.cxx:414
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 1048 of file mlogger.cxx.

1049 {
1050 int status;
1051
1052 if (fTrace)
1053 printf("WriterCRC32C: open path [%s], level %d\n", log_chn->path.c_str(), fLevel);
1054
1056
1057 fBytesIn += 0;
1059
1060 if (status != SUCCESS) {
1061 return status;
1062 }
1063
1064 log_chn->handle = 9999;
1065
1066 fCrc32 = 0;
1067
1068 return SUCCESS;
1069 }
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 1071 of file mlogger.cxx.

1072 {
1073 if (fTrace)
1074 printf("WriterCRC32C: write path [%s], size %d\n", log_chn->path.c_str(), size);
1075
1076 fCrc32 = crc32c(fCrc32, data, size);
1077
1078 int status = fWr->wr_write(log_chn, data, size);
1079
1080 fBytesIn += size;
1082
1083 if (status != SUCCESS) {
1084 return status;
1085 }
1086
1087 return SUCCESS;
1088 }
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 1135 of file mlogger.cxx.

◆ fLevel

int WriterCRC32C::fLevel
private

Definition at line 1133 of file mlogger.cxx.

◆ fWr

WriterInterface* WriterCRC32C::fWr
private

Definition at line 1134 of file mlogger.cxx.


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