GCpp general purpose C++ library
version 1.0
|
#include <GIntervalList.hh>
Public Types | |
typedef GListIterT< GInterval > | iterator |
Defines locally the iterator type. | |
Public Member Functions | |
template<class Q > | |
bool | IsInstanceOf () const |
template<class Q > | |
bool | IsInstanceOf () |
virtual GIntervalList * | Clone () const |
virtual const char * | ClassName () const |
GIntervalList () | |
GIntervalList (const string &str) | |
GIntervalList (const GIntervalList &original) | |
virtual | ~GIntervalList () |
GIntervalList & | operator= (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< GInterval > | Add (const GInterval &inter) |
virtual GListIterT< GInterval > | Add (const string &s) |
virtual GListIterT< GInterval > | Add (int i) |
virtual GListIterT< GInterval > | Add (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) |
![]() | |
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< GInterval > | Begin () const |
virtual GListIterT< GInterval > | End () const |
virtual bool | Exist (const GInterval *ptr) const |
virtual GListIterT< GInterval > | Find (const GInterval *ptr) const |
virtual GListIterT< GInterval > | FindNext (const GInterval *ptr) const |
virtual GListIterT< GInterval > | FindPrevious (const GInterval *ptr) const |
virtual GListIterT< GInterval > | FindFirst (const GInterval *ptr) const |
virtual GListIterT< GInterval > | FindLast (const GInterval *ptr) const |
GListIterT< GInterval > | Current () const |
GListIterT< GInterval > | Previous () const |
GListIterT< GInterval > | Next () const |
GListIterT< GInterval > | First () const |
GListIterT< GInterval > | Last () const |
GListIterT< GInterval > | Goto (u_int n=0) const |
GInterval & | At (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< GInterval > | Add (GInterval *obj_ptr) |
virtual GListIterT< GInterval > | Add (GInterval &obj_ptr) |
virtual GListIterT< GInterval > | Insert (GInterval *obj_ptr) |
virtual GListIterT< GInterval > | Insert (GInterval &obj_ptr) |
virtual GListIterT< GInterval > | Append (GInterval *obj_ptr) |
virtual GListIterT< GInterval > | Append (GInterval &obj_ptr) |
virtual GListIterT< GInterval > | Prepend (GInterval *obj_ptr) |
virtual GListIterT< GInterval > | Prepend (GInterval &obj_ptr) |
virtual GInterval * | Take () |
virtual GInterval * | Take (const GInterval *ptr) |
virtual void | Empty () |
![]() | |
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) | |
![]() | |
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. | |
![]() | |
u_int | options |
Collection option flags. | |
u_int | count_item |
Number of objects in the collection. | |
Additional Inherited Members | |
![]() | |
static const char * | StaticClassName () |
static GListIterT< GInterval > | Null () |
![]() | |
static const char * | StaticClassName () |
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).
|
inline |
Default constructor.
References index_ptr.
|
inline |
|
inline |
|
inlinevirtual |
Destructeur.
|
virtual |
Add an interval to the list. The index is set on the first value of the new interval.
inter | interval to add |
References GListT< T >::__Find(), GListT< T >::Add(), GListT< GInterval >::First(), GClassWarning, GDebugClass, GInterval::GetMax(), GetMaxValue(), GInterval::GetMin(), GetMinValue(), GCollectionT< GInterval >::GetSize(), GInterval::GetStringPar(), GGetString(), index_ptr, GListT< T >::Insert(), GInterval::IsEmpty(), GListT< GInterval >::Last(), GListT< GInterval >::Null(), GListT< T >::Remove(), GInterval::SetMax(), and GInterval::SetMin().
Referenced by Add(), GIntervalList(), and Remove().
|
virtual |
Add intervals to the list: several intervals can be defined in the string. The iterator on last added interval is returned.
s | intervals definition string |
References Add(), c_separ, GString::GetSubstring(), and GListT< GInterval >::Null().
|
inlinevirtual |
|
inlinevirtual |
Add an interval to the list.
i1 | interval lower bound (included) |
i2 | interval uppe bound (included) |
References Add().
bool GIntervalList::Contains | ( | int | val | ) | const |
Indicate if a value is in the list.
val | searched 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.
len | longueur 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.
len | size of the array (as output) |
References GListT< GInterval >::Begin(), GetValNumber(), and GListT< GInterval >::Null().
|
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.
|
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().
|
virtual |
Return a string with all intervals definition.
References GListT< GInterval >::Begin(), c_separ, GCollectionT< GInterval >::GetSize(), and GListT< GInterval >::Null().
|
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().
|
inline |
Macro from GCpp library that defines the following functions:
int GIntervalList::NextVal | ( | ) | const |
Set the index on the next value and returns it.
References Contains(), GetMaxValue(), GCollectionT< GInterval >::GetSize(), index_ptr, and noMin.
|
inline |
int GIntervalList::PreviousVal | ( | ) | const |
Set the index on the previous value and returns it.
References Contains(), GetMinValue(), GCollectionT< GInterval >::GetSize(), index_ptr, and noMax.
|
virtual |
Remove an interval from the list.
inter | interval to remove |
References Add(), GListT< GInterval >::Begin(), GDebugClass, GInterval::GetMax(), GetMaxValue(), GInterval::GetMin(), GetMinValue(), GIterT< T >::GetPointer(), GInterval::GetStringPar(), GGetString(), GInterval::IsEmpty(), GListIterT< T >::Next(), GListT< GInterval >::Null(), and Remove().
|
virtual |
Remove intervals to the list: several intervals can be defined in the string.
s | intervals definition string |
References c_separ, GString::GetSubstring(), and Remove().
|
inlinevirtual |
|
inlinevirtual |
Remove an interval from the list.
i1 | interval lower bound (included) |
i2 | interval uppe bound (included) |
References Remove().
|
inlineprotectedvirtual |
Function from the base class that is protected here and should not be used.
Reimplemented from GListT< GInterval >.
Referenced by Remove().
|
inlineprotectedvirtual |
Function from the base class that is protected here and should not be used.
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.