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

qgar::GenPointChain< T > Class Template Reference
[Points]

#include <qgarlib/GenPointChain.H>

Inheritance diagram for qgar::GenPointChain< T >:

qgar::AbstractGenPointChain< T > List of all members.

Detailed Description

template<class T>
class qgar::GenPointChain< T >

Chain of points having coordinates of type T.

A point is an instance of class qgar::GenPoint<T>. New points can only be inserted to the beginning or to the end of the chain.

Such a chain is implemented by a STL list of points with an iterator that allows bidirectional traversal of the chain. The validity of the iterator is preserved by any legal operation on the chain, unless the chain is empty.

Warning: Such a chain cannot be used in the STL way. The beginning (resp. end) of the chain is the first (resp. last) point of the chain, that is returned by functions qgar::GenPointChain::accessFront and qgar::GenPointChain::front (resp. GenPointChain::back and qgar::GenPointChain::back). In other words, the iterator always points to a point in the chain (unless empty).

To use the chain in the Qgar way:

To use the chain in the STL way:

Predefined types:

Author:
Gérald Masini, from previous work by Karl Tombre
Date:
December 15, 2003 16:16
Since:
Qgar 2.1.1

Definition at line 116 of file GenPointChain.H.

Public Types

Types
typedef T value_type
 Type of the coordinates of the points.
typedef value_typereference
 Reference to qgar::GenPointChain::value_type.
typedef const value_typeconst_reference
 Constant reference to qgar::GenPointChain::value_type.
typedef value_typepointer
 Pointer to qgar::GenPointChain::value_type.
typedef const value_typeconst_pointer
 Constant pointer to qgar::GenPointChain::value_type.

Public Member Functions

Constructors
 GenPointChain ()
 Default constructor.
 GenPointChain (const GenPointChain< value_type > &aPtChain)
 Copy constructor.
 GenPointChain (const GenPoint< value_type > &aPoint)
 Construct from a given point, that becomes the current point.
Destructor
virtual ~GenPointChain ()
 Virtual destructor.
Access to chain characteristics
virtual bool empty () const
 Is current chain empty?
virtual int size () const
 Get chain size (number of points).
Iterator
virtual void setToBegin ()
 Make the internal iterator point to the beginning (first point) of the chain.
virtual void setToEnd ()
 Make the internal iterator point to the end (last point) of the chain.
virtual bool isAtBegin () const
 Does internal iterator points to the beginning of the chain?
virtual bool isAtEnd () const
 Does internal iterator points to the end of the chain?
virtual bool hasNext () const
 Is there a point after the current point?
virtual bool hasPrevious () const
 Is there a point before the current point?
virtual void moveNext ()
 Move to next point, that becomes the current point.
virtual void movePrevious ()
 Move to previous point, that becomes the current point.
Access to points
virtual const GenPoint< value_type > & accessFront () const
 Get first point.
virtual GenPoint< value_typefront () const
 Get a copy of first point.
virtual const GenPoint< value_type > & accessBack () const
 Get last point.
virtual GenPoint< value_typeback () const
 Get a copy of last point.
virtual const GenPoint< value_type > & accessCurrent () const
 Get the current point.
virtual GenPoint< value_typecurrent () const
 Get a copy of the current point.
const GenPoint< value_type > & accessNext ()
 Get the successor of the current point.
virtual GenPoint< value_typenext ()
 Get a copy of the successor of the current point.
const GenPoint< value_type > & accessPrevious ()
 Get the predecessor of the current point.
virtual GenPoint< value_typeprevious ()
 Get a copy of the predecessor of the current point.
Access to the list of points
const std::list< GenPoint<
value_type > > & 
accessPointList () const
 Get the STL list implementing the chain of points.
std::list< GenPoint< value_type > > & pointList ()
 Get the STL list implementing the chain of points.
Insertion
virtual void push_front (const GenPoint< value_type > &aPt)
 Insert a point at the beginning of the chain.
