home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / tlx501.zip / DEBUG / MODINFO.H < prev    next >
C/C++ Source or Header  |  1996-01-05  |  4KB  |  134 lines

  1. /****************************************************************************
  2.     $Id: modinfo.h 501.0 1995/03/07 12:26:50 RON Exp $
  3.  
  4.     Copyright (c) 1991-95 Tarma Software Research. All rights reserved.
  5.  
  6.     Project:    Tarma Library for C++ V5.0
  7.     Author:    Ron van der Wal
  8.  
  9.     Declarations for class TLModuleInfo, a repository for module information.
  10.     The file also contains some macros for conditional inclusion of the
  11.     information; the includion is subject to the definition of the
  12.     preprocessor name NMODINFO.
  13.  
  14.     TLX_IDENT(ver);
  15.  
  16.     - Inserts a module information instance with the given string as its
  17.       version information; filename and date/time are automatically added.
  18.  
  19.     TLX_MODULE_INFO(ver);
  20.  
  21.     - Inserts a module information instance with the given string as its
  22.       version information; filename and date/time are automatically added.
  23.  
  24.     TLX_MODULE
  25.  
  26.     - Resolves to the module information instance for the current module.
  27.  
  28.     $Log: modinfo.h $
  29.     Revision 501.0  1995/03/07 12:26:50  RON
  30.     Updated for TLX 5.01
  31.     Revision 1.2  1995/01/31 16:29:00  RON
  32.     Update for release 012
  33.     Added partial support for SunPro C++ compiler
  34.     Revision 1.1  1995/01/05  15:35:56  ron
  35.     Initial revision
  36.  
  37.     Revision 1.1  1994/11/16  15:26:00  ron
  38.     Initial revision
  39.  
  40. ****************************************************************************/
  41.  
  42. #ifndef _TLX_MODINFO_H
  43. #define _TLX_MODINFO_H
  44.  
  45. #ifndef _TLX_TLX_H
  46. #include <tlx\501\tlx.h>
  47. #endif
  48.  
  49. #ifdef NMODINFO
  50. /*---------------------------------------------------------------------------
  51.     No module info - code vanishes
  52. ---------------------------------------------------------------------------*/
  53.  
  54. #define TLX_IDENT(ver)
  55. #define TLX_MODULE_INFO(ver)
  56. #define TLX_MODULE        TLModuleInfo::sNullInfo
  57.  
  58. #else
  59. /*---------------------------------------------------------------------------
  60.     Module info included
  61. ---------------------------------------------------------------------------*/
  62.  
  63. #define TLX_IDENT(ver)        static TLModuleInfo _gModInfo( \
  64.                 __FILE__, ver, __DATE__ " " __TIME__)
  65. #define TLX_MODULE_INFO(ver)    static TLModuleInfo _gModInfo( \
  66.                 __FILE__, ver, __DATE__ " " __TIME__)
  67. #define TLX_MODULE        _gModInfo
  68.  
  69. #endif    // NMODINFO
  70.  
  71. /*---------------------------------------------------------------------------
  72.     TLModuleInfo -
  73.  
  74.     Repository for module information: filename, version, compilation date
  75.     and time. All module info instances in a program are automatically
  76.     linked into a single chain.
  77. ---------------------------------------------------------------------------*/
  78.  
  79. class _TLXCLASS TLModuleInfo
  80. {
  81.     // All instances of TLModuleInfo are linked together in a single chain.
  82.  
  83.   #ifdef _TLXDBG
  84.     static int32    sModCount;    // Number of modules
  85.   #endif
  86.     static TLModuleInfo *sChain;    // Head of the chain
  87.     TLModuleInfo *    mNext;        // Link field
  88.  
  89.     // Information about the module is all text
  90.  
  91.     const char *    mFilename;    // File name of the module
  92.     const char *    mVersion;    // Version identification
  93.     const char *    mDateTime;    // Date/time of the module build
  94.  
  95. public:
  96.     // Constructor adds the instance to the global chain; destructor
  97.     // removes it.
  98.  
  99.     TLModuleInfo(const char *, const char *, const char *);
  100.     ~TLModuleInfo();
  101.  
  102.     // Access to individual pieces of information
  103.  
  104.     const char *    Filename() const;
  105.     const char *    Version() const;
  106.     const char *    DateTime() const;
  107.  
  108.     // Functions to report the information of a single module, and to
  109.     // report information about all modules.
  110.  
  111.     ostream &        PrintOn(ostream &) const;
  112.     static void        PrintAll(ostream &);
  113.  
  114.     // Single module information instance to stand in as null reference
  115.     static TLModuleInfo sNullInfo;
  116. };
  117.  
  118. /*---------------------------------------------------------------------------
  119.     Inline definitions
  120. ---------------------------------------------------------------------------*/
  121.  
  122. #ifndef _TLXDBG
  123. inline const char *TLModuleInfo::Filename() const
  124.     { return mFilename; }
  125.  
  126. inline const char *TLModuleInfo::Version() const
  127.     { return mVersion; }
  128.  
  129. inline const char *TLModuleInfo::DateTime() const
  130.     { return mDateTime; }
  131. #endif
  132.  
  133. #endif    // _TLX_MODINFO_H
  134.