cctw  0.2.1
cctwdatachunk.h
Go to the documentation of this file.
1 #ifndef CCTWDATACHUNK_H
2 #define CCTWDATACHUNK_H
3 
4 #include "cctwobject.h"
5 #include "cctwvector3d.h"
6 #include <QMutex>
7 #include <QVector>
8 #include <QList>
9 #include "cctwchunkeddata.h"
10 
11 class CctwDataChunk : public CctwObject
12 {
13  Q_OBJECT
14 public:
16  int index,
17  QString name,
18  QObject *parent);
19 
20  virtual ~CctwDataChunk();
21 
22 public slots:
23 
24  int allocateData();
25  int allocateWeights();
26  int deallocateData();
27  int deallocateWeights();
28  int detachData();
29  int detachWeights();
30 
31  bool dataAllocated() const;
32  bool weightsAllocated() const;
33 
34  CctwChunkedData::MergeDataType data(int lx, int ly, int lz);
35  CctwChunkedData::MergeDataType weight(int lx, int ly, int lz);
36  void setData(int lx, int ly, int lz, CctwChunkedData::MergeDataType val);
37  void setWeight(int lx, int ly, int lz, CctwChunkedData::MergeDataType val);
38  int pixelOffset(int lx, int ly, int lz);
39 
42 
44  void resetChunkStart();
46  void setChunkSize(CctwIntVector3D size);
47 
48  void clearDependencies();
49  void addDependency(int dep);
50  void sortDependencies();
51  int dependencyCount() const;
52  int dependency(int n) const;
53 
54  void reportDependencies();
55 
56  int index() const;
57  void mergeChunk(CctwDataChunk *c);
58  void clearMergeCounters();
59  void incMergeCounters();
60  int mergeCount();
61 
64 
65  void normalizeChunk();
66 
67  static void resetAllocationLimits(int nmax);
68  static int maxAllocated();
69 
70  void setBuffer(void *buffer);
71 
74  int n);
75 
76  static int allocatedChunkCount();
77 
78 private:
83 
84 private:
94  QVector< int > m_Dependencies;
95  mutable QMutex m_DependenciesLock;
96  QMutex m_MergeLock;
98  QList< CctwChunkedData::MergeDataType* > m_MergeData;
99  QList< CctwChunkedData::MergeDataType* > m_MergeWeights;
101  bool m_OwnData;
102 };
103 
104 #endif // CCTWDATACHUNK_H
void mergeData(CctwChunkedData::MergeDataType *id, CctwChunkedData::MergeDataType *iw, int n)
int dependencyCount() const
void setChunkSize(CctwIntVector3D size)
CctwChunkedData::MergeDataType * m_ChunkData
Definition: cctwdatachunk.h:89
int index() const
bool dataAllocated() const
CctwIntVector3D m_ChunkStart
Definition: cctwdatachunk.h:87
void releaseBuffer(CctwChunkedData::MergeDataType *)
void addDependency(int dep)
QMutex m_MergeLock
Definition: cctwdatachunk.h:96
QList< CctwChunkedData::MergeDataType * > m_MergeWeights
Definition: cctwdatachunk.h:99
QString name
Definition: cctwobject.h:32
CctwIntVector3D chunkSize()
void clearDependencies()
void clearMergeCounters()
CctwChunkedData::MergeDataType * allocateBuffer()
void incMergeCounters()
CctwChunkedData::MergeDataType * m_ChunkWeights
Definition: cctwdatachunk.h:90
CctwChunkedData * m_Data
Definition: cctwdatachunk.h:85
QMutex m_DependenciesLock
Definition: cctwdatachunk.h:95
CctwChunkedData::MergeDataType weight(int lx, int ly, int lz)
CctwIntVector3D calculateChunkStart()
static int allocatedChunkCount()
int dependency(int n) const
void mergeChunk(CctwDataChunk *c)
void setData(int lx, int ly, int lz, CctwChunkedData::MergeDataType val)
CctwChunkedData::MergeDataType * weightsPointer()
static int maxAllocated()
CctwIntVector3D calculateChunkSize()
bool popMergeData(CctwChunkedData::MergeDataType **data, CctwChunkedData::MergeDataType **weights)
bool weightsAllocated() const
int pixelOffset(int lx, int ly, int lz)
void sortDependencies()
void pushMergeData(CctwChunkedData::MergeDataType *data, CctwChunkedData::MergeDataType *weights)
CctwIntVector3D chunkStart()
CctwDataChunk(CctwChunkedData *data, int index, QString name, QObject *parent)
void setBuffer(void *buffer)
CctwChunkedData::MergeDataType * dataPointer()
QList< CctwChunkedData::MergeDataType * > m_MergeData
Definition: cctwdatachunk.h:98
void setWeight(int lx, int ly, int lz, CctwChunkedData::MergeDataType val)
static void resetAllocationLimits(int nmax)
virtual ~CctwDataChunk()
CctwChunkedData::MergeDataType data(int lx, int ly, int lz)
void resetChunkStart()
QVector< int > m_Dependencies
Definition: cctwdatachunk.h:94
void reportDependencies()
CctwIntVector3D m_ChunkSize
Definition: cctwdatachunk.h:88