GCpp general purpose C++ library  version 1.0
GIntervalList Class Reference

#include <GIntervalList.hh>

Inheritance diagram for GIntervalList:
GListT< GInterval > GCollectionT< GInterval >

Public Types

typedef GListIterT< GIntervaliterator
 Defines locally the iterator type.
 

Public Member Functions

template<class Q >
bool IsInstanceOf () const
 
template<class Q >
bool IsInstanceOf ()
 
virtual GIntervalListClone () const
 
virtual const char * ClassName () const
 
 GIntervalList ()
 
 GIntervalList (const string &str)
 
 GIntervalList (const GIntervalList &original)
 
virtual ~GIntervalList ()
 
GIntervalListoperator= (const GIntervalList &original)
 
virtual string GetString () const
 
virtual string GetStringPar () const
 
int GetMinValue () const
 
int GetMaxValue () const
 
int GetValNumber () const
 
int * GetArray (int &len) const
 
bool Contains (int val) const
 
int FromFirst () const
 
int ToLast () const
 
int NextVal () const
 
int FromLast () const
 
int ToFirst () const
 
int PreviousVal () const
 
virtual GListIterT< GIntervalAdd (const GInterval &inter)
 
virtual GListIterT< GIntervalAdd (const string &s)
 
virtual GListIterT< GIntervalAdd (int i)
 
virtual GListIterT< GIntervalAdd (int i1, int i2)
 
virtual bool Remove (const GInterval &inter)
 
virtual bool Remove (const string &s)
 
virtual bool Remove (int i)
 
virtual bool Remove (int i1, int i2)
 

Static Public Member Functions

static const char * StaticClassName ()
 

Static Public Attributes

static const int noMin = 2147483647
 Undefined minimu value.
 
static const int noMax = -2147483647
 Undefined maximum value.
 
static string c_separ = ",;|"
 Elements separation characters.
 

Protected Member Functions

virtual bool Remove ()
 
virtual bool Remove (const GInterval *ptr, bool all=true)
 
- Protected Member Functions inherited from GListT< GInterval >
virtual GListIterT< GInterval > * __Exist (const GInterval *ptr, GListIterT< GInterval > *except=NULL) const
 
virtual GListIterT< GInterval > * __Find (const GInterval *ptr, GListIterT< GInterval > *except=NULL) const
 
virtual GListIterT< GInterval__Add (GInterval *item)
 
virtual GListIterT< GInterval__Insert (GInterval *item)
 
virtual GInterval__Take ()
 
virtual void __Swap (GListIterT< GInterval > *iter)
 
virtual bool __MoveUp ()
 
virtual bool __MoveDown ()
 
bool IsInstanceOf () const
 
bool IsInstanceOf ()
 
 GListT (u_int opts=0)
 
 GListT (const GListT< GInterval > &list)
 
 GListT (const GListT< GInterval > &list, u_int opts)
 
GListT< GInterval > & operator= (const GListT< GInterval > &list)
 
virtual GListIterT< GIntervalBegin () const
 
virtual GListIterT< GIntervalEnd () const
 
virtual bool Exist (const GInterval *ptr) const
 
virtual GListIterT< GIntervalFind (const GInterval *ptr) const
 
virtual GListIterT< GIntervalFindNext (const GInterval *ptr) const
 
virtual GListIterT< GIntervalFindPrevious (const GInterval *ptr) const
 
virtual GListIterT< GIntervalFindFirst (const GInterval *ptr) const
 
virtual GListIterT< GIntervalFindLast (const GInterval *ptr) const
 
GListIterT< GIntervalCurrent () const
 
GListIterT< GIntervalPrevious () const
 
GListIterT< GIntervalNext () const
 
GListIterT< GIntervalFirst () const
 
GListIterT< GIntervalLast () const
 
GListIterT< GIntervalGoto (u_int n=0) const
 
GIntervalAt (u_int n) const
 
int Index () const
 
virtual int Move (int n)
 
virtual bool MoveUp ()
 
virtual bool MoveDown ()
 
virtual bool MoveTop ()
 
virtual bool MoveBottom ()
 
virtual GListIterT< GIntervalAdd (GInterval *obj_ptr)
 
