00001 /*****************************************************************************/ 00002 /* */ 00003 /* XrdMonException.hh */ 00004 /* */ 00005 /* (c) 2005 by the Board of Trustees of the Leland Stanford, Jr., University */ 00006 /* All Rights Reserved */ 00007 /* Produced by Jacek Becla for Stanford University under contract */ 00008 /* DE-AC02-76SF00515 with the Department of Energy */ 00009 /*****************************************************************************/ 00010 00011 // $Id: XrdMonException.hh 22437 2008-03-04 14:35:16Z rdm $ 00012 00013 #ifndef XRDMONEXCEPTION_HH 00014 #define XRDMONEXCEPTION_HH 00015 00016 #include "XrdMon/XrdMonTypes.hh" 00017 #include <map> 00018 #include <string> 00019 #include <vector> 00020 00021 using std::map; 00022 using std::string; 00023 using std::vector; 00024 00025 00026 typedef int err_t; 00027 00028 class XrdMonException { 00029 public: 00030 XrdMonException(err_t err); 00031 XrdMonException(err_t err, 00032 const string& s); 00033 XrdMonException(err_t err, 00034 const char* s); 00035 00036 err_t err() const { return _err; } 00037 const string msg() const { return _msg; } 00038 void printIt() const; 00039 void printItOnce() const; 00040 00041 private: 00042 struct ErrInfo { 00043 vector<string> msgs; 00044 int count; 00045 }; 00046 00047 static map<err_t, ErrInfo> _oneTime; 00048 00049 err_t _err; 00050 string _msg; 00051 00052 }; 00053 00054 #endif /* XRDMONEXCEPTION_HH */