Virtual U.org
Get Personal Training on VU Today
    
Top shadow
 
 register/help
User Name:

Password:

DynArray class Reference
Main Page   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Namespace Members   Compound Members   File Members  

DynArray Class Reference

Wrapper class for dynamic arrays. More...

#include <ODYNARR.H>

Inheritance diagram for DynArray:

Directory DynArrayB GameFileArray NewsArray StuDynArray TaskArray CourseArray DepartmentArray FacultyArray FirmArray MAOPArray SpriteArray StudentArray List of all members.

Public Methods

 DynArray (int, int=DEF_DYNARRAY_BLOCK_SIZE)
 ~DynArray ()
void deinit ()
void resize (int)
void linkin (void *)
void linkin_unique (void *)
void linkout (int=-1)
void update (void *, int=-1)
void insert (void *)
void insert_at (int, void *)
void add_blank (int)
void init_sort (int, char)
void linkin_sort_scan_from_bottom (void *)
void * get ()
void * get (int)
void * get_ptr ()
void * get_ptr (int)
void read (void *)
int check_pos ()
void push (void *)
void pop (void *=0)
void start ()
void end ()
int fwd ()
int bkwd ()
void jump (int)
void go (int)
int recno ()
int size ()
int is_start ()
int is_end ()
int scan_whole (void *)
int scan (void *, int, char, int=0)
int compare (void *, int, char)
void quick_sort (int(*cmpFun)(const void *, const void *))
void bubble_sort (int(*cmpFun)(const void *, const void *))
void clean_up (int *=0)
void free_ptr (void *, int *)
void zap (int resizeFlag=1)
int write_file (File *)
int read_file (File *)

Public Attributes

int ele_num
int block_num
int cur_pos
int last_ele
int ele_size
int sort_offset
char sort_type
char * body_buf

Detailed Description

Wrapper class for dynamic arrays.

Definition at line 34 of file ODYNARR.H.


Constructor & Destructor Documentation

DynArray::DynArray int   ,
int    = DEF_DYNARRAY_BLOCK_SIZE
 

Definition at line 17 of file ODYNARR.CPP.

References block_num, body_buf, cur_pos, ele_num, ele_size, last_ele, mem_add, and sort_offset.

DynArray::~DynArray  
 

Definition at line 34 of file ODYNARR.CPP.

References deinit().


Member Function Documentation

void DynArray::add_blank int   
 

Definition at line 249 of file ODYNARR.CPP.

References block_num, body_buf, cur_pos, ele_num, ele_size, last_ele, and resize().

Referenced by DepartmentArray::read_file(), and DynArrayB::read_ptr_array().

int DynArray::bkwd   [inline]
 

Definition at line 204 of file ODYNARR.H.

References cur_pos.

void DynArray::bubble_sort int(*    cmpFun)(const void *, const void *)
 

Perform a bubble sort on the array.

int(*fcmp)(const void*, const void*) cmpFun = the pointer to the comparsion function

Definition at line 432 of file ODYNARR.CPP.

int DynArray::check_pos  
 

void DynArray::clean_up int *    = 0
 

Definition at line 377 of file ODYNARR.CPP.

References block_num, body_buf, cur_pos, ele_size, free_ptr(), last_ele, and resize().

int DynArray::compare void *   ,
int   ,
char   
 

Definition at line 334 of file ODYNARR.CPP.

References get(), and NULL.

Referenced by scan().

void DynArray::deinit  
 

Reimplemented in DepartmentArray, FirmArray, GameFileArray, NewsArray, StuDynArray, SpriteArray, and TaskArray.

Definition at line 42 of file ODYNARR.CPP.

References body_buf, mem_del, and NULL.

Referenced by ~DynArray().

void DynArray::end   [inline]
 

Definition at line 191 of file ODYNARR.H.

References cur_pos, and last_ele.

Referenced by pop().

void DynArray::free_ptr void *   ,
int *   
 

Definition at line 395 of file ODYNARR.CPP.

References mem_del.

Referenced by clean_up().

int DynArray::fwd   [inline]
 

Definition at line 195 of file ODYNARR.H.

References cur_pos, and last_ele.

void * DynArray::get int    [inline]
 

Definition at line 123 of file ODYNARR.H.

References body_buf, ele_size, last_ele, and NULL.

void * DynArray::get   [inline]
 

Definition at line 116 of file ODYNARR.H.

References body_buf, cur_pos, ele_size, and NULL.

Referenced by StudentArray::add(), FacultyArray::add(), CourseArray::add(), compare(), StudentArray::del(), StudentArray::is_deleted(), FacultyArray::is_deleted(), linkin_sort_scan_from_bottom(), TaskArray::operator[](), StudentArray::operator[](), NewsArray::operator[](), MAOPArray::operator[](), GameFileArray::operator[](), FacultyArray::operator[](), Directory::operator[](), CourseArray::operator[](), read(), scan_whole(), and FacultyRes::summary_report_1().

