materialBenefitList Class Reference

#include <material-benefit-list.hpp>

Inheritance diagram for materialBenefitList:

Inheritance graph
[legend]
Collaboration diagram for materialBenefitList:

Collaboration graph
[legend]
List of all members.

Detailed Description

A material benefit list is a list of objects that have been awarded to a character upon mustering out of a service. This is implemented as a linked list of materialBenefit object.

See also:
slinkList

slinkObj

materialBenefitObj

Definition at line 41 of file material-benefit-list.hpp.

Public Member Functions

 materialBenefitList ()
void addBenefit (materialBenefit *p)
void XMLout (FILE *fout)


Constructor & Destructor Documentation

materialBenefitList::materialBenefitList (  ) 

Obligatory constructor.

See also:
slinkList::slinkList()

Definition at line 31 of file material-benefit-list.cpp.

00031                                         :slinkList(){
00032 }


Member Function Documentation

void materialBenefitList::addBenefit ( materialBenefit p  ) 

Add a benefit to the list.

Parameters:
p pointer to a materialBenefit or a derived class of it.

If we get this far, this is a new benefit

Definition at line 34 of file material-benefit-list.cpp.

References slinkList::append(), slinkNode::getNext(), slinkList::getRoot(), materialBenefit::getSignature(), and materialBenefit::merge().

Referenced by personObj::addMaterialBenefit().

00034                                                       {
00035 #ifdef DEBUG_ON
00036         FILE* diaglog = fopen("diaglog.log","a+");
00037 #endif
00038         materialBenefit *r = (materialBenefit*) getRoot();
00039 #ifdef DEBUG_ON
00040         fprintf(diaglog,"Adding a \"%s\" to our benefits\n",p->getSignature());
00041 #endif
00042         
00043         while (r->getNext() != (materialBenefit*)0){
00044                 r = (materialBenefit*)r->getNext();
00045                 if ( strcmp(p->getSignature(),r->getSignature()) == 0 ) {
00046 #ifdef DEBUG_ON
00047                         fprintf(diaglog,"\tMerging...\n");
00048 #endif
00049                         r->merge(p);
00050                         return;
00051                 }
00052         }
00053         
00055 #ifdef DEBUG_ON
00056         fprintf(diaglog,"\tappending..\n");
00057         fclose(diaglog);
00058 #endif
00059         this->append(p);
00060 }

Here is the call graph for this function:

Here is the caller graph for this function:

void materialBenefitList::XMLout ( FILE *  fout  ) 

Send well formed (I hope!) XML to a file.

Parameters:
fout -- pointer to a file buffer/handle to write XML to

Definition at line 62 of file material-benefit-list.cpp.

References slinkNode::getNext(), slinkList::getRoot(), and materialBenefit::XMLout().

Referenced by book1Person::XMLout().

00062                                           {
00063         materialBenefit* r=(materialBenefit*) getRoot();
00064         
00065         fprintf(fout,"\t%s\n",createStartElement(MBLTAG));
00066         while(r->getNext() != (materialBenefit*)0){
00067                 r = (materialBenefit*) r->getNext();
00068                 r->XMLout(fout);
00069         }
00070         fprintf(fout,"\t%s\n",createEndElement(MBLTAG));
00071 }

Here is the call graph for this function:

Here is the caller graph for this function:


The documentation for this class was generated from the following files:
Generated on Fri Mar 7 16:41:40 2008 for frpuniverse by  doxygen 1.4.7