BDS Public
Beam-lib  2.16.3
This is the Beam C++ class library.
BRefData.h
Go to the documentation of this file.
1 /*******************************************************************************
2  * BRefData.h Referenced data storage
3  * T.Barnaby, Beam Ltd, 6/10/94
4  * Copyright (c) 2012 All Right Reserved, Beam Ltd, http://www.beam.ltd.uk
5  *******************************************************************************
6  */
7 #ifndef BREFDATA_H
8 #define BREFDATA_H 1
9 
10 #include <BAtomicCount.h>
11 
14 class BRefData {
15 public:
16  BRefData();
17  BRefData(int len);
18  BRefData(const BRefData& refData);
19  ~BRefData();
20 
21  BRefData* copy();
22  BRefData* addRef();
23  int deleteRef();
24 
25  char* data(){ return (char*)odata; }
26  int len(){ return olen; }
27 
28  BRefData& operator=(const BRefData& refData);
29 
30  void setLen(int len);
31 
32 private:
33 
34  BAtomicCount orefCount;
35  int olen;
36  void* odata;
37 };
38 
39 
40 #endif
BRefData * copy()
Create a copy of this reference for writing, if necessary.
Definition: BRefData.cpp:49
Definition: BRefData.h:14
int len()
Return the length in bytes.
Definition: BRefData.h:26
~BRefData()
Definition: BRefData.cpp:42
BRefData()
Definition: BRefData.cpp:13
int deleteRef()
Decrement the reference counter.
Definition: BRefData.cpp:67
BAtomicCount class.
Definition: BAtomicCount.h:48
void setLen(int len)
Set the length in bytes. Note should only be used if orefCount = 1.
Definition: BRefData.cpp:71
char * data()
Return the raw data pointer.
Definition: BRefData.h:25
BRefData * addRef()
Increment the reference counter.
Definition: BRefData.cpp:62
BRefData & operator=(const BRefData &refData)
Definition: BRefData.cpp:33