COVISE Core
dataHandle.h
Go to the documentation of this file.
1/* This file is part of COVISE.
2
3 You can use it under the terms of the GNU Lesser General Public License
4 version 2.1 or later, see lgpl-2.1.txt.
5
6 * License: LGPL 2+ */
7
8#ifndef DATA_HANDLE_H
9#define DATA_HANDLE_H
10#include <memory>
11#include <util/coExport.h>
12
13
14namespace covise
15{
16 //controlls the lifetime of data
18{
19public:
20 DataHandle();
21 virtual ~DataHandle();
22 explicit DataHandle(char* data, const size_t length, bool doDelete = true);
23 explicit DataHandle(char* data, const int length, bool doDelete = true);
24 DataHandle(size_t size);
25 const char* data() const;
26
27 char* accessData();
28
29 const int length() const;
30 //pointer to the last char
31 const char* end() const;
32 char* end();
33 void setLength(const int l);
34 void incLength(const int inc);
35 void movePtr(int amount);
36 int getLength() const {return m_length;};
37protected:
38 //char* m_dataSection = nullptr;
39 std::shared_ptr<char> m_ManagedData;
40 char* m_dataPtr = nullptr;
41 int m_length = 0;
42 //check that m_dataPtr points in the the managed memory
43 void checkPtr() const;
44};
45}
46#endif // !DATA_HANDLE_H
47
#define NETEXPORT
Definition: coExport.h:373
GLsizeiptr size
Definition: khronos-glext.h:6610
GLuint GLuint end
Definition: khronos-glext.h:6343
GLenum GLuint GLenum GLsizei length
Definition: khronos-glext.h:6279
GLsizei GLsizei GLenum GLenum const GLvoid * data
Definition: khronos-glext.h:6354
list of all chemical elements
Definition: coConfig.h:27
double length(EDGE_VECTOR &vector)
Definition: CuttingSurfaceGPMUtil.h:70
Definition: dataHandle.h:18
int getLength() const
Definition: dataHandle.h:36
std::shared_ptr< char > m_ManagedData
Definition: dataHandle.h:36