Library Information Management System documentation

Source: Internet
Author: User
Tags bool data structures documentation sort contact form
I. Overview 1. Directory Structure

Document Description 1. Data_structure.h

defines the data structures that are dependent 2. CBook.h

defining the "book" Class 3. Cdata_processor.h

defines the "Data_processor" class for working with data structures 4. CLibrary.h

defines the "Library" class for handling related operations on "book" 5.csearch_book.h

define a lookup class to find a book in the way required 6. CSort.h

define sorting classes to sort books in a variety of ways 7. CInitializer.h

defines the Initialize class, which handles the read of files on the hard disk into memory 8. CLogFile.h

defines the "log file" class, which is responsible for recording events during software operation 9. Clogin_out.h

responsible for regular user and administrator login log out Operation Ten. Comp_functions.h

Custom comparison function, passed to Std::sort as an imitation function finder_structures.h.

custom structure, passed to std::find_if as an imitation function CPassword.h.

takes care of the need to "*" When a user enters a password time_struct.h.

responsible for acquiring system time

The above file, the CPP file with the same name is its specific implementation 2. Dependent data Structures (1) some macro definitions

Here are the code slices//some macro defination
#define BOOK_ID int//id of a book (library number)
#define Book_title string//title of a books (title)
#define AUTH_NAME string//author ' s Name (author)
#define CLASSIFY_ID string//(class number)
#define PUB_DEP string//publish Department (publishing house)
#define PUB_TIM String//the Publishing time of a book (publication date)
#define AUTH_PUB string//a Publish  department, which publish one author's book (published by a publisher of all books of an author)
#define Pub_auth string//all author belongs to the Publish Department (all contracted authors of a society)
#define Book_price float//(price)
#define AUTH_COMM_ADD String//add is the method can con Nect with the author (author contact form)
#define PUB_COMM_ADD String//the method you can connect with the publish Department
   #define SEAR_FREQ int//the Search Frequency of a book
#define surplus int//the residue of a book
#define Stat US bool//the status of a book
#define BOR_TIM int//the longest time of a book can be borrowed

In the program, the relevant information of a book is stored as a structure, and the structure is defined as follows:

Defination of book struct sbook{Sbook () {} sbook (surplus Sur, sear_freq Freq, book_id b ID, book_title tit, auth_name Name, classify_id CID, PUB_DEP Pub, Book_price Price , Pub_tim time, Bor_tim btime=0, Status state=false, Sbook * pt = nullptr): B_sur Plus (sur), s_freq (Freq), b_id (BID), b_tit (Tit), A_name (Name), c_id (CID), P_DEP (pub), B_pri (Price), P_tim (time), Isborrow (state), B_time (btime), Pnext_book (PT) {} BOOL operator < (const Sbook & book) {return B_surplus < Boo K.b_surplus; } Surplus b_surplus;//Remaining amount sear_freq s_freq; (Find frequency) book_id b_id; (bibliography number) Book_title b_tit; (title) Auth_name A_name; (author name) classify_id c_id; (classification number) PUB_DEP P_DEP; (publisher name) Book_price B_pri; (price) Pub_tim p_tim;//(publication date) Status isborrow;//(whether borrowed) Bor_tim b_time;//the longest borrowing time list<sbook> Book_ls; Construct Classify_tree};

It contains properties that some books must contain, such as "title", "Author", and so on, including a constructor to initialize the newly declared book, and an overloaded "<" to compare the relationships of the two "books" structures.

In addition to the "book" Structure, there is "Author" structure, "SPUBLISH_DEP" structure, respectively, to define the "author" and "publisher" type.

In addition, one of the most important data structures in the program, namely Classify_tree, is defined in the present document, which is highlighted below Classify_tree

The so-called "Classify_tree", is a vector containing four linked list head nodes, because its structure resembles a tree, and play the role of classification, it is called "Classify_tree", that is, "classification tree." The function in this program is to improve the search efficiency.

As shown, if you encounter a book with the same title, but its author name, publisher, or other attributes are not at the same time (this is very common in the library), by invoking an interface defined in the Data_processor class, you can add the classification tree as shown in the figure.

If there is no such tree, and all the books are stored in a linked list, then in the "title" to find, you need to traverse the entire list to ensure that all the same title of the book are all found, if the book is only one and in the position near the head node, then all subsequent traversal is a waste of time. When the collection is small, it may not be possible, but the huge amount of books and the need for the search operations to be frequent, the huge gap in time will manifest.

In addition, the program for the search function has also done other aspects of optimization, in the Csearch_book.h header file, added a vector cache, the high-frequency search books are cached, in each search process, the cache of the book is first traversed, if there is a direct return; Then go to the classification tree to find it.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.