Magick++  7.1.0
BlobRef.h
Go to the documentation of this file.
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  BlobRef& operator=(const BlobRef&);
47 
48  MutexLock _mutexLock; // Mutex lock
49  size_t _refCount; // Reference count
50  };
51 
52 } // namespace Magick
53 
54 #endif // Magick_Blob_header
BlobRef(const void *data_, const size_t length_)
Definition: BlobRef.cpp:21
Blob::Allocator allocator
Definition: BlobRef.h:39
void * data
Definition: BlobRef.h:41
void increase()
Definition: BlobRef.cpp:64
size_t decrease()
Definition: BlobRef.cpp:46
size_t length
Definition: BlobRef.h:40
Definition: Blob.h:17
~BlobRef(void)
Definition: BlobRef.cpp:35