GPL_Bag
GPL_Bag
gpl
1998 12-05
CLASS
GPL_Bag - C++ container class for GPL_Tuple objects.
SYNOPSIS
This class is a generic container for GPL_Tuple objects. Tuples
may be added, removed, or matched upon.
CONSTRUCTOR
GPL_Bag()
Construct a GPL_Bag.
MEMBER FUNCTIONS
GPL_Tuple &Match(char *format, ...)
Return a record that matches the arguments. See DSSX_Tuple::CheckMatch()
for the argument specification
format. If no record matches an empty tuple is returned. Note that if more
than one record matches any single matching record may be returned. It
is not defined which one in particular is returned.
GPL_Tuple &Match(const GPL_Description &desc)
Return a record that matches desc.
void Match(GPL_Bag &bag, char *format, ...)
Add all records that match the arguments to bag. Note that any
pre-existing tuples in bag are not removed automatically.
void Match(GPL_Bag &bag, const GPL_Description &desc)
Add all records that match desc to bag.
void Add(const GPL_Tuple &tuple)
Add tuple to the bag.
void Add(GPL_Bag &bag)
Add all of the tuples in bag.
long Remove(const GPL_Tuple &tuple)
Remove tuple for the bag.
void Remove(GPL_Bag &bag)
Remove all of the tuples in bag from the calling bag.
void Get(GPL_List<GPL_Tuple> &llist)
Add the contents of the GPL_Bag to llist. Note that
pre-exisiting tuples are not automatically removed.
POINTER BASED MEMBER FUNCTIONS
Notes on pointer based member functions
These member functions use GPL_DoubleList<GPL_Tuple> to interact
with GPL_Bag. GPL_DoubleList is a pointer based data
structure and may facilitate more efficient access to GPL_Bag.
However, this must be done with care since GPL_Bag itself treats
its data members as value based. This means that when a GPL_Bag
is destructed all tuples within it are deleted rendering pointers to
such data invalid. Note that there is no Add() variant due to the
extreme risk of directly adding externally allocated tuples.
GPL_Tuple *MatchDirect(char *format, ...)
Return a record that matches the arguments. See DSSX_Tuple::CheckMatch()
for the argument specification
format. If no record matches NULL is returned. Note that if more
than one record matches any single matching record may be returned. It
is not defined which one in particular is returned.
GPL_Tuple *MatchDirect(const GPL_Description &desc)
Return a record that matches desc.
void Match(GPL_DoubleList<GPL_Tuple> &dlist, char *format, ...)
Append all records that match the arguments to dlist. Note that
any pre-existing tuples in dlist are not removed automatically.
void Match(GPL_DoubleList<GPL_Tuple> &dlist, const GPL_Description &desc)
Append all records that match desc to dlist.
void Remove(GPL_DoubleList<GPL_Tuple> &dlist)
Remove the tuples pointed to in dlist from the bag. Note that
this is a pointer based operation to be used as as more efficient
alternative to the potentially slow Remove(GPL_Bag &bag).
void Get(GPL_DoubleList<GPL_Tuple> &dlist)
Append the contents from the GPL_Bag to dlist. Note that
pre-exisiting tuple are not automatically removed.
void Clear()
Remove all tuples.