Leaked source code of windows server 2003
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.

99 lines
2.3 KiB

  1. // scuMarker.h -- implementation of a Marker template
  2. // (c) Copyright Schlumberger Technology Corp., unpublished work, created
  3. // 2002. This computer program includes Confidential, Proprietary
  4. // Information and is a Trade Secret of Schlumberger Technology Corp. All
  5. // use, disclosure, and/or reproduction is prohibited unless authorized
  6. // in writing. All Rights Reserved.
  7. #if !defined(SLBSCU_MARKER_H)
  8. #define SLBSCU_MARKER_H
  9. //#include "DllSymDefn.h"
  10. namespace scu
  11. {
  12. // Marker is a simple template for markers on card. It is used
  13. // with built in types (int, unsigned int, etc) to store marker
  14. // data retrieved from a smart card.
  15. template<class T>
  16. class Marker
  17. {
  18. public:
  19. Marker()
  20. :m_fSet(false),
  21. m_Value(0)
  22. {}
  23. Marker(Marker<T> const &rm)
  24. :m_fSet(false),
  25. m_Value(0)
  26. {
  27. *this = rm;
  28. }
  29. Marker(T const & rval)
  30. :m_Value(rval),
  31. m_fSet(true)
  32. {}
  33. ~Marker()
  34. {}
  35. Marker<T> &
  36. operator=(T const & val)
  37. {
  38. m_Value = val;
  39. m_fSet = true;
  40. return *this;
  41. }
  42. Marker<T> &
  43. operator=(Marker<T> const & rother)
  44. {
  45. if(this != &rother)
  46. {
  47. m_Value = rother.Value();
  48. m_fSet = rother.Set();
  49. }
  50. return *this;
  51. }
  52. bool
  53. operator==(Marker<T> const &other)
  54. {
  55. bool fResult = false;
  56. if(Set() && other.Set())
  57. {
  58. if(Value() == other.Value())
  59. {
  60. fResult = true;
  61. }
  62. }
  63. return fResult;
  64. }
  65. bool
  66. operator!=(Marker<T> const &other)
  67. {
  68. return !(this->operator==(other));
  69. }
  70. T
  71. Value() const
  72. {
  73. return m_Value;
  74. }
  75. bool
  76. Set() const
  77. {
  78. return m_fSet;
  79. }
  80. private:
  81. T m_Value;
  82. bool m_fSet;
  83. };
  84. }
  85. #endif //SLBSCU_MARKER_H