Back to home page

sPhenix code displayed by LXR

 
 

    


File indexing completed on 2025-08-03 08:20:46

0001 
0002 #ifndef __MSG_BUFFER_H__
0003 #define __MSG_BUFFER_H__
0004 
0005 
0006 #include "event_io.h"
0007 
0008 #ifdef __CINT__
0009 #include <iostream>
0010 #endif
0011 
0012 
0013 #ifndef __CINT__
0014 
0015 #include <cstdio>
0016 #include <cstdarg>
0017 #include <string>
0018 #include <ctime>
0019 #include <time.h>
0020 
0021 #endif
0022 
0023 
0024 #include "msg_control.h"
0025 
0026 // if we find that our buffer is too small, we extend it
0027 // by this amount.
0028 #define MSG_EXTENSION_AMOUNT 32
0029 
0030 
0031 typedef struct msgProfile {
0032   int type;
0033   int source;
0034   int severity;
0035   int reserved1;
0036   int reserved2;
0037   int reserved3;
0038   char sourcecomponent[256];
0039 } msgProfile;
0040 
0041 
0042 
0043 //class msg_control;
0044 
0045 
0046 /** 
0047 This is the base class for the type of message buffers which we want to 
0048 use for messaging. It can easily be subclassed. 
0049 
0050 
0051 This base class defines the "static" behavior of all the msg\_buffer
0052 classes derived from it. It provides the parsing routine which decodes
0053 the profile tags, provides a "add\_date" routine to conveniently
0054 prepend a date tag to each message if so desired, and deals with the
0055 msg\_control objects in the system which it is a friend of. If created, 
0056 the msg\_buffer object tells all msg\_control object to go active and produce
0057 the profiling information; otherwise they maintain silence. 
0058 
0059 This class is meant to be subclassed, and the dispatch mechanism which
0060 you want has to be provided by the subclass.
0061 
0062 */
0063 
0064 #ifdef __CINT__
0065 class msg_buffer : public streambuf {
0066 #else
0067 class msg_buffer : public STREAMBUF {
0068 #endif
0069 
0070 protected:
0071   char *oBuffer;
0072   int pos;
0073   int maximum_position;
0074   msg_control *m;
0075 
0076   virtual char * format(int * length, msgProfile *mp);
0077 
0078   
0079 
0080   public:
0081     msg_buffer (const int msglen=256);
0082     virtual ~msg_buffer();
0083 
0084     virtual int overflow (int ch);
0085     virtual int sync ();
0086 };
0087 
0088 #ifndef __CINT__
0089 void streambuf_add_date (STREAMBUF * sb);
0090 #endif
0091 
0092 
0093 #endif /* __MSG_BUFFER_H__ */