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.

166 lines
4.5 KiB

  1. // V2Cont.cpp: implementation of the CV2Container class.
  2. //
  3. // (c) Copyright Schlumberger Technology Corp., unpublished work, created
  4. // 1999. This computer program includes Confidential, Proprietary
  5. // Information and is a Trade Secret of Schlumberger Technology Corp. All
  6. // use, disclosure, and/or reproduction is prohibited unless authorized
  7. // in writing. All Rights Reserved.
  8. //////////////////////////////////////////////////////////////////////
  9. #include "NoWarning.h"
  10. #include <scuCast.h>
  11. #include "slbCci.h"
  12. #include "cciCard.h"
  13. #include "TransactionWrap.h"
  14. #include "ContainerInfoRecord.h"
  15. #include "V2Cont.h"
  16. using namespace std;
  17. using namespace cci;
  18. /////////////////////////// LOCAL/HELPER /////////////////////////////////
  19. /////////////////////////// PUBLIC /////////////////////////////////
  20. // Types
  21. // C'tors/D'tors
  22. CV2Container::CV2Container(CV2Card const &rv2card)
  23. : CAbstractContainer(rv2card),
  24. m_sidHandle(0),
  25. m_apcir()
  26. {
  27. // Allocate new entry in object info file
  28. m_sidHandle =
  29. rv2card.ObjectInfoFile(oaPublicAccess).AddObject(otContainerObject,
  30. ContInfoRecordSize);
  31. Setup(rv2card);
  32. m_apcir->Clear();
  33. m_apcir->Write();
  34. }
  35. CV2Container::CV2Container(CV2Card const &rv2card,
  36. SymbolID sidHandle)
  37. : CAbstractContainer(rv2card),
  38. m_sidHandle(sidHandle),
  39. m_apcir()
  40. {
  41. Setup(rv2card);
  42. m_apcir->Read();
  43. }
  44. CV2Container::~CV2Container() throw()
  45. {}
  46. // Operators
  47. // Operations
  48. void
  49. CV2Container::ID(string const &rstrID)
  50. {
  51. m_apcir->Symbol(&m_apcir->m_bID, rstrID);
  52. }
  53. CV2Container *
  54. CV2Container::Make(CV2Card const &rv2card,
  55. SymbolID sidHandle)
  56. {
  57. CTransactionWrap wrap(rv2card);
  58. return new CV2Container(rv2card, sidHandle);
  59. }
  60. void
  61. CV2Container::Name(string const &rstrName)
  62. {
  63. m_apcir->Symbol(&m_apcir->m_bName, rstrName);
  64. }
  65. // Access
  66. CContainerInfoRecord &
  67. CV2Container::CIR() const
  68. {
  69. return *m_apcir;
  70. }
  71. SymbolID
  72. CV2Container::Handle() const
  73. {
  74. return m_sidHandle;
  75. }
  76. string
  77. CV2Container::ID()
  78. {
  79. return m_apcir->Symbol(&m_apcir->m_bID);
  80. }
  81. string
  82. CV2Container::Name()
  83. {
  84. return m_apcir->Symbol(&m_apcir->m_bName);
  85. }
  86. // Predicates
  87. // Static Variables
  88. /////////////////////////// PROTECTED /////////////////////////////////
  89. // C'tors/D'tors
  90. // Operators
  91. // Operations
  92. void
  93. CV2Container::DoDelete()
  94. {
  95. CV2Card &rv2card = scu::DownCast<CV2Card &, CAbstractCard &>(*m_hcard);
  96. if (m_apcir->m_bID)
  97. rv2card.ObjectInfoFile(oaPublicAccess).RemoveSymbol(m_apcir->m_bID);
  98. if (m_apcir->m_bName)
  99. rv2card.ObjectInfoFile(oaPublicAccess).RemoveSymbol(m_apcir->m_bName);
  100. rv2card.ObjectInfoFile(oaPublicAccess).RemoveObject(otContainerObject,
  101. m_sidHandle);
  102. }
  103. // Access
  104. // Predicates
  105. bool
  106. CV2Container::DoEquals(CAbstractContainer const &rhs) const
  107. {
  108. CV2Container const &rv2rhs =
  109. scu::DownCast<CV2Container const &, CAbstractContainer const &>(rhs);
  110. return (rv2rhs.m_sidHandle == m_sidHandle);
  111. }
  112. // Static Variables
  113. /////////////////////////// PRIVATE /////////////////////////////////
  114. // C'tors/D'tors
  115. // Operators
  116. // Operations
  117. void
  118. CV2Container::Setup(CV2Card const &rv2card)
  119. {
  120. m_apcir =
  121. auto_ptr<CContainerInfoRecord>(new CContainerInfoRecord(rv2card,
  122. m_sidHandle));
  123. }
  124. // Access
  125. // Predicates
  126. // Static Variables