V-ART
Public Member Functions | Public Attributes | List of all members
VART::MemoryObj Class Reference

A "Memory Object" is a V-ART object that has some memory allocation attributes, allowing V-ART to auto deallocate its memory space. More...

#include <memoryobj.h>

Inheritance diagram for VART::MemoryObj:
VART::Dof VART::SceneNode VART::GraphicObj VART::Light VART::Transform VART::Cone VART::Curve VART::Cylinder VART::Dot VART::MeshObject VART::PolyLine VART::RefSystem VART::Sphere VART::PointLight VART::SpotLight VART::Joint

Public Member Functions

 MemoryObj ()
 Default constructor. More...
 
 MemoryObj (const VART::MemoryObj &obj)
 Copy constructor. More...
 

Public Attributes

bool autoDelete
 

Detailed Description

A "Memory Object" is a V-ART object that has some memory allocation attributes, allowing V-ART to auto deallocate its memory space.

A V-ART program typically needs to allocate memory for several scene objects that should be deallocated upon application exit. V-ART code typically follows the rule that memory allocated by the programmer should be deallocated by her, while memory allocated by itself should be deallocated by itself. However, creating lots of graphical objects, joints and DOFs, and keeping track of their memory positions is tedious hard work, that may be avoided using some kind of memory management. The use of the autoDelete flag helps creating a fast, user-controlled memory management.

Bug:
GLUT applications must call glutMainLoop which never returns, therefore stdlib's exit function must be called to end an application. This prevents stack objects from being destructed, which makes the creation on memory management policies based on destructors a lot harder. It is recommended that key objects in the application (the scene, the viewer, the lights) are declared "static" to ensure activation of their destructors upon application exit.

Definition at line 27 of file memoryobj.h.

Constructor & Destructor Documentation

VART::MemoryObj::MemoryObj ( )

Default constructor.

Initializes the autoDelete flag with false, i.e.: all Memory Objects arent deallocated by default upon application termination.

Definition at line 10 of file memoryobj.cpp.

References autoDelete.

VART::MemoryObj::MemoryObj ( const VART::MemoryObj obj)

Copy constructor.

Initialize the autoDelete flag with the same value of obj, i.e.: the new memory objects are deallocated if the original object are deallocated.

Definition at line 15 of file memoryobj.cpp.

Member Data Documentation

bool VART::MemoryObj::autoDelete

The documentation for this class was generated from the following files: