Mobile API Reference  MicroStrategy 2019
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
BinaryImpl.h
Go to the documentation of this file.
1 //==============================================================================================
2 // FILENAME : BinaryImpl.h
3 // AUTHOR : Yuxiao Xiao
4 // CREATION : 8/24/01
5 // Copyright (C) MicroStrategy, Inc. 2001
6 //==============================================================================================
7 #ifndef MDataType_BinaryImpl_h
8 #define MDataType_BinaryImpl_h
9 
10 #include "../Binary.h"
11 
12 namespace MDataType
13 {
14  class BinaryImpl:
15  public Binary
16  {
17  public:
18 
19  BinaryImpl(MBase::Buffer* ipBuffer = NULL);
20  BinaryImpl(const void* ipData, size_t iSize, MBase::Buffer* ipBuffer = NULL);
21 
22  // a virtual destructor is a must
23  virtual ~BinaryImpl() throw()
24  {
25  }
26 
27  protected:
28 
29  void SetBinary(const void* ipData, size_t iSize);
30 
31  bool operator == (const Binary& irBinary) const;
32  bool operator < (const Binary& irBinary) const;
33 
34  size_t GetSize() const;
35  const void* c_ptr() const;
36 
37  virtual void ZapTail(size_t iHowManyBytes);
38  virtual void ZapHead(size_t iHowManyBytes);
39  virtual void UnZap();
40 
41  char* GiveUpBinary();
42 
43  private:
44 
45  MBase::Buffer* const mpBuffer;
46 
47  MBase::StrongArrayPtr<char> mBinaryPtr;
48 
49  // "allocated" is the block of memory that was allocated
50  size_t mAllocatedSize;
51  void* mpAllocatedData;
52 
53  // "visible" is (part) of the "allocated" block, which is "seen" by c_ptr()/GetSize
54  size_t mVisibleSize;
55  void* mpVisibleData;
56  };
57 }
58 
59 #endif // MDataType_BinaryImpl_h
void SetBinary(const void *ipData, size_t iSize)
SetBinary allocates a new buffer.
bool operator<(const Binary &irBinary) const
MDataType::Binary represents binary data.
Definition: Binary.h:33
BinaryImpl(MBase::Buffer *ipBuffer=NULL)
Definition: Buffer.h:58
Definition: BigDecimal.h:18
size_t GetSize() const
GetSize returns the number of bytes of the internal buffer.
Definition: BinaryImpl.h:14
virtual void ZapTail(size_t iHowManyBytes)
virtual void ZapHead(size_t iHowManyBytes)
virtual ~BinaryImpl()
Definition: BinaryImpl.h:23
bool operator==(const Binary &irBinary) const
Operator == does an efficient deep comparison. Returns true if equal.
#define NULL
Definition: Null.h:10
virtual void UnZap()
const void * c_ptr() const
c_ptr returns a weak reference to the internal buffer. Do not try to delete the pointer.