probe.h

Go to the documentation of this file.
00001 /* *********
00002 *  
00003 *  This file is part of:
00004 *  NePSing, Network Protocol Simulator next generation
00005 *  
00006 *  Copyright (C) 2004  Tommaso Pecorella <tpecorella@mac.com>
00007 *  
00008 *  This library is free software; you can redistribute it and/or
00009 *  modify it under the terms of the GNU Lesser General Public
00010 *  License as published by the Free Software Foundation; either
00011 *  version 2.1 of the License, or (at your option) any later version.
00012 *  
00013 *  This library is distributed in the hope that it will be useful,
00014 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
00015 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00016 *  Lesser General Public License for more details.
00017 *  
00018 *  You should have received a copy of the GNU Lesser General Public
00019 *  License along with this library; if not, write to the Free Software
00020 *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
00021 *  
00022 ********* */
00023 
00024 #ifndef __PROBE_H__
00025 #define __PROBE_H__
00026 
00027 #include <string>
00028 #include <exception>
00029 
00064 
00075 // **************************************************************************
00076 //
00077 // WARNING: do NOT use this class directly.
00078 //
00079 // It's only purpose is to be a base class for all the "real" probes
00080 //
00081 // **************************************************************************
00082 
00083 using namespace std ;
00084 
00085 #define GLOBALPROBE true
00086 #define LOCALPROBE false
00087 
00088 class ProbeManager;
00089 
00091 //
00092 class ProbeException : public exception
00093 {
00094   string Msg;
00095  public:
00096   ProbeException(const string &aMsg)
00097     : Msg(aMsg)
00098   {};
00099   virtual ~ProbeException() throw(){};
00100 
00101   virtual const char* what() const throw()
00102   {
00103     return (string(exception::what()) + " " + Msg).c_str();
00104   };
00105 };
00106 
00108 class Probe
00109 {
00110  protected:
00111   static ProbeManager* theProbeManager;
00112   bool isGlobal;
00113 
00114  public:
00115 
00116   string theName;
00117   string theRealName;
00118   bool Append;
00119   
00120 
00122   Probe( string _theName, 
00123          bool _isGlobal = LOCALPROBE  
00124     );
00125   ~Probe();
00126 
00127   static void set_ProbeManager( ProbeManager* _theProbeManager);
00128 
00130   virtual void Reset( void );
00132   virtual void Zap( double ) {};
00133 
00135   virtual void Observe( double value ) = 0;
00137   virtual void WriteToFile( double time 
00138                             ) = 0;
00139 };
00140 
00142 
00143 #endif
00144 

Generated on Wed Dec 22 23:23:47 2004 for NePSing by doxygen 1.3.9.1 ---- Hosted by SourceForge.net Logo