Back to home page

sPhenix code displayed by LXR

 
 

    


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

0001 #ifndef __FILTER_MSG_BUFFER_H__
0002 #define __FILTER_MSG_BUFFER_H__
0003 
0004 
0005 
0006 #include "msg_buffer.h"
0007 
0008 #define ON 1
0009 #define OFF 0
0010 
0011 /** This is the "filter" msg\_buffer class which allows you to filter
0012 messages based on their profile. Its default behavior is to let all messages pass. 
0013 You can use the member functions to tailor the kind of messages filtered and passed on.
0014 
0015 */
0016 
0017 class filter_msg_buffer : public   msg_buffer {
0018 
0019 #ifndef __CINT__
0020 protected:
0021   STREAMBUF * original_streambuf;
0022   int ***state;
0023   int msg_type_max;
0024   int msg_source_max;
0025   int msg_sev_max;
0026 #endif
0027 
0028 
0029   //  int state[MSG_TYPE_MAX][MSG_SOURCE_MAX][MSG_SEV_MAX];
0030 
0031 public:
0032 
0033   /** The msglen parameter specifies the initial length of the 
0034       message string which is kept internally. If you exceed the length, 
0035       it is automautically extended.
0036   */
0037   filter_msg_buffer (const int msglen=256);
0038 
0039   /** This constructor defines a custom-sized matrix of 
0040       type/source/severities.  */
0041   filter_msg_buffer (const int type_max, const int source_max, 
0042              const int sev_max, const int msglen=256);
0043 
0044   /// the virtual destructor
0045   virtual ~filter_msg_buffer();
0046 
0047   /// the sync function overrides the streambuf's sync function
0048 
0049   // mlp -- the pubsync is what's needed for the new
0050   // iostream libraries - sync will no longer be a public method. 
0051   // for now we leave it as it was.
0052 
0053 
0054   virtual int sync ();
0055 
0056 
0057   /** the set function defines (ON or OFF) which messages are passed and
0058       which ones are filtered. This gives very fine-grained control. There 
0059       are other functions which give you more global control.
0060   */
0061 
0062 
0063   virtual int set (const int msg_type, 
0064       const int msg_source,
0065       const int msg_severity,
0066       const int value = OFF);
0067 
0068   /// Globally set all messages below a certain severity threshold to ON or OFF 
0069   virtual int set_severity_below_threshold (const int threshold, 
0070                         const int value =OFF); 
0071 
0072   /// Globally switch ON or OFF all messages of a certain type
0073   virtual int set_type (const int type, 
0074             const int value =OFF); 
0075 
0076   /// Globally switch ON or OFF all messages from a certain source
0077   virtual int set_source (const int source, 
0078             const int value =OFF); 
0079 
0080   /// Globally switch all messages off
0081   virtual int all_off();
0082 
0083   /// Globally switch all messages on
0084   virtual int all_on();
0085 
0086 };
0087 
0088 
0089 #endif /* __FILTER_MSG_BUFFER_H__ */