Magick++  7.1.2-29
Convert, Edit, Or Compose Bitmap Images
BlobRef.h
1 // This may look like C code, but it is really -*- C++ -*-
2 //
3 // Copyright Bob Friesenhahn, 1999, 2000, 2001, 2002
4 //
5 // Copyright @ 2014 ImageMagick Studio LLC, a non-profit organization
6 // dedicated to making software imaging solutions freely available.
7 //
8 // Blob reference class
9 //
10 // This is an internal implementation class that should not be
11 // accessed by users.
12 //
13 
14 #if !defined(Magick_Blob_header)
15 #define Magick_Blob_header
16 
17 #include "Magick++/Include.h"
18 #include "Magick++/Thread.h"
19 #include "Magick++/Blob.h"
20 
21 namespace Magick
22 {
23  class BlobRef
24  {
25  public:
26 
27  // Construct with data, making private copy of data
28  BlobRef(const void* data_,const size_t length_);
29 
30  // Destructor (actually destroys data)
31  ~BlobRef(void);
32 
33  // Decreases reference count and return the new count
34  size_t decrease();
35 
36  // Increases reference count
37  void increase();
38 
39  Blob::Allocator allocator; // Memory allocation system in use
40  size_t length; // Blob length
41  void* data; // Blob data
42 
43  private:
44  // Copy constructor and assignment are not supported
45  BlobRef(const BlobRef&);
46 
47  MutexLock _mutexLock; // Mutex lock
48  size_t _refCount; // Reference count
49  };
50 
51 } // namespace Magick
52 
53 #endif // Magick_Blob_header