Skip to content
Snippets Groups Projects
Commit 6245295a authored by Tomáš Oberhuber's avatar Tomáš Oberhuber
Browse files

Renaming mDataElement to tnlDataElement.

parent 22aad12b
No related branches found
No related tags found
No related merge requests found
......@@ -13,7 +13,7 @@ EXTRA_DIST = tnlConfigDescriptionParser.y \
headers = \
tnlConfigDescription.h \
tnlCurve.h \
mDataElement.h \
tnlDataElement.h \
mField1D.h \
mField2D.h \
mField3D.h \
......
/***************************************************************************
mDataElement.h - description
tnlDataElement.h - description
-------------------
begin : 2004/04/11 14:01
copyright : (C) 2004 by Tomas Oberhuber
......@@ -19,33 +19,33 @@
#define __mDATAELEMENT_H__
//! Data element for tnlList and mStack
template< class T > class mDataElement
template< class T > class tnlDataElement
{
//! Main data
T data;
//! Pointer to the next element
mDataElement< T >* next;
tnlDataElement< T >* next;
//! Pointer to the previous element
mDataElement< T >* previous;
tnlDataElement< T >* previous;
public:
//! Basic constructor
mDataElement()
tnlDataElement()
: next( 0 ),
previous( 0 ){};
//! Constructor with given data and possibly pointer to next element
mDataElement( const T& dt,
mDataElement< T >* prv = 0,
mDataElement< T >* nxt = 0 )
tnlDataElement( const T& dt,
tnlDataElement< T >* prv = 0,
tnlDataElement< T >* nxt = 0 )
: data( dt ),
next( nxt ),
previous( prv ){};
//! Destructor
~mDataElement(){};
~tnlDataElement(){};
//! Return data for non-const instances
T& Data() { return data; };
......@@ -54,16 +54,16 @@ template< class T > class mDataElement
const T& Data() const { return data; };
//! Return pointer to the next element for non-const instances
mDataElement< T >*& Next() { return next; };
tnlDataElement< T >*& Next() { return next; };
//! Return pointer to the next element for const instances
const mDataElement< T >* Next() const { return next; };
const tnlDataElement< T >* Next() const { return next; };
//! Return pointer to the previous element for non-const instances
mDataElement< T >*& Previous() { return previous; };
tnlDataElement< T >*& Previous() { return previous; };
//! Return pointer to the previous element for const instances
const mDataElement< T >* Previous() const { return previous; };
const tnlDataElement< T >* Previous() const { return previous; };
};
......
......@@ -25,7 +25,7 @@
#include <assert.h>
#include <stdlib.h>
#include <iostream>
#include "mDataElement.h"
#include "tnlDataElement.h"
#include "tnlString.h"
#include "param-types.h"
......@@ -52,18 +52,18 @@ template< class T > class tnlList
protected:
//! Pointer to the first element
mDataElement< T >* first;
tnlDataElement< T >* first;
//! Pointer to the last element
/*! We use pointer to last element while adding new element to keep order of elements
*/
mDataElement< T >* last;
tnlDataElement< T >* last;
//! List size
long int size;
//! Iterator
mutable mDataElement< T >* iterator;
mutable tnlDataElement< T >* iterator;
//! Iterator index
mutable long int index;
......@@ -160,12 +160,12 @@ template< class T > class tnlList
if( ! first )
{
assert( ! last );
first = last = new mDataElement< T >( data );
first = last = new tnlDataElement< T >( data );
if( ! first ) return false;
}
else
{
mDataElement< T >* new_element = new mDataElement< T >( data, last, 0 );
tnlDataElement< T >* new_element = new tnlDataElement< T >( data, last, 0 );
if( ! new_element ) return false;
assert( last );
last = last -> Next() = new_element;
......@@ -180,12 +180,12 @@ template< class T > class tnlList
if( ! first )
{
assert( ! last );
first = last = new mDataElement< T >( data );
first = last = new tnlDataElement< T >( data );
if( ! first ) return false;
}
else
{
mDataElement< T >* new_element = new mDataElement< T >( data, 0, first );
tnlDataElement< T >* new_element = new tnlDataElement< T >( data, 0, first );
if( ! new_element ) return false;
first = first -> Previous() = new_element;
}
......@@ -201,8 +201,8 @@ template< class T > class tnlList
if( ind == 0 ) return Prepend( data );
if( ind == size ) return Append( data );
operator[]( ind );
mDataElement< T >* new_el =
new mDataElement< T >( data,
tnlDataElement< T >* new_el =
new tnlDataElement< T >( data,
iterator -> Previous(),
iterator );
if( ! new_el ) return false;
......@@ -238,7 +238,7 @@ template< class T > class tnlList
void Erase( long int ind )
{
operator[]( ind );
mDataElement< T >* tmp_it = iterator;
tnlDataElement< T >* tmp_it = iterator;
if( iterator -> Next() )
iterator -> Next() -> Previous() = iterator -> Previous();
if( iterator -> Previous() )
......@@ -267,7 +267,7 @@ template< class T > class tnlList
void EraseAll()
{
iterator = first;
mDataElement< T >* tmp_it;
tnlDataElement< T >* tmp_it;
while( iterator )
{
tmp_it = iterator;
......@@ -282,7 +282,7 @@ template< class T > class tnlList
void DeepEraseAll()
{
iterator = first;
mDataElement< T >* tmp_it;
tnlDataElement< T >* tmp_it;
while( iterator )
{
tmp_it = iterator;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment