Main Page | Modules | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members | Related Pages

osg::HalfEdgeGraph::TrianglePool Class Reference

List of all members.

Public Member Functions

 TrianglePool (UInt32 chunkSize=DEFAULT_CHUNK_SIZE)
 ~TrianglePool (void)
TrianglecreateTriangle (void)
void clear (void)
UInt32 countElem (void)
void setChunkSize (UInt32 chunkSize=DEFAULT_CHUNK_SIZE)

Private Types

enum  { DEFAULT_CHUNK_SIZE = 2048 }

Private Attributes

UInt32 _defaultChunkSize
Chunk_first
Chunk_last

Classes

class  Chunk

Detailed Description

Definition at line 137 of file OSGHalfEdgeGraph.h.


Member Enumeration Documentation

anonymous enum [private]
 

Enumerator:
DEFAULT_CHUNK_SIZE 

Definition at line 153 of file OSGHalfEdgeGraph.h.

00153 { DEFAULT_CHUNK_SIZE = 2048 };


Constructor & Destructor Documentation

osg::HalfEdgeGraph::TrianglePool::TrianglePool UInt32  chunkSize = DEFAULT_CHUNK_SIZE  )  [inline]
 

Definition at line 239 of file OSGHalfEdgeGraph.inl.

00240     : _defaultChunkSize(chunkSize), _first(0), _last(0)
00241 {
00242 }

osg::HalfEdgeGraph::TrianglePool::~TrianglePool void   )  [inline]
 

Definition at line 245 of file OSGHalfEdgeGraph.inl.

References clear().

00246 {
00247     clear();
00248 }


Member Function Documentation

HalfEdgeGraph::Triangle * osg::HalfEdgeGraph::TrianglePool::createTriangle void   )  [inline]
 

Definition at line 251 of file OSGHalfEdgeGraph.inl.

References osg::HalfEdgeGraph::TrianglePool::Chunk::_data, _defaultChunkSize, _first, osg::HalfEdgeGraph::TrianglePool::Chunk::_freeElem, _last, osg::HalfEdgeGraph::TrianglePool::Chunk::_next, and osg::HalfEdgeGraph::TrianglePool::Chunk::_size.

Referenced by osg::HalfEdgeGraph::addTriangle().

00252 {
00253     if(!_first)
00254     {
00255         _first = _last = new Chunk(_defaultChunkSize);
00256     }
00257     else
00258     {
00259         if(_last->_freeElem == 0) 
00260             _last = _last->_next = new Chunk(_defaultChunkSize);
00261     }
00262     return &(_last->_data[_last->_size - _last->_freeElem--]);
00263 }

void osg::HalfEdgeGraph::TrianglePool::clear void   )  [inline]
 

Definition at line 266 of file OSGHalfEdgeGraph.inl.

References _first, and _last.

Referenced by osg::HalfEdgeGraph::clear(), and ~TrianglePool().

00267 {
00268     delete _first;
00269     _first = _last = 0;
00270 }

UInt32 osg::HalfEdgeGraph::TrianglePool::countElem void   )  [inline]
 

Definition at line 273 of file OSGHalfEdgeGraph.inl.

References _first, and osg::HalfEdgeGraph::TrianglePool::Chunk::countElem().

Referenced by osg::HalfEdgeGraph::calcOptPrim(), and osg::HalfEdgeGraph::triangleCount().

00274 {
00275     return (_first ? _first->countElem() : 0);
00276 }

void osg::HalfEdgeGraph::TrianglePool::setChunkSize UInt32  chunkSize = DEFAULT_CHUNK_SIZE  )  [inline]
 

Definition at line 279 of file OSGHalfEdgeGraph.inl.

References _defaultChunkSize.

Referenced by osg::HalfEdgeGraph::reserve().

00280 {
00281     _defaultChunkSize = chunkSize;
00282 }


Member Data Documentation

UInt32 osg::HalfEdgeGraph::TrianglePool::_defaultChunkSize [private]
 

Definition at line 155 of file OSGHalfEdgeGraph.h.

Referenced by createTriangle(), and setChunkSize().

Chunk* osg::HalfEdgeGraph::TrianglePool::_first [private]
 

Definition at line 156 of file OSGHalfEdgeGraph.h.

Referenced by clear(), countElem(), and createTriangle().

Chunk* osg::HalfEdgeGraph::TrianglePool::_last [private]
 

Definition at line 157 of file OSGHalfEdgeGraph.h.

Referenced by clear(), and createTriangle().


The documentation for this class was generated from the following files:
Generated on Thu Aug 25 04:15:33 2005 for OpenSG by  doxygen 1.4.3