virtual void push_back (const GenPoint< value_type > &aPt)
 Insert a point at the end of the chain.
Transformations
virtual void reverse ()
 Reverse the order of elements in the list.
Conversions
virtual std::list< GenPoint<
value_type > > 
toPointList () const
 Convert into a (STL) list of points.
Operators
GenPointChain< value_type > & operator= (const GenPointChain< value_type > &aPtChain)
 Assignment.

Protected Attributes

Implementation of a chain of points
std::list< GenPoint< value_type > > _chain
 List of the points.
std::list< GenPoint< value_type
> >::iterator 
_iter
 Iterator on the list of points.


Member Typedef Documentation

template<class T>
typedef const value_type* qgar::GenPointChain< T >::const_pointer
 

Constant pointer to qgar::GenPointChain::value_type.

Reimplemented from qgar::AbstractGenPointChain< T >.

Definition at line 153 of file GenPointChain.H.

template<class T>
typedef const value_type& qgar::GenPointChain< T >::const_reference
 

Constant reference to qgar::GenPointChain::value_type.

Reimplemented from qgar::AbstractGenPointChain< T >.

Definition at line 143 of file GenPointChain.H.

template<class T>
typedef value_type* qgar::GenPointChain< T >::pointer
 

Pointer to qgar::GenPointChain::value_type.

Reimplemented from qgar::AbstractGenPointChain< T >.

Definition at line 148 of file GenPointChain.H.

template<class T>
typedef value_type& qgar::GenPointChain< T >::reference
 

Reference to qgar::GenPointChain::value_type.

Reimplemented from qgar::AbstractGenPointChain< T >.

Definition at line 138 of file GenPointChain.H.

template<class T>
typedef T qgar::GenPointChain< T >::value_type
 

Type of the coordinates of the points.

Reimplemented from qgar::AbstractGenPointChain< T >.

Definition at line 133 of file GenPointChain.H.


Constructor & Destructor Documentation

template<class T>
qgar::GenPointChain< T >::GenPointChain  ) 
 

Default constructor.

The STL list of points is empty and the value of the iterator is undefined.

Definition at line 58 of file GenPointChain.TCC.

References qgar::GenPointChain< T >::_chain, and qgar::GenPointChain< T >::_iter.

template<class T>
qgar::GenPointChain< T >::GenPointChain const GenPointChain< value_type > &  aPtChain  ) 
 

Copy constructor.

Parameters:
aPtChain a chain of points
Warning:
The internal iterator points to the beginning of the chain.

Definition at line 68 of file GenPointChain.TCC.

References qgar::GenPointChain< T >::_chain, and qgar::GenPointChain< T >::_iter.

template<class T>
qgar::GenPointChain< T >::GenPointChain const GenPoint< value_type > &  aPoint  ) 
 

Construct from a given point, that becomes the current point.

The internal iterator points to the beginning of the chain.

Parameters:
aPoint a point

template<class T>
qgar::GenPointChain< T >::~GenPointChain  )  [virtual]
 

Virtual destructor.

Definition at line 98 of file GenPointChain.TCC.


Member Function Documentation

template<class T>
const GenPoint< T > & qgar::GenPointChain< T >::accessBack  )  const [virtual]
 

Get last point.

Warning:
The chain is supposed not to be empty.

Implements qgar::AbstractGenPointChain< T >.

Definition at line 239 of file GenPointChain.TCC.

References qgar::GenPointChain< T >::_chain.

template<class T>
const GenPoint< T > & qgar::GenPointChain< T >::accessCurrent  )  const [virtual]
 

Get the current point.

Warning:
The chain is supposed not to be empty.

Implements qgar::AbstractGenPointChain< T >.

Definition at line 257 of file GenPointChain.TCC.

References qgar::GenPointChain< T >::_iter.

template<class T>
const GenPoint< T > & qgar::GenPointChain< T >::accessFront  )  const [virtual]
 

