Main Page   Namespace List   Class Hierarchy   Compound List   File List   Namespace Members   Compound Members   File Members   Related Pages  

/home/groups/n/no/noxwizard/cvs/src/archive.h

Go to the documentation of this file.
00001   /*-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
00002     || NoX-Wizard UO Server Emulator (NXW) [http://noxwizard.sourceforge.net]  ||
00003     ||                                                                         ||
00004     || This software is free software released under GPL2 license.             ||
00005     || You can find detailed license information in nox-wizard.cpp file.       ||
00006     ||                                                                         ||
00007     || For any question post to NoX-Wizard forums.                             ||
00008     -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-*/
00009 
00015 #ifndef __ARCHIVE_H__
00016 #define __ARCHIVE_H__
00017 
00018 
00019 typedef std::map< SERIAL, P_OBJECT > OBJECT_MAP;
00020 
00021 class cAllObjects {
00022 
00023 protected:
00024 
00025         friend class cAllObjectsIter;
00026         friend class cAllCharsIter;
00027         friend class cAllItemsIter;
00028 
00029 
00030         static OBJECT_MAP all; 
00031 
00032         static SERIAL current_char_serial; 
00033         static SERIAL current_item_serial; 
00034 
00035 public:
00036 
00037         cAllObjects();
00038         ~cAllObjects();
00039 
00040         void insertObject( P_OBJECT obj );
00041         void eraseObject( P_OBJECT obj );
00042         P_OBJECT findObject(SERIAL nSerial);
00043         SERIAL getNextCharSerial();
00044         SERIAL getNextItemSerial();
00045         void updateCharSerial( SERIAL ser );
00046         void updateItemSerial( SERIAL ser );
00047         void clear();
00048 
00049 };
00050 
00051 
00052 extern cAllObjects objects;
00053 
00054 class cAllObjectsIter {
00055 
00056 public:
00057 
00058         OBJECT_MAP::iterator curr; //current, can be deleted safaly
00059         OBJECT_MAP::iterator next; //next for save delete of current
00060 
00061 public:
00062 
00063         cAllObjectsIter( );
00064         ~cAllObjectsIter();
00065 
00066         void rewind();
00067         bool IsEmpty();
00068         P_OBJECT getObject();
00069         SERIAL getSerial();
00070 
00071         cAllObjectsIter& operator++(int);          
00072 
00073 };
00074 
00075         
00076 class cAllCharsIter : public cAllObjectsIter{
00077 
00078 private:
00079 
00080 public:
00081 
00082         cAllCharsIter(  );
00083         ~cAllCharsIter();
00084 
00085         void rewind();
00086         bool IsEmpty();
00087         P_CHAR getChar();
00088 
00089         cAllCharsIter& operator++(int);          
00090 
00091 };
00092 
00093 class cAllItemsIter: public cAllObjectsIter {
00094 
00095 private:
00096 
00097 public:
00098 
00099         cAllItemsIter(  );
00100         ~cAllItemsIter();
00101 
00102         void rewind();
00103         bool IsEmpty();
00104         P_CHAR getItem();
00105 
00106         
00107         cAllItemsIter& operator++(int);          
00108 
00109 };
00110 
00111 namespace archive {
00112 
00113         namespace item
00114         {
00115                 P_ITEM  New( LOGICAL forCopyPurpose = false );
00116         }
00117 
00118         void    deleteItem( P_ITEM pi );
00119         void    deleteItem( SERIAL i );
00120 
00121         namespace character
00122         {
00123                 P_CHAR  New();
00124                 P_CHAR  Instance();
00125                 void    Delete( P_CHAR pc );
00126                 void    Delete( SERIAL k  );
00127         }
00128 }
00129 
00130 
00131 #endif
SourceForge.net Logo