0022815: Missing delete operator for placement new
[occt.git] / src / OpenGl / OpenGl_Resource.hxx
CommitLineData
161c4476
K
1// File: OpenGl_Resource.hxx
2// Created: 18.03.11 9:20:00
3// Author: Anton POLETAEV
4
5#ifndef _OPENGL_RESOURCE_H
6#define _OPENGL_RESOURCE_H
7
8#include <OpenGl_ResourceCleaner.hxx>
9#include <MMgt_TShared.hxx>
10#include <Standard.hxx>
11#include <Standard_DefineHandle.hxx>
12#include <Handle_MMgt_TShared.hxx>
13
14class Standard_Transient;
15class Handle(Standard_Type);
16class Handle(MMgt_TShared);
2166f0fa 17class Handle(OpenGl_Context);
161c4476
K
18class OpenGl_ResourceCleaner;
19
20//! Class represents basic OpenGl memory resource, which
21//! could be removed only if appropriate context is avaliable;
22//! The cleaning procedure is done by OpenGl_ResourceCleaner
23class OpenGl_Resource : public MMgt_TShared
24{
25
26public:
27
28 //! Constructor
29 OpenGl_Resource() : myId(0) { }
30
31 //! Constructor
32 OpenGl_Resource(GLuint theId) : myId(theId) { }
33
34 //! Copy constructor
35 OpenGl_Resource(const OpenGl_Resource& theBase) : myId(theBase.myId) { }
36
37 //! Copy operation
2166f0fa 38 OpenGl_Resource& operator= (const OpenGl_Resource& theBase)
161c4476
K
39 {
40 this->myId = theBase.myId;
41 return *this;
42 }
43
44 //! Destructor
2166f0fa 45 virtual ~OpenGl_Resource() {}
161c4476
K
46
47 //! method clean() is accessible only by OpenGl_ResourceCleaner
48 friend class OpenGl_ResourceCleaner;
49
50protected:
51
52 //! Clean procedure, should be called only by OpenGl_ResourceCleaner;
53 //! Each type of resource has its own cleaning procedure
2166f0fa 54 virtual void Clean (const Handle(OpenGl_Context)& theGlContext) = 0;
161c4476
K
55
56protected:
57
58 GLuint myId; // Id of OpenGl memory resource
59
60};
61
62DEFINE_STANDARD_HANDLE(OpenGl_Resource,MMgt_TShared)
63
64#endif