virtual GListIterT< GIntervalAdd (GInterval &obj_ptr)
 
virtual GListIterT< GIntervalInsert (GInterval *obj_ptr)
 
virtual GListIterT< GIntervalInsert (GInterval &obj_ptr)
 
virtual GListIterT< GIntervalAppend (GInterval *obj_ptr)
 
virtual GListIterT< GIntervalAppend (GInterval &obj_ptr)
 
virtual GListIterT< GIntervalPrepend (GInterval *obj_ptr)
 
virtual GListIterT< GIntervalPrepend (GInterval &obj_ptr)
 
virtual GIntervalTake ()
 
virtual GIntervalTake (const GInterval *ptr)
 
virtual void Empty ()
 
- Protected Member Functions inherited from GCollectionT< GInterval >
bool IsInstanceOf () const
 
bool IsInstanceOf ()
 
 GCollectionT (u_int flg=0)
 
virtual u_int GetSize () const
 
virtual u_int GetCount () const
 
virtual u_int GetOptions () const
 
bool CheckOptions (u_int opts) const
 
bool FixPositionOption () const
 
bool IsSortable () const
 
bool IsAlwaysSorted () const
 
bool IsReverseSorted () const
 
bool UniqueNameOption () const
 
bool IsCaseSensitive () const
 
bool DictSortOption () const
 

Protected Attributes

int * index_ptr
 Pointer of the index (so that the value can be modified for a constant list)
 
- Protected Attributes inherited from GListT< GInterval >
GListIterT< GInterval > ** first_item
 Iterator on first object in the list.
 
GListIterT< GInterval > ** last_item
 Iterator on last object in the list.
 
GListIterT< GInterval > ** current_item
 Iterator on current object in the list.
 
- Protected Attributes inherited from GCollectionT< GInterval >
u_int options
 Collection option flags.
 
u_int count_item
 Number of objects in the collection.
 

Additional Inherited Members

- Static Protected Member Functions inherited from GListT< GInterval >
static const char * StaticClassName ()
 
static GListIterT< GIntervalNull ()
 
- Static Protected Member Functions inherited from GCollectionT< GInterval >
static const char * StaticClassName ()
 

Detailed Description

This class defines a list of intervals of integer values.

The base class is protected since adding and removing intervals is done with a check of overlapping intervals.

The class defines an index to navigate from one value to the next (and not only from one interval to the next, as the base class do).

Constructor & Destructor Documentation

GIntervalList::GIntervalList ( )
inline

Default constructor.

References index_ptr.

GIntervalList::GIntervalList ( const string &  str)
inline

Constructor from a string defining intervals.

Parameters
strintervals definition string

References Add(), and index_ptr.

GIntervalList::GIntervalList ( const GIntervalList original)
inline

Copy constructor.

Parameters
originallist to copy

References index_ptr.

GIntervalList::~GIntervalList ( )
inlinevirtual

Destructeur.

Member Function Documentation

GListIterT< GInterval > GIntervalList::Add ( const string &  s)
virtual

Add intervals to the list: several intervals can be defined in the string. The iterator on last added interval is returned.

Parameters
sintervals definition string

References Add(), c_separ, GString::GetSubstring(), and GListT< GInterval >::Null().

GListIterT< GInterval > GIntervalList::Add ( int  i)
inlinevirtual

Add a single value to the list.

Parameters
iinteger value

References Add().

GListIterT< GInterval > GIntervalList::Add ( int  i1,
int  i2 
)
inlinevirtual

Add an interval to the list.

Parameters
i1interval lower bound (included)
i2interval uppe bound (included)

References Add().

bool GIntervalList::Contains ( int  val) const

Indicate if a value is in the list.

Parameters
valsearched value

References GListT< GInterval >::Begin(), and GListT< GInterval >::Null().

Referenced by NextVal(), and PreviousVal().

int GIntervalList::FromFirst ( ) const

Set the index on the first value and returns it.

References GListT< T >::First(), GCollectionT< GInterval >::GetSize(), and noMin.

int GIntervalList::FromLast ( ) const

Set the index on the last value and returns it.

