src/Cargo.h

Go to the documentation of this file.
00001 /* Crown and Cutlass
00002  * Cargo Object Header
00003  */
00004 
00005 #if !defined ( _CARGO_H_ )
00006 #define _CARGO_H_
00007 
00008 #include <vector>
00009 #include <string>
00010 #include <boost/shared_ptr.hpp>
00011 #include "ISaveObject.h"
00012 
00013 class Product;
00014 
00015 using namespace std;
00016 using boost::shared_ptr;
00017 
00018 class Cargo: public ISaveObject {
00019 public:
00020   Cargo(string nameIn, unsigned int sizeIn);
00021   ~Cargo();
00022 
00023   unsigned int GetFilled();
00024   unsigned int GetSize();
00025   void SetSize(unsigned int sizeIn);
00026   unsigned int GetAvailQty();
00027 
00028   unsigned int GetQty(unsigned int product) throw ( const char *);
00029   void SetQty(unsigned int product, unsigned int qty) throw ( const char *);
00030   unsigned int AddQty(unsigned int product, int qty) throw ( const char *);
00031   void AddCargo(shared_ptr<Cargo> cargo) throw ( const char *);
00032 
00033   void FillRandom() throw ( const char*);
00034   void FillRandom(unsigned int qty) throw ( const char *);
00035 
00036   void Save(TiXmlElement *parent);
00037   void Load(TiXmlElement *parent);
00038 
00039   void Dump();
00040 
00041  private:
00042   // Clear out the cargo
00043   void Clear();
00044 
00045   vector<int> products;
00046 
00047   unsigned int size;
00048   unsigned int filled;
00049 
00050   string name;
00051 };
00052 
00053 #endif

Generated on Mon Jan 8 22:34:12 2007 for CrownandCutlass by  doxygen 1.4.7