00001 //Filename :: ODYNARRB.H 00002 //Description :: Dynamic Array Object Version B 00003 00004 #ifndef __ODYNARRB_H 00005 #define __ODYNARRB_H 00006 00007 #ifndef __ODYNARR_H 00008 #include <ODYNARR.H> 00009 #endif 00010 00011 //------------ Define Constant -------------// 00012 00013 #define DEFAULT_REUSE_INTERVAL_DAYS 3 00014 00015 //----------- Define variable type -----------// 00016 00017 typedef char* (*CreateEleFP)(); 00018 00019 //--------- Define struct EmptyRoom -----------// 00020 00022 struct EmptyRoom { 00023 short recno; 00024 int deleted_game_date; 00025 }; 00026 00027 //---------- Define class DynArrayB -----------// 00028 00030 class DynArrayB : public DynArray { 00031 public: 00032 EmptyRoom* empty_room_array; 00033 short empty_room_num; // rooms allocated 00034 short empty_room_count; // rooms used 00035 short reuse_interval_days; 00036 00037 public: 00038 DynArrayB(int,int=DEF_DYNARRAY_BLOCK_SIZE,int reuseIntervalDays=0); 00039 ~DynArrayB(); 00040 00041 // packed_size() is the size when the array is packed (deleted record are actually removed) 00042 // packed_recno() is the recno when the array is packed 00043 00044 int packed_size() { return size() - empty_room_count; } 00045 int packed_recno(int); // Given the recno unpacked, it returns the recno packed. 00046 00047 void linkin(void*); 00048 void linkout(int= -1); 00049 void zap(); 00050 00051 int write_file(File*); // Write current dynamic array to file 00052 int read_file(File*); // Read dynamic array from file 00053 00054 int write_empty_room(File*); // Write current dynamic array to file 00055 int read_empty_room(File*); // Read dynamic array from file 00056 00057 int write_ptr_array(File*, int); 00058 int read_ptr_array(File*, int, CreateEleFP); 00059 }; 00060 00061 //---------------------------------------------// 00062 #endif