Source code of Windows XP (NT5)
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

111 lines
2.5 KiB

  1. ///////////////////////////////////////////////////////////////////////////////
  2. //
  3. // Copyright (c) 1998, Microsoft Corp. All rights reserved.
  4. //
  5. // FILE
  6. //
  7. // logschema.h
  8. //
  9. // SYNOPSIS
  10. //
  11. // Declares the class LogSchema.
  12. //
  13. // MODIFICATION HISTORY
  14. //
  15. // 08/04/1998 Original version.
  16. // 12/02/1998 Added excludeFromLog.
  17. //
  18. ///////////////////////////////////////////////////////////////////////////////
  19. #ifndef _LOGSCHEMA_H_
  20. #define _LOGSCHEMA_H_
  21. #if _MSC_VER >= 1000
  22. #pragma once
  23. #endif
  24. #include <hashmap.h>
  25. #include <nocopy.h>
  26. ///////////////////////////////////////////////////////////////////////////////
  27. //
  28. // CLASS
  29. //
  30. // LogField
  31. //
  32. // DESCRIPTION
  33. //
  34. // Describes a field in the logfile.
  35. //
  36. ///////////////////////////////////////////////////////////////////////////////
  37. class LogField
  38. {
  39. public:
  40. LogField() throw ()
  41. { }
  42. LogField(DWORD id, DWORD order, BOOL shouldExclude) throw ()
  43. : iasID(id), ordinal(order), exclude(shouldExclude)
  44. { }
  45. bool operator<(const LogField& f) const throw ()
  46. { return ordinal < f.ordinal; }
  47. bool operator==(const LogField& f) const throw ()
  48. { return iasID == f.iasID; }
  49. DWORD hash() const throw ()
  50. { return iasID; }
  51. DWORD iasID;
  52. DWORD ordinal;
  53. BOOL exclude;
  54. };
  55. ///////////////////////////////////////////////////////////////////////////////
  56. //
  57. // CLASS
  58. //
  59. // LogSchema
  60. //
  61. // DESCRIPTION
  62. //
  63. // This class reads the logfile schema from the dictionary and creates
  64. // a vector of DWORDs containing the attributes to be logged in column
  65. // order.
  66. //
  67. ///////////////////////////////////////////////////////////////////////////////
  68. class LogSchema : NonCopyable
  69. {
  70. public:
  71. LogSchema() throw ();
  72. ~LogSchema() throw ();
  73. DWORD getNumFields() const throw ()
  74. { return numFields; }
  75. // Returns TRUE if the given attribute ID should be excluded from the log.
  76. BOOL excludeFromLog(DWORD iasID) const throw ();
  77. // Return the ordinal for a given attribute ID. An ordinal of zero
  78. // indicates that the attribute should not be logged.
  79. DWORD getOrdinal(DWORD iasID) const throw ();
  80. // Initialize the dictionary for use.
  81. HRESULT initialize() throw ();
  82. // Shutdown the dictionary after use.
  83. void shutdown() throw ();
  84. protected:
  85. // Clear the schema.
  86. void clear() throw ();
  87. typedef hash_table < LogField > SchemaTable;
  88. SchemaTable schema;
  89. DWORD numFields; // Number of fields in the ODBC schema.
  90. DWORD refCount; // Initialization ref. count.
  91. };
  92. #endif // _LOGSCHEMA_H_