Get first point.

Warning:
The chain is supposed not to be empty.

Implements qgar::AbstractGenPointChain< T >.

Definition at line 221 of file GenPointChain.TCC.

References qgar::GenPointChain< T >::_chain.

template<class T>
const GenPoint< T > & qgar::GenPointChain< T >::accessNext  )  [virtual]
 

Get the successor of the current point.

Warning:
The chain is supposed not to be empty, and the iterator is supposed not to point to the last point.

Implements qgar::AbstractGenPointChain< T >.

Definition at line 276 of file GenPointChain.TCC.

References qgar::GenPointChain< T >::_iter.

template<class T>
const std::list< GenPoint< T > > & qgar::GenPointChain< T >::accessPointList  )  const [inline]
 

Get the STL list implementing the chain of points.

The function returns a const result, so that the user cannot directly transform the list.

Definition at line 323 of file GenPointChain.TCC.

References qgar::GenPointChain< T >::_chain.

template<class T>
const GenPoint< T > & qgar::GenPointChain< T >::accessPrevious  )  [virtual]
 

Get the predecessor of the current point.

Warning:
The chain is supposed not to be empty, and the iterator is supposed not to point to the first point.

Implements qgar::AbstractGenPointChain< T >.

Definition at line 297 of file GenPointChain.TCC.

References qgar::GenPointChain< T >::_iter.

template<class T>
GenPoint< T > qgar::GenPointChain< T >::back  )  const [virtual]
 

Get a copy of last point.

Warning:
The chain is supposed not to be empty.

Implements qgar::AbstractGenPointChain< T >.

Definition at line 247 of file GenPointChain.TCC.

References qgar::GenPointChain< T >::_chain.

Referenced by qgar::LINKEDCHAINLIST_canMerge(), and qgar::LINKEDCHAINLIST_mergeChains().

template<class T>
GenPoint< T > qgar::GenPointChain< T >::current  )  const [virtual]
 

Get a copy of the current point.

Warning:
The chain is supposed not to be empty.

Implements qgar::AbstractGenPointChain< T >.

Definition at line 266 of file GenPointChain.TCC.

References qgar::GenPointChain< T >::_iter.

template<class T>
bool qgar::GenPointChain< T >::empty  )  const [virtual]
 

Is current chain empty?

Implements qgar::AbstractGenPointChain< T >.

Definition at line 113 of file GenPointChain.TCC.

References qgar::GenPointChain< T >::_chain.

template<class T>
GenPoint< T > qgar::GenPointChain< T >::front  )  const [virtual]
 

Get a copy of first point.

Warning:
The chain is supposed not to be empty.

Implements qgar::AbstractGenPointChain< T >.

Definition at line 230 of file GenPointChain.TCC.

References qgar::GenPointChain< T >::_chain.

Referenced by qgar::LINKEDCHAINLIST_canMerge(), and qgar::LINKEDCHAINLIST_mergeChains().

template<class T>
bool qgar::GenPointChain< T >::hasNext  )  const [virtual]
 

Is there a point after the current point?

Warning:
The chain is supposed not to be empty.

Implements qgar::AbstractGenPointChain< T >.

Definition at line 157 of file GenPointChain.TCC.

References qgar::GenPointChain< T >::_chain, and qgar::GenPointChain< T >::_iter.

template<class T>
bool qgar::GenPointChain< T >::hasPrevious  )  const [virtual]
 

Is there a point before the current point?

Warning:
The chain is supposed not to be empty.

Implements qgar::AbstractGenPointChain< T >.

Definition at line 168 of file GenPointChain.TCC.

References qgar::GenPointChain< T >::_chain, and qgar::GenPointChain< T >::_iter.

template<class T>
bool qgar::GenPointChain< T >::isAtBegin  )  const [virtual]
 

Does internal iterator points to the beginning of the chain?

Implements qgar::AbstractGenPointChain< T >.