void * DynArray::get_ptr int    [inline]
 

Definition at line 147 of file ODYNARR.H.

References body_buf, ele_size, last_ele, and NULL.

void * DynArray::get_ptr   [inline]
 

Definition at line 140 of file ODYNARR.H.

References body_buf, cur_pos, ele_size, and NULL.

Referenced by DepartmentArray::add(), StudentArray::del(), SpriteArray::del(), FirmArray::is_deleted(), DepartmentArray::is_deleted(), FirmArray::operator()(), FirmArray::operator[](), DepartmentArray::operator[](), SpriteArray::process(), DepartmentArray::read_file(), DynArrayB::read_ptr_array(), and DynArrayB::write_ptr_array().

void DynArray::go int    [inline]
 

Definition at line 227 of file ODYNARR.H.

References cur_pos, and last_ele.

Referenced by DepartmentArray::read_file(), and DynArrayB::read_ptr_array().

void DynArray::init_sort int    sortOffset,
char    sortType
 

Initialize sorting parameters before using linkin_sort & resort

<int> sortOffset : offset of the sorting variable <char> sortType : SORT_CHAR_PTR = <char*> SORT_CHAR_STR = <char[]> SORT_INT = <int> SORT_SHORT = <short> SORT_CHAR = <char>

Definition at line 516 of file ODYNARR.CPP.

void DynArray::insert void *   
 

Definition at line 141 of file ODYNARR.CPP.

References block_num, body_buf, cur_pos, ele_num, ele_size, last_ele, linkin(), NULL, resize(), and size().

void DynArray::insert_at int   ,
void *   
 

Definition at line 171 of file ODYNARR.CPP.

References block_num, body_buf, ele_num, ele_size, err_when, last_ele, linkin(), NULL, resize(), and size().

Referenced by linkin_sort_scan_from_bottom().

int DynArray::is_end   [inline]
 

Definition at line 248 of file ODYNARR.H.

References cur_pos, and last_ele.

int DynArray::is_start   [inline]
 

Definition at line 244 of file ODYNARR.H.

References cur_pos.

void DynArray::jump int    [inline]
 

Definition at line 217 of file ODYNARR.H.

References cur_pos, and last_ele.

void DynArray::linkin void *   
 

Reimplemented in DynArrayB.

Definition at line 103 of file ODYNARR.CPP.

References block_num, body_buf, cur_pos, ele_num, ele_size, last_ele, NULL, and resize().

Referenced by insert(), insert_at(), linkin_unique(), and push().

void DynArray::linkin_sort_scan_from_bottom void *   
 

Definition at line 540 of file ODYNARR.CPP.

References err_when, get(), insert_at(), last_ele, SORT_CHAR, SORT_CHAR_PTR, SORT_CHAR_STR, SORT_INT, sort_offset, and SORT_SHORT.

void DynArray::linkin_unique void *   
 

Definition at line 122 of file ODYNARR.CPP.

References body_buf, ele_size, last_ele, and linkin().

void DynArray::linkout int    = -1
 

Reimplemented in DynArrayB.

Definition at line 201 of file ODYNARR.CPP.

References block_num, body_buf, cur_pos, ele_num, ele_size, last_ele, and resize().

Referenced by StuDynArray::deinit(), and pop().

void DynArray::pop void *    = 0 [inline]
 

Definition at line 177 of file ODYNARR.H.

References end(), linkout(), and read().

void DynArray::push void *    [inline]
 

Definition at line 171 of file ODYNARR.H.

References linkin().

void DynArray::quick_sort int(*    cmpFun)(const void *, const void *)
 

Perform a quick sort on the array.

int(*fcmp)(const void*, const void*) cmpFun = the pointer to the comparsion function

Definition at line 420 of file ODYNARR.CPP.

void DynArray::read void *    [inline]
 

Definition at line 160 of file ODYNARR.H.

References ele_size, and get().

Referenced by pop().

int DynArray::read_file File   filePtr
 

Read a saved dynamic array from file, it must be saved with write_file()

<File*> readFile = the pointer to the writing file

Return : 1 - read successfully 0 - writing error

Reimplemented in CourseArray, DepartmentArray, DynArrayB, FacultyArray, FirmArray, NewsArray, StudentArray, and TaskArray.

Definition at line 485 of file ODYNARR.CPP.

Referenced by TaskArray::read_file(), and NewsArray::read_file().

int DynArray::recno   [inline]
 

Definition at line 232 of file ODYNARR.H.

References cur_pos.

Referenced by StudentArray::add(), SpriteArray::add(), FacultyArray::add(), DepartmentArray::add(), and CourseArray::add().

void DynArray::resize int   
 

Definition at line 55 of file ODYNARR.CPP.

References body_buf, ele_num, ele_size, and mem_resize.

Referenced by add_blank(), clean_up(), insert(), insert_at(), DynArrayB::linkin(), linkin(), and linkout().

