0022962: Invalid realization of reading and writing material in STEP.
[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);
17class OpenGl_ResourceCleaner;
18
19//! Class represents basic OpenGl memory resource, which
20//! could be removed only if appropriate context is avaliable;
21//! The cleaning procedure is done by OpenGl_ResourceCleaner
22class OpenGl_Resource : public MMgt_TShared
23{
24
25public:
26
27 //! Constructor
28 OpenGl_Resource() : myId(0) { }
29
30 //! Constructor
31 OpenGl_Resource(GLuint theId) : myId(theId) { }
32
33 //! Copy constructor
34 OpenGl_Resource(const OpenGl_Resource& theBase) : myId(theBase.myId) { }
35
36 //! Copy operation
37 OpenGl_Resource& operator = (const OpenGl_Resource& theBase)
38 {
39 this->myId = theBase.myId;
40 return *this;
41 }
42
43 //! Destructor
44 virtual ~OpenGl_Resource() { }
45
46 //! method clean() is accessible only by OpenGl_ResourceCleaner
47 friend class OpenGl_ResourceCleaner;
48
49protected:
50
51 //! Clean procedure, should be called only by OpenGl_ResourceCleaner;
52 //! Each type of resource has its own cleaning procedure
53 virtual void Clean() = 0;
54
55protected:
56
57 GLuint myId; // Id of OpenGl memory resource
58
59};
60
61DEFINE_STANDARD_HANDLE(OpenGl_Resource,MMgt_TShared)
62
63#endif