References GCollectionT< GInterval >::GetSize(), GListT< T >::Last(), and noMax.

int * GIntervalList::GetArray ( int &  len) const

Crée une table des valeurs entières de la liste. Le pointeur de la table est retourné par la fonction. La mémoire allouée est ensuite à la charge de l'utilisateur.

Parameters
lenlongueur de la table en sortie

Allocate an array of integers with the values of the list. The function returns the array pointer, and it must be deleted by calling program.

Parameters
lensize of the array (as output)

References GListT< GInterval >::Begin(), GetValNumber(), and GListT< GInterval >::Null().

int GIntervalList::GetMaxValue ( ) const
inline

Return the largest value from the list, and if the list is empty, return GIntervalList::noMax.

References GListT< GInterval >::End(), GCollectionT< GInterval >::GetSize(), and noMax.

Referenced by Add(), NextVal(), and Remove().

int GIntervalList::GetMinValue ( ) const
inline

Return the smallest value from the list, and if the list is empty, return GIntervalList::noMin.

References GListT< GInterval >::Begin(), GCollectionT< GInterval >::GetSize(), and noMin.

Referenced by Add(), PreviousVal(), and Remove().

string GIntervalList::GetString ( ) const
virtual

Return a string with all intervals definition.

References GListT< GInterval >::Begin(), c_separ, GCollectionT< GInterval >::GetSize(), and GListT< GInterval >::Null().

string GIntervalList::GetStringPar ( ) const
virtual

Return a string with all intervals definition, with parenthesis.

References GListT< GInterval >::Begin(), c_separ, GCollectionT< GInterval >::GetSize(), and GListT< GInterval >::Null().

int GIntervalList::GetValNumber ( ) const

Return the number of integer values in the list.

References GListT< GInterval >::Begin(), and GListT< GInterval >::Null().

Referenced by GetArray().

template<class Q >
bool GIntervalList::IsInstanceOf ( ) const
inline

Macro from GCpp library that defines the following functions:

  • ClassName(): return the real class name of the object
  • StaticClassName(): return the used class name of the object (that may be a base class of the real object).
  • IsInstanceOf<T>(): return true if the current object is an instance of the template class name argument
  • Clone(): return an allocated copy of the object.
int GIntervalList::NextVal ( ) const

Set the index on the next value and returns it.

References Contains(), GetMaxValue(), GCollectionT< GInterval >::GetSize(), index_ptr, and noMin.

GIntervalList & GIntervalList::operator= ( const GIntervalList original)
inline

Affectation operator

Parameters
originallist to copy

References G_AFFECT_MOTHER.

int GIntervalList::PreviousVal ( ) const

Set the index on the previous value and returns it.

References Contains(), GetMinValue(), GCollectionT< GInterval >::GetSize(), index_ptr, and noMax.

bool GIntervalList::Remove ( const string &  s)
virtual

Remove intervals to the list: several intervals can be defined in the string.

Parameters
sintervals definition string

References c_separ, GString::GetSubstring(), and Remove().

bool GIntervalList::Remove ( int  i)
inlinevirtual

Remove a single value from the list.

Parameters
ivalue that should be rmoved

References Remove().

bool GIntervalList::Remove ( int  i1,
int  i2 
)
inlinevirtual

Remove an interval from the list.

Parameters
i1interval lower bound (included)
i2interval uppe bound (included)

References Remove().

bool GIntervalList::Remove ( )
inlineprotectedvirtual

Function from the base class that is protected here and should not be used.

Reimplemented from GListT< GInterval >.

Referenced by Remove().

bool GIntervalList::Remove ( const GInterval ptr,
bool  all = true 
)
inlineprotectedvirtual

Function from the base class that is protected here and should not be used.

Parameters
ptr(see base class)
all(see base class)

Reimplemented from GListT< GInterval >.

int GIntervalList::ToFirst ( ) const

Return the "end" value for reversed order loops.

References GListT< T >::First(), GCollectionT< GInterval >::GetSize(), and noMin.

int GIntervalList::ToLast ( ) const

Return the "end" value for normal order loops.

References GCollectionT< GInterval >::GetSize(), GListT< T >::Last(), and noMax.


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