Next, we implement the GedgePtrBag class itself.
GedgePtrBag::GedgePtrBag(const GedgePtrBag& T)
{
d_root_p = T.d_root_p;
}
GedgePtrBag::GedgePtrBag()
{
d_root_p = NULL;
}
GedgePtrBag& GedgePtrBag::operator=(const GedgePtrBag& T)
{
if(&T!=this){
d_root_p = T.d_root_p;
return(*this);
}
else{
return(*this);
}
}
GedgePtrBag::~GedgePtrBag()
{
GedgePtrBagManip man(this);
while(man){
man.remove();
}
}
void GedgePtrBag::add(Gedge *pointer)
{
d_root_p = new GedgePtrBagLink(pointer,d_root_p);
}
void GedgePtrBag::removeAll(const Gedge *pointer)
{
GedgePtrBagManip man(this);
while(man){
man()==pointer ? man.remove() : man.advance();
}
}