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.

67 lines
1.9 KiB

  1. /////////////////////////////////////////////////////////////////////////////////////////////////////////////////
  2. // Microsoft WMIOLE DB Provider
  3. // (C) Copyright 1999 Microsoft Corporation. All Rights Reserved.
  4. //
  5. // BaseObj.h | CBaseObj Definitions
  6. //
  7. /////////////////////////////////////////////////////////////////////////////////////////////////////////////////
  8. #ifndef __BASEOBJ_H__
  9. #define __BASEOBJ_H__
  10. #include "headers.h"
  11. #include "critsec.h"
  12. // Used in some classes that wish to distinguish behavior based on object type.
  13. // (i.e. cast a void* to either CDataSource, CDBSession, CCommand, CRowset, etc.)
  14. // Note that CBaseObj::GetBaseObjectTypeName() depends.
  15. enum EBaseObjectType
  16. {
  17. BOT_UNDEFINED,
  18. BOT_DATASOURCE,
  19. BOT_SESSION,
  20. BOT_COMMAND,
  21. BOT_ROWSET,
  22. BOT_ENUMERATOR,
  23. BOT_ERROR,
  24. BOT_BINDER,
  25. BOT_TXNOPTIONS
  26. };
  27. /////////////////////////////////////////////////////////////////////////////////////////////////////////////////
  28. //
  29. // CBaseObj is the base object for CDatasource, CDBSession, CCommand, and CRowset
  30. //
  31. //
  32. /////////////////////////////////////////////////////////////////////////////////////////////////////////////////
  33. #pragma warning(disable : 4275)
  34. class CBaseObj : public IUnknown //@base public | IUnknown
  35. {
  36. private:
  37. EBaseObjectType m_BaseObjectType;
  38. CCriticalSection m_cs;
  39. DEBUGCODE(ULONG m_hObjCollection);
  40. protected:
  41. LPUNKNOWN m_pUnkOuter;
  42. ULONG m_cRef;
  43. protected:
  44. CBaseObj(EBaseObjectType botVal, LPUNKNOWN pUnkOuter);
  45. public:
  46. virtual ~CBaseObj();
  47. EBaseObjectType GetBaseObjectType() { return m_BaseObjectType; }
  48. WCHAR * GetBaseObjectTypeName();
  49. CCriticalSection * GetCriticalSection() { return &m_cs; }
  50. // Get the outer unknown. Used by another object to call QI on this object.
  51. // (Which should go through outer unknown instead of direct.)
  52. inline IUnknown* GetOuterUnknown() { return m_pUnkOuter; }
  53. };
  54. #pragma warning(default : 4275)
  55. #endif // __BASEOBJ_H__