Main Page   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Namespace Members   Compound Members   File Members  

trz.hpp

Go to the documentation of this file.
00001 
00002 //
00003 // Fichero            : trz.hpp
00004 // Autor              : Cesar Ortiz
00005 // Fecha creacion     : 
00006 // 
00007 // Descripcion        : Encapsula el inico del mecanismo de trazas y
00008 //                      permite acceder a una serie de atributos.
00009 //
00010 // 
00011 // Notas
00012 //    -
00013 //
00015 #ifndef _TRZ_H_
00016 #define _TRZ_H_
00017 
00018 #include "jic/exc/excepcion.hpp"
00019 #include <string>
00020 
00021 EXCEPCION(ExcTrazasNoIniciadas);
00022 
00023 namespace UTIL{
00024 class TRZ {
00025 public:
00026    enum EstadoTrazas {
00027       NO_INICIALIZADO,
00028       INICIALIZANDO,  
00029       ERROR_INICIALIZACION,
00030       USANDO_ENV,
00031       USANDO_CWD,  
00032       USANDO_TMP
00033    };
00034    
00035    static void inicio(int nivelTrazas);
00036    inline static const char* dirTrazas(); // throw(ExcTrazasNoIniciadas)
00037    inline static EstadoTrazas estadoTrazas(); // throw(ExcTrazasNoIniciadas)
00038    inline static bool trazasOk(); // throw(ExcTrazasNoIniciadas)
00039 
00040 private:
00041 
00042    inline static void valida(); // throw(ExcTrazasNoIniciadas)
00043 
00044    static bool inicializaTrazas(int nivelTrazas);
00045 
00046    static std::string _dirTrazas;
00047    static EstadoTrazas _estadoTrazas;                                                                        
00048    
00049 }; // TRZ
00050 
00052 
00053 void
00054 TRZ::valida() // throw(ExcTrazasNoIniciadas)
00055 {
00056    if ( _estadoTrazas == NO_INICIALIZADO) 
00057    {
00058       THROW(ExcTrazasNoIniciadas,"");
00059    }
00060 }
00061 
00062 //-----------------------------------------------------------------------------
00063 
00064 const char* 
00065 TRZ::dirTrazas() // throw(ExcTrazasNoIniciadas)
00066 { 
00067    valida();
00068    return _dirTrazas.empty() ? "":_dirTrazas.c_str(); 
00069 }
00070 
00071 //-----------------------------------------------------------------------------
00072 
00073 TRZ::EstadoTrazas 
00074 TRZ::estadoTrazas() // throw(ExcTrazasNoIniciadas)
00075 { 
00076    valida();
00077    return _estadoTrazas; 
00078 }
00079 
00080 //-----------------------------------------------------------------------------
00081 
00082 bool 
00083 TRZ::trazasOk() // throw(ExcTrazasNoIniciadas)
00084 { 
00085    valida();
00086    return _estadoTrazas != ERROR_INICIALIZACION &&
00087           _estadoTrazas != NO_INICIALIZADO; 
00088 }
00089 
00091 
00092 } // UTIL
00093 
00094 #endif
00095 

Generated on Wed Mar 5 21:31:47 2003 for JIC by doxygen1.3-rc3