Main Page | Modules | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members | Related Pages

Nav.cxx

Go to the documentation of this file.
00001 
00002 // $Id: Nav.cxx,v 1.6 2009/02/28 21:46:14 gmieg Exp $
00003 //
00004 // Nav
00005 //
00006 // Begin_Html<img src="../../pedestrians.gif" align=center>
00007 // <a href="../source_warning.html">Warning for beginners</a>.<br>
00008 // Also see <a href="../../root_crib/index.html">The ROOT Crib</a> and
00009 // <a href="../index.html">The MINOS Class User Guide</a>End_Html
00010 //
00011 // N. West 10/99
00012 //
00013 // Purpose: Nav consists entirely of static data and member functions
00014 //          used for package debugging.
00015 // 
00016 // General Remarks about Nav
00017 // =========================
00018 // 
00019 // The Nav package is based on the premise that navigation between
00020 // collections is generic so should be handled by generic code.  That
00021 // code is the Nav package.  It consists of a small set of classes, one
00022 // for each generic component in the physical data navigational model.
00023 // 
00024 // Current Implementation
00025 // ======================
00026 //
00027 //  To be supplied.
00028 //
00029 // 
00031 
00032 #include "MessageService/MsgService.h"
00033 #include "Navigation/Nav.h"
00034 
00035 #include <cctype>
00036 #include <cstring>
00037 
00038 //   Definition of static data members
00039 //   *********************************
00040 
00041 CVSID("$Id: Nav.cxx,v 1.6 2009/02/28 21:46:14 gmieg Exp $");
00042 
00043 // File level static data (private)
00044 static UInt_t fgDebugFlgs = 0; // Debug output flags
00045 
00046 // Dummy class for use by Nav::GetName() in the discovery of the 
00047 // encoding regime now that Nav itself isn't a class but a namespace
00048 //    123456789012345678901
00049 class NavEncodingRegimeTest { };
00050 
00051 // Definition of member functions (alphabetical order)
00052 // ***************************************************
00053 
00054 UInt_t Nav::GetDebugFlags() { return fgDebugFlgs; }
00055 
00056 // ********************************************************************
00057 
00058 std::string Nav::GetName(const char* classTypeInfoName,
00059                          const char* templateName) {
00060 
00061 //  Utility to convert name returned by typeid().name() into 
00062 //  class name and thence, if required, the iterator class name.
00063 //  
00064 //  Arguments: 
00065 //    classTypeInfoName   in   typeid().name() for class Xxx
00066 //    templateName        in   Template name = Ttt
00067 //
00068 //  Return:    
00069 //      class name    i.e.  Xxx        (if templateName = 0)
00070 //      iterator name i.e.  Ttt<Xxx>   (     otherwise     )
00071 //  
00072 
00073   static int encodingRegime = 0;
00074 
00075   // If the encoding regime isn't known, try to deduce it.
00076   if ( ! encodingRegime ) {
00077     const char* testName = typeid(NavEncodingRegimeTest).name();
00078     if ( strcmp(testName,"21NavEncodingRegimeTest") == 0 ) encodingRegime = 1;
00079     else { 
00080       MSG("Nav",Msg::kError) 
00081         << "Cannot deduce the type_info name encoding for: " 
00082         << testName << endl;
00083       encodingRegime = -1;
00084     }
00085   }
00086 
00087   if ( encodingRegime == 1 ) 
00088     while ( isdigit(*classTypeInfoName) ) ++classTypeInfoName;
00089 
00090   std::string name = classTypeInfoName;
00091   if ( templateName ) {
00092     std::string name2(templateName);
00093     name2 += "<" + name + ">";
00094     name = name2;
00095   }
00096   
00097   return name;
00098 
00099 }
00100 
00101 // ********************************************************************
00102 
00103 void Nav::SetDebugFlags(const UInt_t dbgflgs) { fgDebugFlgs = dbgflgs; }
00104 
00105 // ********************************************************************
00106 
00107 void Nav::SetLogLevel(int level) {
00108   MsgService::Instance()->GetStream("Nav")->SetLogLevel(level);
00109 }
00110 
00111 // ********************************************************************

Generated on Mon Feb 15 11:07:02 2010 for loon by  doxygen 1.3.9.1