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.

92 lines
3.0 KiB

  1. // AlignedBlob.cpp -- Aligned Blob class implementation
  2. // (c) Copyright Schlumberger Technology Corp., unpublished work, created
  3. // 2001. 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. #include "AlignedBlob.h"
  8. using namespace scu;
  9. /////////////////////////// LOCAL/HELPER /////////////////////////////////
  10. /////////////////////////// PUBLIC /////////////////////////////////
  11. // Types
  12. // C'tors/D'tors
  13. AlignedBlob::AlignedBlob(Blob const &rblb)
  14. : m_aaBlob(AutoArrayPtr<AlignedBlob::ValueType>(new AlignedBlob::ValueType[rblb.length()])),
  15. m_cLength(rblb.length())
  16. {
  17. memcpy(m_aaBlob.Get(), rblb.data(), m_cLength);
  18. }
  19. AlignedBlob::AlignedBlob(AlignedBlob::ValueType const *p,
  20. AlignedBlob::SizeType cLength)
  21. : m_aaBlob(AutoArrayPtr<AlignedBlob::ValueType>(new AlignedBlob::ValueType[cLength])),
  22. m_cLength(cLength)
  23. {
  24. memcpy(m_aaBlob.Get(), p, m_cLength);
  25. }
  26. AlignedBlob::AlignedBlob(AlignedBlob const &rhs)
  27. : m_aaBlob(0),
  28. m_cLength(0)
  29. {
  30. *this = rhs;
  31. }
  32. AlignedBlob::~AlignedBlob() throw()
  33. {}
  34. // Operators
  35. AlignedBlob &
  36. AlignedBlob::operator=(AlignedBlob const &rhs)
  37. {
  38. if (this != &rhs)
  39. {
  40. m_aaBlob = AutoArrayPtr<AlignedBlob::ValueType>(new AlignedBlob::ValueType[rhs.m_cLength]);
  41. memcpy(m_aaBlob.Get(), rhs.m_aaBlob.Get(), rhs.m_cLength);
  42. m_cLength = rhs.m_cLength;
  43. }
  44. return *this;
  45. }
  46. // Operations
  47. // Access
  48. AlignedBlob::ValueType *
  49. AlignedBlob::Data() const throw()
  50. {
  51. return m_aaBlob.Get();
  52. }
  53. AlignedBlob::SizeType
  54. AlignedBlob::Length() const throw()
  55. {
  56. return m_cLength;
  57. }
  58. // Predicates
  59. // Static Variables
  60. /////////////////////////// PROTECTED /////////////////////////////////
  61. // C'tors/D'tors
  62. // Operators
  63. // Operations
  64. // Access
  65. // Predicates
  66. // Static Variables
  67. /////////////////////////// PRIVATE /////////////////////////////////
  68. // C'tors/D'tors
  69. // Operators
  70. // Operations
  71. // Access
  72. // Predicates
  73. // Static Variables