Definition at line 178 of file GenPointChain.TCC.

References qgar::GenPointChain< T >::_chain, and qgar::GenPointChain< T >::_iter.

template<class T>
bool qgar::GenPointChain< T >::isAtEnd  )  const [virtual]
 

Does internal iterator points to the end of the chain?

Implements qgar::AbstractGenPointChain< T >.

Definition at line 188 of file GenPointChain.TCC.

References qgar::GenPointChain< T >::_chain, and qgar::GenPointChain< T >::_iter.

template<class T>
void qgar::GenPointChain< T >::moveNext  )  [virtual]
 

Move to next point, that becomes the current point.

Warning:
The chain is supposed not to be empty.

Implements qgar::AbstractGenPointChain< T >.

Definition at line 197 of file GenPointChain.TCC.

References qgar::GenPointChain< T >::_iter.

template<class T>
void qgar::GenPointChain< T >::movePrevious  )  [virtual]
 

Move to previous point, that becomes the current point.

Warning:
The chain is supposed not to be empty.

Implements qgar::AbstractGenPointChain< T >.

Definition at line 206 of file GenPointChain.TCC.

References qgar::GenPointChain< T >::_iter.

template<class T>
GenPoint< T > qgar::GenPointChain< T >::next  )  [virtual]
 

Get a copy of the successor of the current point.

Warning:
The chain is supposed not to be empty, and the iterator is supposed not to point to the last point.

Implements qgar::AbstractGenPointChain< T >.

Definition at line 286 of file GenPointChain.TCC.

References qgar::GenPointChain< T >::_iter.

template<class T>
GenPointChain< T > & qgar::GenPointChain< T >::operator= const GenPointChain< value_type > &  aPtChain  ) 
 

Assignment.

Parameters:
aPtChain a chain of points
Warning:
The internal iterator points to the beginning of the chain.

Definition at line 401 of file GenPointChain.TCC.

References qgar::GenPointChain< T >::_chain, and qgar::GenPointChain< T >::_iter.

template<class T>
std::list< GenPoint< T > > & qgar::GenPointChain< T >::pointList  )  [inline]
 

Get the STL list implementing the chain of points.

Warning:
The function does not return a const result, allowing the client to directly transform the internal structure of the chain, without using functions of the interface.
Todo:
Maybe this kind of function should not be provided!

Definition at line 334 of file GenPointChain.TCC.

References qgar::GenPointChain< T >::_chain.

Referenced by qgar::LINKEDCHAINLIST_mergeChains().

template<class T>
GenPoint< T > qgar::GenPointChain< T >::previous  )  [virtual]
 

Get a copy of the predecessor of the current point.

Warning:
The chain is supposed not to be empty, and the iterator is supposed not to point to the first point.

Implements qgar::AbstractGenPointChain< T >.

Definition at line 307 of file GenPointChain.TCC.

References qgar::GenPointChain< T >::_iter.

template<class T>
virtual void qgar::GenPointChain< T >::push_back const GenPoint< value_type > &  aPt  )  [virtual]
 

Insert a point at the end of the chain.

The internal iterator remains valid after the operation.

Parameters:
aPt a point

Implements qgar::AbstractGenPointChain< T >.

Referenced by qgar::LinkedChainList::aChain(), qgar::LinkedChainList::LinkedChainList(), and qgar::DxfFile::retrievePChain().

template<class T>
virtual void qgar::GenPointChain< T >::push_front const GenPoint< value_type > &  aPt  )  [virtual]
 

Insert a point at the beginning of the chain.

The internal iterator remains valid after the operation.

Parameters:
aPt a point

Implements qgar::AbstractGenPointChain< T >.

template<class T>
void qgar::GenPointChain< T >::reverse  )  [virtual]
 

Reverse the order of elements in the list.

Warning:
The validity of the internal iterator to the chain is preserved.

Implements qgar::AbstractGenPointChain< T >.