int DynArray::scan void *   ,
int   ,
char   ,
int    = 0
 

Definition at line 304 of file ODYNARR.CPP.

References compare(), cur_pos, and last_ele.

int DynArray::scan_whole void *   
 

Definition at line 273 of file ODYNARR.CPP.

References cur_pos, ele_size, get(), and last_ele.

int DynArray::size   [inline]
 

Definition at line 236 of file ODYNARR.H.

References last_ele.

Referenced by DepartmentArray::calc_course_history(), DepartmentArray::calc_course_pref(), StudentArray::calc_degree_awarded(), DepartmentArray::calc_faculty_student_history(), EnrollRes::calc_student_count(), StuDynArray::deinit(), DepartmentRes::deinit(), DepartmentArray::del(), DepartmentArray::init_research(), insert(), insert_at(), Finance::new_fiscal_year(), TaskArray::next_day(), FacultyArray::next_day(), FacultyArray::next_trimester(), DynArrayB::packed_size(), plagiarism_scandal(), SpriteArray::process(), DepartmentArray::read_file(), DynArrayB::read_ptr_array(), risky_research(), scandal_in_athletics(), FacultyRes::summary_report_1(), FacultyRes::summary_report_2(), PlayerSchool::summary_student_report_1(), StudentArray::update_history(), CourseArray::update_history(), EnrollRes::update_student_intake(), and DynArrayB::write_ptr_array().

void DynArray::start   [inline]
 

Definition at line 187 of file ODYNARR.H.

References cur_pos, and last_ele.

void DynArray::update void *   ,
int    = -1
 

Definition at line 228 of file ODYNARR.CPP.

References body_buf, cur_pos, ele_size, and NULL.

int DynArray::write_file File   filePtr
 

Write current dynamic array into file, read_file() can be used to retrieve it.

<File*> writeFile = the pointer to the writing file

Return : 1 - write successfully 0 - writing error

Reimplemented in CourseArray, DepartmentArray, DynArrayB, FacultyArray, FirmArray, NewsArray, StudentArray, and TaskArray.

Definition at line 462 of file ODYNARR.CPP.

Referenced by TaskArray::write_file(), and NewsArray::write_file().

void DynArray::zap int    resizeFlag = 1
 

Definition at line 82 of file ODYNARR.CPP.

References block_num, body_buf, cur_pos, ele_num, ele_size, last_ele, and mem_resize.

Referenced by StuDynArray::deinit().


Member Data Documentation

int DynArray::block_num
 

Definition at line 38 of file ODYNARR.H.

Referenced by add_blank(), clean_up(), DynArray(), insert(), insert_at(), DynArrayB::linkin(), linkin(), linkout(), and zap().

char* DynArray::body_buf
 

Definition at line 46 of file ODYNARR.H.

Referenced by add_blank(), clean_up(), deinit(), DynArray(), get(), get_ptr(), insert(), insert_at(), DynArrayB::linkin(), linkin(), linkin_unique(), DynArrayB::linkout(), linkout(), resize(), update(), and zap().

int DynArray::cur_pos
 

Definition at line 39 of file ODYNARR.H.

Referenced by add_blank(), bkwd(), clean_up(), DynArray(), end(), fwd(), get(), get_ptr(), go(), insert(), is_end(), is_start(), jump(), DynArrayB::linkin(), linkin(), DynArrayB::linkout(), linkout(), recno(), scan(), scan_whole(), start(), update(), and zap().

int DynArray::ele_num
 

Definition at line 37 of file ODYNARR.H.

Referenced by add_blank(), DynArray(), insert(), insert_at(), DynArrayB::linkin(), linkin(), linkout(), resize(), and zap().

int DynArray::ele_size
 

Definition at line 41 of file ODYNARR.H.

Referenced by add_blank(), clean_up(), DynArray(), get(), get_ptr(), insert(), insert_at(), DynArrayB::linkin(), linkin(), linkin_unique(), DynArrayB::linkout(), linkout(), read(), resize(), scan_whole(), update(), and zap().

int DynArray::last_ele
 

Definition at line 40 of file ODYNARR.H.

Referenced by add_blank(), clean_up(), DynArray(), end(), fwd(), get(), get_ptr(), go(), insert(), insert_at(), is_end(), jump(), DynArrayB::linkin(), linkin(), linkin_sort_scan_from_bottom(), linkin_unique(), DynArrayB::linkout(), linkout(), scan(), scan_whole(), size(), start(), and zap().

int DynArray::sort_offset
 

Definition at line 43 of file ODYNARR.H.

Referenced by DynArray(), and linkin_sort_scan_from_bottom().

char DynArray::sort_type
 

Definition at line 44 of file ODYNARR.H.


The documentation for this class was generated from the following files:
Generated on Fri Aug 23 01:39:06 2002 for VirtualU by doxygen1.2.17