Definition at line 371 of file GenPointChain.TCC.

References qgar::GenPointChain< T >::_chain.

Referenced by qgar::LINKEDCHAINLIST_mergeChains().

template<class T>
void qgar::GenPointChain< T >::setToBegin  )  [virtual]
 

Make the internal iterator point to the beginning (first point) of the chain.

Warning:
The chain is supposed not to be empty.

Implements qgar::AbstractGenPointChain< T >.

Definition at line 137 of file GenPointChain.TCC.

References qgar::GenPointChain< T >::_chain, and qgar::GenPointChain< T >::_iter.

template<class T>
void qgar::GenPointChain< T >::setToEnd  )  [virtual]
 

Make the internal iterator point to the end (last point) of the chain.

Warning:
The chain is supposed not to be empty.

Implements qgar::AbstractGenPointChain< T >.

Definition at line 146 of file GenPointChain.TCC.

References qgar::GenPointChain< T >::_chain, and qgar::GenPointChain< T >::_iter.

template<class T>
int qgar::GenPointChain< T >::size  )  const [virtual]
 

Get chain size (number of points).

Implements qgar::AbstractGenPointChain< T >.

Definition at line 123 of file GenPointChain.TCC.

References qgar::GenPointChain< T >::_chain.

Referenced by qgar::LinkedChainList::aChain(), qgar::LinkedChainList::LinkedChainList(), and qgar::LINKEDCHAINLIST_tooSmall().

template<class T>
std::list< GenPoint< T > > qgar::GenPointChain< T >::toPointList  )  const [virtual]
 

Convert into a (STL) list of points.

Implements qgar::AbstractGenPointChain< T >.

Definition at line 386 of file GenPointChain.TCC.

References qgar::GenPointChain< T >::_chain.


Member Data Documentation

template<class T>
std::list< GenPoint<value_type> > qgar::GenPointChain< T >::_chain [protected]
 

List of the points.

Definition at line 476 of file GenPointChain.H.

Referenced by qgar::GenPointChain< T >::accessBack(), qgar::GenPointChain< T >::accessFront(), qgar::GenPointChain< T >::accessPointList(), qgar::GenPointChain< T >::back(), qgar::GenPointChain< T >::empty(), qgar::GenPointChain< T >::front(), qgar::GenPointChain< T >::GenPointChain(), qgar::GenPointChain< T >::hasNext(), qgar::GenPointChain< T >::hasPrevious(), qgar::GenPointChain< T >::isAtBegin(), qgar::GenPointChain< T >::isAtEnd(), qgar::GenPointChain< T >::operator=(), qgar::GenPointChain< T >::pointList(), qgar::GenPointChain< T >::reverse(), qgar::GenPointChain< T >::setToBegin(), qgar::GenPointChain< T >::setToEnd(), qgar::GenPointChain< T >::size(), and qgar::GenPointChain< T >::toPointList().

template<class T>
std::list< GenPoint<value_type> >::iterator qgar::GenPointChain< T >::_iter [protected]
 

Iterator on the list of points.

Definition at line 481 of file GenPointChain.H.

Referenced by qgar::GenPointChain< T >::accessCurrent(), qgar::GenPointChain< T >::accessNext(), qgar::GenPointChain< T >::accessPrevious(), qgar::GenPointChain< T >::current(), qgar::GenPointChain< T >::GenPointChain(), qgar::GenPointChain< T >::hasNext(), qgar::GenPointChain< T >::hasPrevious(), qgar::GenPointChain< T >::isAtBegin(), qgar::GenPointChain< T >::isAtEnd(), qgar::GenPointChain< T >::moveNext(), qgar::GenPointChain< T >::movePrevious(), qgar::GenPointChain< T >::next(), qgar::GenPointChain< T >::operator=(), qgar::GenPointChain< T >::previous(), qgar::GenPointChain< T >::setToBegin(), and qgar::GenPointChain< T >::setToEnd().


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