System Design
By Duncan Strand.
Email me about this page
Table of contents.
Software and hardware choice
System Design
File formats
Attributes
Example data
Book
Book_Copies
Author
Book_Author
Publisher
Book_Publisher
Class Diagram
Use cases
Class Methods
Author
Book_Author
Book_Author_node
Author_node
Book
Book_Copies
Book_Copies_node
Book_node
cDate
ISBN
LinkList
Node
Publisher
Book_Publisher
Book_Publisher_node
Publisher_node
ReferenceLibrary
User Interface
Details
Edit record
Appendix A
Appendix B
I have chosen to write this system in C++, because I have previous experience with this language, and find it easier to use than some alternatives like Java, and Visual Basic.
I will be using Borland C++ Builder as the compiler. C++ Builder is similar to programs like Visual Basic and Delphi, in that it allows the programmer to rapidly create GUIs.
The finished program and sample data should be small enough to fit onto a single floppy disk.
The computer will need to be capable of running Windows95.
The proposed Reference Library system needs to store the following details:
Each of these are classes. Each class will need to be able to store more than one item of data (i.e. book needs to be able to store more than one book). This can be achieved using an array, or a linked list. As linked lists allow a varying number of nodes to be stored the system will use linked lists. This means that each of the above classes will need a node. These are:
- Book_node
- Author_node
- Publisher_node
Each node contains attributes relevant to its class. For example the Book_node stores data about the books title. The Book class is responsible for maintaining the list of the book nodes.
As Book, Author and Publisher are all linked lists they share common data and methods, for this reason they inherit these from the LinkList class. The same applies to Book_node, Author_node and Publisher node, except they inherit from the Node class.
An additional 6 classes are needed. There are Book_Author, Book_Copies, and Book_Publisher (and their nodes). The purpose of these lists is to create a link between the original 3 lists.
As many classes store ISBN numbers this will also be a class.
All the linked lists are to be declared in the ReferenceLibrary class. Doing this means that, in theory, the system could be used to store more than one reference library. The ReferenceLibrary class will contain methods for loading and saving the reference library to disk.
List of all the classes in the system:
| Class | Type | Inherits |
| Author | List | LinkList |
| Book_Author | List | LinkList |
| Book_Author_node | Node | Node |
| Author_node | Node | Node |
| Book | List | LinkList |
| Book_Copies | List | LinkList |
| Book_Copies_node | Node | Node |
| Book_node | List | LinkList |
| Date | Data | |
| ISBN | Data | |
| LinkList | List | LinkList |
| Node | Node | Node |
| Publisher | List | LinkList |
| Book_Publisher | List | LinkList |
| Book_Publisher_node | Node | Node |
| Publisher_node | Node | Node |
| ReferenceLibrary | | |
There are two basic choices for a file format, binary or text. Each format has its own advantages and disadvantages:
Text
Advantages
- Portable (aside from CR/LF issues which can be resolved with 3rd party utilities).
- Text can be easily read by humans.
Disadvantages
- Slow to load and save.
- File size. A number like 10,000 takes 5 bytes, in binary only 4 bytes.
- Harder to program.
- User might edit the text file and corrupt the data.
Binary
Advantages
- Quicker to load.
- File size.
- Easier to program.
- User is less likely to edit it.
Disadvantages
- Not portable (variables might be different sizes).
- Its not possible to easily verify the data.
For no other reason than speed the system will use binary files.
Each LinkList class will be have its own methods for loading and saving data. All data will be stored into a single file. The user will be able to select the file, so allowing the user to have more than one reference library.
The format of the file is:
Author list
int Number of nodes in the list.
For each node in the list:
int AuthorCode.
int Length of surname.
char Surname.
int Length of initials.
char initials.
Book_Author
int Number of nodes in the list.
For each node in the list:
int AuthorCode
int Length of ISBN
char ISBN
Book
int Number of nodes in the list
For each node in the list:
int Length of title
char Title
int Length of ISBN
char ISBN
int Year published
Book_Copies
int Number of nodes in the list
For each node in the list:
int Accession
int StateOfRepair
int Day
int Month
int Year
int Length of ISBN
char ISBN
Book_Publisher
int Number of nodes in the list
For each node in the list
int PublisherCode
int Length of ISBN
char ISBN
Publisher
int Number of nodes in the list
For each node in the list
int Length of Name
char Name
int Length of ContactName
char ContactName
int Length of address
char Address
int Length of PostCode
char PostCode
int Length of Telephone
char Telephone
int Length of email
char email
int PublisherCode
The total size of the saved data file will vary according to the amount of data held in the system.
This is a list of all the classes with their attributed. Inherited attributes are shown.
Author
| Attribute | Inherited from | Type | Access | Note |
| last | LinkList | Node | public | |
| head | LinkList | Node | public | |
| current | LinkList | Node | public | |
| searchParameters | | Node | public | Setting the attributes in this node will effect the search results. |
Book_Author
| Attribute | Inherited from | Type | Access | Note |
| last | LinkList | Node | public | |
| head | LinkList | Node | public | |
| current | LinkList | Node | public | |
| searchParameters | | Node | public | Setting the attributes in this node will effect the search results. |
Book_Author_node
| Attribute | Inherited from | Type | Access | Note |
| authorCode | | int | private | Unique to an author |
| ISBN | ISBN | ISBN | public | ISBN# which author wrote. |
| prev | Node | Node | public | |
| succ | Node | Node | public | |
Author_node
| Attribute | Inherited from | Type | Access | Note |
| authorCode | | int | private | Unique to an author |
| initials | | String | private | |
| surname | | String | private | |
| prev | Node | Node | public | |
| succ | Node | Node | public | |
Book
| Attribute | Inherited from | Type | Access | Note |
| last | LinkList | Node | public | |
| head | LinkList | Node | public | |
| current | LinkList | Node | public | |
| searchParameters | | Node | public | Setting the attributes in this node will effect the search results. |
Book_Copies
| Attribute | Inherited from | Type | Access | Note |
| last | LinkList | Node | public | |
| head | LinkList | Node | public | |
| current | LinkList | Node | public | |
| searchParameters | | Node | public | Setting the attributes in this node will effect the search results. |
Book_Copies_node
| Attribute | Inherited from | Type | Access | Note |
| Accession | | int | private | Unique to each copy of a book. |
| ISBN | ISBN | ISBN | public | |
| PurchaseDate | | Date | public | Date book was purchased |
| StateOfRepair | | int | private | Higher the number the better quality. |
| prev | Node | Node | public | |
| succ | Node | Node | public | |
Book_node
| Attribute | Inherited from | Type | Access | Note |
| Title | | String | private | |
| ISBN | | ISBN | public | |
| IssueDate | | Date | public | Date first published. Only the year needs to be set as the exact date is unlikely to be known. |
| Keyword[5] | | String | private | An array of char pointers. |
| prev | Node | Node | public | |
| succ | Node | Node | public | |
Date
| Attribute | Inherited from | Type | Access | Note |
| Day | | int | private | What day in the month it is. |
| Month | | int | private | Months are defined in Date.h. Each month is a number. |
| Year | | int | private | |
ISBN
| Attribute | Inherited from | Type | Access | Note |
| pISBN | | String | private | |
LinkList
| Attribute | Inherited from | Type | Access | Note |
| last | | Node | public | Pointer to the last node in the list. |
| head | | Node | public | Pointer to the first node in the list. |
| current | | Node | public | Points to the current node. |
Node
| Attribute | Inherited from | Type | Access | Note |
| prev | | Node | public | Points to the previous node in the list. |
| succ | | Node | public | Points to the next node in the list. |
Publisher
| Attribute | Inherited from | Type | Access | Note |
| last | LinkList | Node | public | |
| head | LinkList | Node | public | |
| current | LinkList | Node | public | |
| searchParameters | | Node | public | Setting the attributes in this node will effect the search results. |
Book_Publisher
| Attribute | Inherited from | Type | Access | Note |
| last | LinkList | Node | public | |
| head | LinkList | Node | public | |
| current | LinkList | Node | public | |
| searchParameters | | Node | public | Setting the attributes in this node will effect the search results. |
Book_Publisher_node
| Attribute | Inherited from | Type | Access | Note |
| ISBN | | ISBN | public | ISBN# of the book published by publisher. |
| PublisherCode | | int | private | Unique to each publisher |
| prev | | Node | public | |
| succ | | Node | public | |
Publisher_node
| Attribute | Inherited from | Type | Access | Note |
| Address | | String | private | Address of publisher |
| PublisherCode | | int | private | Unique to each publisher |
| ContactName | | String | private | Name of contact |
| Email | | String | private | Email of contact |
| Name | | String | private | Name of publisher |
| PostCode | | String | private | Post code of publisher |
| Telephone | | String | private | Phone# of publisher |
| prev | | Node | public | |
| succ | | Node | public | |
This is some example data showing how the system will store the data. I have only included the attributes needed to show how the system will work.
| Title | ISBN |
| The Little Oxford Dictionary | 0-19-861188-9 |
| Roget's Thesaurus | 0-86288-162-5 |
| The sociology of Health Promotion | 0-415-11647-3 |
| Accession# | ISBN |
| 1 | 0-19-861188-9 |
| 2 | 0-19-861188-9 |
| 3 | 0-86288-162-5 |
| 4 | 0-415-11647-3 |
| Author code | Surname | Initials |
| 1 | Bunton | R |
| 2 | Nettleton | S |
| 3 | Burrows | R |
| 4 | Swannel | J |
| 5 | Ostler | G |
| 6 | Roget | P M |
The ISBN number is not unique, this allows a book to have more than one author. The combination of ISBN and author code is unique.
| ISBN | Author code |
| 0-415-11647-3 | 1 |
| 0-415-11647-3 | 2 |
| 0-415-11647-3 | 3 |
| 0-19-861188-9 | 4 |
| 0-19-861188-9 | 5 |
| 0-86288-162-5 | 6 |
| Publisher code | Name |
| 1 | Routledge |
| 2 | Oxford University Press |
| 3 | Tophi Books |
| ISBN | Publisher code |
| 0-415-11647-3 | 1 |
| 0-19-861188-9 | 2 |
| 0-86288-162-5 | 3 |
A copy of the complete class diagram is included in appendix A. It shows all the classes in the system, and which classes they inherit. Also shown are all the attributes and methods.
The use cases are all in appendix B. Each use case also has an Interaction sequence diagram.
There are uses cases for: - Add a new book.
- Delete book.
- Delete author.
- Change state of repair.
- Display book (by accession).
- Find publisher.
This is a list of all the methods in all the classes. This is all very much still in the planning stage, and many methods may be removed, added or have their functionality changed from what is described here. This will be maintained and updated throughout the programming of the system, and a fully up to date version included in the documentation.
Each method will be presented in the following format. Not all fields are shown for every method.
| NAME | The name of the method and any inputs. |
| FUNCTION | What does the method do. |
| INPUTS | Description of the inputs (if any). |
| RESULTS | What the method returns. |
| EXAMPLE | A short example about calling this method |
| NOTES | Any notes about the method. Possibly come background information as well. |
| SEE ALSO | Other relevant methods. Methods are not shown with any expected arguments unless there are two different methods with the same name. Methods belonging to a different class are show as "class name::method name". |
| NAME | Author() |
| FUNCTION | Allocates the memory needed for searchParameters. |
| NAME | ~Author() |
| FUNCTION | Deconstructs this class. Calls freeList(); Deletes searchParameters |
| NAME | Author_node *addNode( Author_node node ); |
| FUNCTION | Adds a new node to the list of authors. Assigns a new author code to the author. |
| INPUTS | node: Instance of Author_node. Expects that the surname and initials attributes are set to meaning full values. |
| RESULTS | Returns a pointer to the node added to the list. |
| EXAMPLE | Author_node newAuthor; newAuthor.setSurname( "Dow" ); newAuthor.setInitials( "J" ); addNode( newAuthor ); |
| NOTES | This does not check if the author is already in the list. |
| SEE ALSO | LinkList::addToList |
| NAME | Author_node *addNode( Author_node *node ); |
| FUNCTION | See addNode( Author_node node ) |
| INPUTS | node: Pointer to Author_node. Expects that the surname and initials attributes are set to meaning full values. |
| RESULTS | Returns a pointer to the node added to the list. |
| EXAMPLE | Author_node *newAuthor = new Author_node; newAuthor->setSurname( "Dow" ); newAuthor->setInitials( "J" ); addNode( newAuthor ); delete newAuthor; |
| NOTES | This does not check if the author is already in the list. Failure to delete the pointer passed to this method could cause system instability. |
| SEE ALSO | LinkList::addToList |
| NAME | Author_node *findNext(); |
| FUNCTION | Returns the next author that next matches the searchParameters. |
| RESULTS | A pointer to a matching Author_node. If there are no more matches then a NULL is returned. If the search parameters have not been set then NULL is returned. |
| NOTES | Change the attributes in searchParameters to change the search results. |
| SEE ALSO | clearParameters, findAuthor |
| NAME | bool clearParameters(); |
| FUNCTION | Clears all the search parameters. |
| NAME | int getnewAuthorCode(); |
| FUNCTION | Returns a new author code. |
| RESULTS | New author code. |
| NOTES | Assumes that the last node in the author list has the highest author code. It does not check for gaps. For example if author 3 is removed from a system with 5 authors the next author code returned will be 6. |
| NAME | void freeList(); |
| FUNCTION | Deletes the list and all its nodes. |
| INPUTS | Author_node::deleteAll |
| NAME | int saveList( FILE *fh ); |
| FUNCTION | Saves the all the authors to disk. |
| RESULTS | Returns DOS error codes. |
| SEE ALSO | loadList |
| NAME | int loadList(FILE *fh ); |
| FUNCTION | Loads all the author details to memory. |
| RESULTS | Returns DOS error codes. |
| SEE ALSO | saveList |
| NAME | Book_Author(); |
| FUNCTION | Does nothing yet. |
| NAME | ~Book_Author(); |
| FUNCTION | Frees the Book_Author list. |
| NOTES | Free the Book_Author list by calling freeList(); |
| SEE ALSO | freeList |
| NAME | Book_Author_node *addNode( Book_Author_node *node ); |
| FUNCTION | Adds a new node to Book_Author. It expects that node->isbn and node->authorCode to be set. |
| INPUTS | node: A pointer to the node to add to Book_Author. |
| RESULTS | If the node was added successfully a pointer to the node is returned. If it failed then a NULL is returned. |
| EXAMPLE | Book_Author_node *a = new Book_Author_node; a->isbn->setISBN( "0-16598-56-54" ); a->setAuthorCode( "1"); addNode( a ); delete a; |
| NOTES | Checks that the combination of AuthorCode and ISBN are unique. |
| SEE ALSO | isUnique, LinkList::addToList |
| NAME | bool isUnique(char *ISBN, int authorCode ); |
| FUNCTION | Searches through Book_Author to ensure that the combination of ISBN and authorCode is unique. |
| INPUTS | Pointer to a string containing an ISBN number. authorCode: The author code. |
| RESULTS | If the combination is unique then true is returned, if not false. |
| SEE ALSO | addNode |
| NAME | void freeList(); |
| FUNCTION | Frees Book_Author. Deletes all the nodes in the list. |
| SEE ALSO | Book_Author_node::deleteAll |
| NAME | Book_Author_node *findNext(); |
| FUNCTION | Returns the next node that matches the searchParameters. |
| RESULTS | A pointer to the next matching Book_Author_node. NULL if there are no more matches or if the search parameters are empty. |
| NOTES | Change the attributes in searchParameters to change what the search will match. |
| SEE ALSO | clearParameters(); |
| NAME | int saveList( FILE *fh ); |
| FUNCTION | Saves the Book_Author list to disk. |
| INPUTS | fh: A pointer to the already open data file. |
| RESULTS | DOS error codes. |
| SEE ALSO | loadList |
| NAME | int loadList( FILE *fh ); |
| FUNCTION | Loads the Book_Author list from disk. |
| INPUTS | fh: A pointer to the already open data file. |
| RESULTS | DOS error codes. |
| NAME | bool clearParameters(); |
| FUNCTION | Clears all the search parameters. |
| NAME | Book_Author_node(); |
| FUNCTION | Allocates the isbn pointer. |
| RESULTS | If the memory allocation fails the program will exit. |
| NAME | ~Book_Author_node(); |
| FUNCTION | Deconstructs the node. Calls deleteAll() to free all the memory allocated for this node. |
| SEE ALSO | deleteAll |
| NAME | bool setAuthorCode( int newac ); |
| FUNCTION | Sets the authorCode. |
| INPUTS | newac: The number to set the authorCode to. |
| RESULTS | Returns true if the author code was set, false if the author code was not set. |
| EXAMPLE | Book_Author *al = new Book_Author; Book_Author_node *an = new Book_Author_node; // Add some nodes // Set an to a node in the list if( al->isUnique( "0-5468-654-5", 4 ) ) { setAuthorCode( 4 ); } |
| NOTES | Book_Author::isUnique() should be called to ensure that the proposed ISBN/authorCode combination is unique. |
| SEE ALSO | Book_Author::isUnique |
| NAME | int getAuthorCode(); |
| FUNCTION | Returns this nodes authorCode. |
| RESULTS | The author code. |
| SEE ALSO | setAuthorCode |
| NAME | void deleteAll(); |
| FUNCTION | De-allocates all the memory allocates by this node. |
| NAME | Author_node(); |
| FUNCTION | Sets surname and initials to NULL. |
| NAME | Author_node( Author_node *node ); |
| FUNCTION | Sets surname, initials, and author code to those of the node passed. |
| INPUTS | node: Pointer to a node containing details about an author. |
| NOTES | This does not result in an exact copy of the node passed. The prev, and succ pointers remain un-set. |
| NAME | ~Author_node(); |
| FUNCTION | Deconstructs this node. Deletes all the memory allocated for this node. |
| SEE ALSO | deleteAll |
| NAME | char* getSurname(); |
| FUNCTION | Get the authors surname. |
| RESULTS | A pointer to the authors surname. |
| NOTES | Deleting the pointer returned is not a good idea. If this is called before the initials are set then a NULL is returned, so its important to check. |
| SEE ALSO | setSurname, getName |
| NAME | bool setSurname( char *newSurname ); |
| FUNCTION | Set the authors name. |
| INPUTS | newSurname: The string to set the authors name to. |
| RESULTS | true if the surname was set. false if the surname wasn't set. |
| EXAMPLE | Author_node *an = new Author_node; char *s = new char[15]; strcpy( s, "Smith" ); setSurname( s ); delete s; // Other code... delete an; |
| NOTES | If the authors surname has not yet been set this will allocate some memory for it. If the previously allocated memory is not long enough then more is allocated. The string passed is copied, and so the pointer passed is safe to be deleted. |
| SEE ALSO | getSurname |
| NAME | char* getInitials(); |
| FUNCTION | Get the authors initials. |
| RESULTS | A pointer to a string containing the authors initials. |
| NOTES | Deleting the pointer returned is not advised. If this is called before the initials are set then a NULL is returned, so its important to check. |
| SEE ALSO | setInitials, getName |
| NAME | bool setInitials( char *newInitials ); |
| FUNCTION | Sets the authors initials. |
| INPUTS | newInitials: A pointer to a string containing the new initials. |
| RESULTS | Returns true if the initials were set, false if it failed. |
| NOTES | If the authors initials have not yet been set this will allocate some memory for it. If the previously allocated memory is not long enough then more is allocated. The string passed is copied, and so the pointer passed is safe to be deleted. |
| SEE ALSO | getInitials |
| NAME | int getauthorCode(); |
| FUNCTION | Get the author code. |
| RESULTS | An integer containing the authorCode. |
| SEE ALSO | setauthorCode |
| NAME | bool setauthorCode( int newCode ); |
| FUNCTION | Set the author code for this author. |
| INPUTS | newCode: The number to set the authorCode to. |
| RESULTS | Returns true if successfully set, if not then false. |
| NOTES | Does not check if the authorCode is legal (i.e. not already assigned to another author), because of this, this method should only be called once a new author code has been returned from Author::getnewauthorCode. |
| SEE ALSO | getauthorCode |
| NAME | char *getName(); |
| FUNCTION | Get the authors name in the format "<initials>. <surname>". |
| RESULTS | Returns the authors initials and surname in a pointer to a string. |
| NOTES | Once you have finished with the pointer returned you must remember to delete it. |
| SEE ALSO | getInitials, getSurname |
| NAME | void deleteAll(); |
| FUNCTION | Free all memory allocated as part of this node. |
| NAME | Book(); |
| FUNCTION | Does not do anything yet. |
| NAME | ~Book(); |
| FUNCTION | Deconstructs Book and frees the list. |
| NAME | Book_node *addNode( Book_node node ); |
| FUNCTION | Adds a new node to the Book list. |
| INPUTS | node: An instance of Book_node. Title, ISBN, and IssueDate are all expected to be valid data. |
| RESULTS | If successful a pointer to the node added to the list is returned. If unsuccessful NULL is returned. |
| SEE ALSO | addNode( Book_node *node ), LinkList::addToList |
| NAME | Book_node *addNode( Book_node *node ); |
| FUNCTION | Adds a new node to the Book list. |
| INPUTS | node: A pointer to a Book_node. Title, ISBN, and IssueDate are all expected to be valid data. |
| RESULTS | If successful a pointer to the node added to the list is returned. If unsuccessful NULL is returned. |
| SEE ALSO | addNode( Book_node node ), LinkList::addToList |
| NAME | void freeList(); |
| FUNCTION | Free the memory allocated for Book. |
| NAME | Book_node *findNext(); |
| FUNCTION | Returns the next node that matches the searchParameters. |
| RESULTS | A pointer to the next matching Book_node. NULL if there are no more matches or if the search parameters are empty. |
| NOTES | Change the attributes in searchParameters to change what the search will match. |
| SEE ALSO | clearParameters(); |
| NAME | bool clearParameters(); |
| FUNCTION | Clears all the search parameters. |
| NAME | int saveList( FILE *fh ); |
| FUNCTION | Save Book to disk. |
| INPUTS | fh: A pointer to the already opened data file. |
| RESULTS | Returns DOS error codes. |
| SEE ALSO | loadList |
| NAME | int loadList( FILE *fh ); |
| FUNCTION | Load Book from disk. |
| INPUTS | fh: A pointer to the already opened data file. |
| RESULTS | Returns DOS error code. |
| SEE ALSO | saveList |
| NAME | Book_Copies(); |
| FUNCTION | Does not do anything yet. |
| NAME | ~Book_Copies(); |
| FUNCTION | Deconstruct the Book_Copies list and free all its memory, and the delete all the nodes. |
| NAME | Book_Copies_node *addNode( Book_Copies_node node ); |
| FUNCTION | Adds a new node to the Book_Copies. |
| INPUTS | node: An instance to Book_Copies_node. Expects ISBN, PurchaseDate and StateOfRepair to be set. |
| RESULTS | If successful a pointer to the node added to the list. If failed a NULL is returned. |
| SEE ALSO | addNode( Book_Copies_node *node ), LinkList::addToList() |
| NAME | Book_Copies_node *addNode( Book_Copies_node *node ); |
| FUNCTION | Adds a new node to the Book_Copies list. |
| INPUTS | node: Pointer to Book_Copies_node. |
| RESULTS | If successful a pointer to the node added to the list. If failed a NULL is returned. |
| SEE ALSO | addNode( Book_Copies_node node ), LinkList::addToList() |
| NAME | void freeList(); |
| FUNCTION | Frees all the memory allocated for Book_Copies. |
| NAME | Book_Copies_node *findNext(); |
| FUNCTION | Returns the next node that matches the searchParameters |
| RESULTS | A pointer to the next matching Book_Copies_node. NULL if there are no more matches or if the search parameters are empty. |
| NOTES | Change the attributes in searchParameters to change what the search will match. |
| SEE ALSO | clearParameters(); |
| NAME | bool clearParameters(); |
| FUNCTION | Clears all the search parameters. |
| NAME | int saveList(FILE *fh ); |
| FUNCTION | Saves Book_Copies to disk. |
| INPUTS | fh: A pointer to the already opened data file. |
| RESULTS | Returns DOS error codes. |
| SEE ALSO | loadList |
| NAME | int loadList(FILE *fh ); |
| FUNCTION | Loads Book_Copies from disk. |
| INPUTS | fh: A pointer to the already opened data file. |
| RESULTS | Returns DOS error codes. |
| SEE ALSO | saveList |
| NAME | int getNewAccession(); |
| FUNCTION | Returns the next accession number |
| RESULTS | The new accession number. |
| NOTES | Returns the accession number +1 of the last node in the list. |
| NAME | Book_Copies_node(); |
| FUNCTION | Create a new Book_Copies_node for use. Sets the accession number to 0, StateOfRepair to GOOD, and allocates memory for PurchaseDate and isbn. |
| RESULTS | If the memory allocation fails the program will exit. |
| NAME | Book_Copies_node( int newAccession ); |
| FUNCTION | Create a new Book_Copies_node for use. Sets the accession number to the number passed, StateOfRepair to GOOD, and allocates memory for PurchaseDate and isbn. |
| INPUTS | newAccession A number to set the accession number to. Does not check that the accession number is unique. |
| NAME | ~Book_Copies_node(); |
| FUNCTION | Delete the Book_Copies list and all its nodes. |
| NAME | int getAccession(); |
| FUNCTION | Get the accession number of this book. |
| RESULTS | Returns the books accession number. |
| NOTES | Each book state has a #define set in the file "StateOfRepair.h". |
| SEE ALSO | Book_Copies::getNewAccession, StateOfRepair.h |
| NAME | int getStateOfRepair(); |
| FUNCTION | Get the condition of the book. |
| RESULTS | Returns a number indicating the condition of the book. The numbers are: 1 Very poor 2 Poor 3 Ok 4 Good 5 Very good 6 Excellent |
| SEE ALSO | setStateOfRepair |
| NAME | bool setStateOfRepair( int newState ); |
| FUNCTION | Set the books state of repair. |
| INPUTS | newState: A number indicating the condition of the book. (See getStateOfRepair) |
| RESULTS | Returns true if successful, false if not. |
| NOTES | Each book state has a #define set in the file "StateOfRepair.h". |
| SEE ALSO | getStateOfRepair, StateOfRepair.h |
| NAME | void deleteAll(); |
| FUNCTION | Delete all memory allocated for the data in this node. |
| NAME | Book_node(); |
| FUNCTION | Set-up the data for a new Book_node. Sets the Title and Keyword pointers to NULL, and allocates isbn, and PurchaseDate. |
| RESULTS | Program will exit if the memory allocation fails. |
| NAME | ~Book_node(); |
| FUNCTION | Deconstruct this node. Deletes all data allocated for this node. |
| NAME | char *getTitle(); |
| FUNCTION | Get the title of this book. |
| RESULTS | Returns the pointer to a string containing the book title. |
| NOTES | Do not delete the pointer returned. If a copy of the title is needed use: strcpy( dest, Book_node->getTitle() ). |
| SEE ALSO | setTitle |
| NAME | bool setTitle( char *newTitle ); |
| FUNCTION | Set the title of the book. Ensures that the memory allocated for the title is large enough. |
| INPUTS | newTitle: A pointer to a string with the new title for the book. |
| RESULTS | Returns true if the title was successfully set, false if not. |
| SEE ALSO | getTitle |
| NAME | char *getKeyword( int no ); |
| FUNCTION | Returns a keyword |
| INPUTS | no: The keyword number to return. |
| RESULTS | A pointer to the string with the keyword in it. If there is an error NULL is returned. |
| SEE ALSO | setKeyword, replaceKeyword |
| NAME | bool setKeyword( char *newKeyword ); |
| FUNCTION | Sets a keyword. |
| INPUTS | newKeyword: A pointer to a string with the new keyword. |
| RESULTS | true if the keyword was set. false if it couldn't be set. |
| NOTES | Loops through the 5 keywords until an empty one is found and stores the keyword their. If no empty keywords are found the false is returned. |
| SEE ALSO | getKeyword, replaceKeyword |
| NAME | bool replaceKeyword( int no, char *newKeyword ); |
| FUNCTION | Sets a specific keyword, deleting the old one. |
| INPUTS | no: The keyword to replace. NewKeyword: The new keyword. |
| RESULTS | true if the keyword was set. false if it couldn't be set. |
| SEE ALSO | getKeyword, setKeyword |
| NAME | void deleteAll(); |
| FUNCTION | Delete all the memory allocated for this nodes data. |
| NAME | cDate(); |
| FUNCTION | Constructs a new date. Sets the date to January, 1st 1970. |
| NAME | cDate( int newDay, int newMonth, int newYear ); |
| FUNCTION | Constructs a new date. |
| INPUTS | newDay: Set the day to this value. newMonth: Set the month to this value. newYear: Set the year to this value. |
| RESULTS | None. If a value could not be set nothing is returned. |
| NAME | ~cDate(); |
| FUNCTION | Deconstruct the date. Does not do anything yet. |
| NAME | bool setDate( int newDay, int newMonth, int newYear ); |
| FUNCTION | Set the date. |
| INPUTS | newDay: Set the day to this value. newMonth: Set the month to this value. newYear: Set the year to this value. |
| RESULTS | Returns true if the date has been set, false if date has not been set. |
| EXAMPLE | setDate( 31, JANUARY, 1980 ); |
| NOTES | Date.h includes defines for the days of the week, and months. These defines should be used. |
| SEE ALSO | setDay, setMonth, setYear, getDate |
| NAME | bool setDay( int newDay ); |
| FUNCTION | Sets the day. |
| INPUTS | newDay: Set the day to this value. |
| RESULTS | Returns true if set, false if not. |
| SEE ALSO | setDate, getDay |
| NAME | bool setMonth( int newMonth ); |
| FUNCTION | Sets the month. Checks that day is not to high for this month. |
| INPUTS | newMonth: Set the month to this value. |
| RESULTS | true if set, false if day is to high for the proposed month, or if the month is higher than 12. |
| NOTES | Date.h includes #defines for each month, and these should be used. |
| SEE ALSO | setDate, getMonth |
| NAME | bool setYear( int newYear ); |
| FUNCTION | Set the year to this value. |
| INPUTS | newYear: Set the year to this value. |
| RESULTS | Returns true if set, false if not. |
| SEE ALSO | setDate, getYear |
| NAME | int getDay(); |
| FUNCTION | Get the day. |
| RESULTS | The number of the day. |
| SEE ALSO | setDay, getDate |
| NAME | int getMonth(); |
| FUNCTION | Get the month. |
| RESULTS | The number of the month. |
| SEE ALSO | setMonth, getDate |
| NAME | int getYear(); |
| FUNCTION | Get the year. |
| RESULTS | An integer containing the year. |
| SEE ALSO | setYear, getDate |
| NAME | char *getDate(); |
| FUNCTION | Return the date as a string in the format "<day>, <Month>, <Year>". |
| RESULTS | A pointer to a string. Once you have finished with the pointer you should delete it. NULL is returned if there was an error. |
| SEE ALSO | getDay, getMonth, getYear |
| NAME | bool copyDate( cDate *src ); |
| FUNCTION | Copy the date from src. |
| INPUTS | src: A pointer to a date object that is to be copied. |
| RESULTS | true is returned if the copy was successful. false is returned if there was an error . |
| NAME | int compareDate( int cDay, int cMonth, int cYear ); |
| FUNCTION | Compares the date against the date passed. |
| INPUTS | cDay: Day to compare. cMonth: Month to compare. cYear: Year to compare. |
| RESULTS | 1 is returned if the date passed is before this date. 0 is returned if the dates are the same. -1 is returned if the date passed is after this date. |
| SEE ALSO | compareDate( cDate cdate ) |
| NAME | int compareDate( cDate cdate ); |
| FUNCTION | Compares the date against the date passed. |
| INPUTS | cdate: Instance of a date object. |
| RESULTS | 1 is returned if the date passed is before this date. 0 is returned if the dates are the same. -1 is returned if the date passed is after this date. |
| SEE ALSO | int compareDate( int cDay, int cMonth, int cYear ); |
| NAME | ISBN(); |
| FUNCTION | Constructs a ISBN object. Sets the isbn to NULL; |
| NOTES | The pointer to the isbn string is not allocated here. It is allocated by setISBN. |
| NAME | ~ISBN(); |
| FUNCTION | Deconstructs object ISBN. Deletes the pointer to the isbn string. |
| NAME | bool setISBN( char *newISBN ); |
| FUNCTION | Copies the ISBN# passed into ISBN->isbn. |
| INPUTS | newISBN: The new ISBN#. |
| RESULTS | true if the ISBN was set, false if not. |
| NOTES | The amount of memory allocated for the isbn string changes as needed. |
| SEE ALSO | getISBN |
| NAME | char *getISBN(); |
| FUNCTION | Get the isbn#. |
| RESULTS | A pointer to the isbn string. |
| NOTES | Do not delete the returned pointer, as it will be deleted by the system when it has finished with it. |
| SEE ALSO | setISBN |
| NAME | LinkList(); |
| FUNCTION | Construct the LinkList object. Sets current, head, and last to NULL. |
| NAME | ~LinkList(); |
| FUNCTION | Does nothing. |
| NAME | bool IsEmpty(); |
| FUNCTION | Finds out if the list is empty. |
| RESULTS | true if the list is empty, false if its not. |
| NOTES | The list is deemed to be empty if last is NULL. |
| NAME | bool removeNode( Node *node ); |
| FUNCTION | Remove a node from the list. Re-links the list and if necessary resets head, last, and current (to head). |
| INPUTS | A pointer to the node to remove. |
| EXAMPLE | Author_node *an = new Author_node // Give this node some data and add it to the list an->deleteAll(); removeNode( (Node *)an ); |
| NOTES | Any data allocated to the node should be deleted before calling this method. |
| NAME | void addToList( Node *newNode ); |
| FUNCTION | Called when adding a node to a list. Decides if the list is empty or not, and called either addListNotEmpty, or addListEmpty. |
| INPUTS | newNode: The node to add to the list. |
| SEE ALSO | addListNotEmpty, addListEmpty |
| NAME | void addListNotEmpty( Node *newNode ); |
| FUNCTION | Adds a node to a list that is not empty. |
| INPUTS | newNode: The node to add |
| NOTES | This is a private method, and should only be called from addToList |
| SEE ALSO | addListEmpty, addToList |
| NAME | void addListEmpty( Node *newNode ); |
| FUNCTION | Adds a node to a list that is empty. |
| INPUTS | newNode: The node to add |
| NOTES | This is a private method, and should only be called from addToList |
| SEE ALSO | addListNotEmpty, addToList |
| NAME | Node *addNode( Node node ); |
| FUNCTION | Adds a node to the list |
| INPUTS | node: The node to add. |
| RESULTS | A pointer to the node added to the list. |
| NOTES | For reference only, must be overridden by any class inheriting LinkList. This method is private. |
| SEE ALSO | addNode( Node *node ) |
| NAME | Node *addNode( Node *node ); |
| FUNCTION | Adds a node to the list |
| INPUTS | node: The node to add. |
| RESULTS | A pointer to the node added to the list. |
| NOTES | For reference only, must be overridden by any class inheriting LinkList. This method is private. |
| SEE ALSO | addNode( Node node ) |
| NAME | int saveList( FILE *fh ); |
| FUNCTION | Save the list to disk. |
| INPUTS | fh: A pointer to the already opened data file. |
| NOTES | For reference only. Must be overridden by any class inheriting LinkList. This method is private. |
| SEE ALSO | loadList |
| NAME | int loadList( FILE *fh ); |
| FUNCTION | Load the list from disk . |
| INPUTS | fh: A pointer to the already opened data file. |
| NOTES | For reference only. Must be overridden by any class inheriting LinkList. This method is private. |
| SEE ALSO | saveList |
| NAME | void freeList(); |
| FUNCTION | Frees the list, and all the nodes in it. |
| NOTES | For reference only. Must be overridden by any class inheriting LinkList. This method is private. |
| NAME | Node(); |
| FUNCTION | Construct a new node. Sets prev and succ to NULL. |
| NAME | ~Node(); |
| FUNCTION | Delete all the data allocated for node. |
| NAME | void deleteAll(); |
| FUNCTION | Deletes all the data allocated for node. |
| NAME | Publisher(); |
| FUNCTION | Constructs a new Publisher object. |
| NAME | ~Publisher(); |
| FUNCTION | Deconstructs this Publisher object. Deletes all memory allocated for this list and all the nodes in the list. |
| NAME | Publisher_node *addNode( Publisher_node node ); |
| FUNCTION | Adds a new node to the Publisher list. |
| INPUTS | node: An instance of class Publisher_node. It is expected to have, Name, ContactName, Address, PostCode, Telephone, and Email properly set. |
| RESULTS | Returns a pointer to the node added to the list. If the node could not be added a NULL is returned. |
| SEE ALSO | addNode( Publisher_node *node ) |
| NAME | Publisher_node *addNode( Publisher_node *node ); |
| FUNCTION | Adds a new node to the Publisher list. |
| INPUTS | node: A pointer to Publisher_node. It is expected to have, Name, ContactName, Address, PostCode, Telephone, and Email properly set. |
| RESULTS | Returns a pointer to the node added to the list. If it fails then a NULL is returned. |
| SEE ALSO | addNode( Publisher_node node ) |
| NAME | void freeList(); |
| FUNCTION | Deletes the Publisher list. Deletes all the nodes in the list. |
| NAME | Publisher_node *findNext(); |
| FUNCTION | Returns the next node that matches the searchParameters. |
| RESULTS | A pointer to the next matching Publisher_node. NULL if there are no more matches or if the search parameters are empty. |
| NOTES | Change the attributes in searchParameters to change what the search will match. |
| SEE ALSO | clearParameters(); |
| NAME | bool clearParameters(); |
| FUNCTION | Clears all the search parameters. |
| NAME | int getNewPublisherCode(); |
| FUNCTION | Gets a new unique publisher code. |
| RESULTS | The new publisher code. |
| NOTES | Assumes that the last node in the publisher list has the highest author code. It does not check for gaps. For example if publisher 3 is removed from a system with 5 publishers the next publisher code returned will be 6. |
| SEE ALSO | Publisher_node::getPublisherCode, Publisher_node::setPublisherCode |
| NAME | int saveList( FILE *fh ); |
| FUNCTION | Saves the publisher list to disk. |
| INPUTS | fh: A pointer to the already opened data file. |
| NOTES | File format has not yet been decided. |
| SEE ALSO | loadList |
| NAME | int loadList( FILE *fh); |
| FUNCTION | Loads the publisher list from disk. |
| INPUTS | fh: A pointer to the already opened data file. |
| NOTES | File format has not yet been decided. |
| SEE ALSO | saveList |
| NAME | Book_Publisher(); |
| FUNCTION | Constructs the Book_Publisher object. |
| NAME | ~Book_Publisher(); |
| FUNCTION | Deconstructs the Book_Publisher. Deletes all memory allocated for the list and all the nodes in the list. |
| NAME | Book_Publisher_node *addNode( Book_Publisher_node node ); |
| FUNCTION | Adds a node to the Book_Publisher. |
| INPUTS | node: An instance of Book_Publisher_node. The attributes Publisher code and isbn must be set. |
| RESULTS | A pointer to the node added to the list if successful, false if not. |
| SEE ALSO | addNode( Book_Publisher_node *node ) |
| NAME | Book_Publisher_node *addNode( Book_Publisher_node *node ); |
| FUNCTION | Adds a node to the Book_Publisher list. |
| INPUTS | node: A pointer to Book_Publisher_node. The attributes Publisher code and isbn must be set. |
| RESULTS | A pointer to the node added to the list if successful, false if not. |
| SEE ALSO | addNode( Book_Publisher_node node ) |
| NAME | void freeList(); |
| FUNCTION | Deletes the list and all the nodes. |
| NAME | Book_Publisher_node *findNext(); |
| FUNCTION | Returns the next node that matches the searchParameters. |
| RESULTS | A pointer to the next matching Book_Publisher_node. NULL if there are no more matches or if the search parameters are empty. |
| NOTES | Change the attributes in searchParameters to change what the search will match. |
| SEE ALSO | clearParameters(); |
| NAME | bool clearParameters(); |
| FUNCTION | Clears all the search parameters. |
| NAME | int getNewPublisherCode(); |
| FUNCTION | Returns the next PublisherCode. |
| RESULTS | The new PublisherCode. |
| NOTES | Returns the PublisherCode +1 of the last node in the list. |
| NAME | bool isUnique( int PublisherCode, char *isbn ); |
| FUNCTION | Is the combination of publisher code and isbn unique. |
| INPUTS | PublisherCode: The publisher code to check. isbn: A pointer to a string containing the isbn to check. |
| RESULTS | true is the combination is unique, false if not. |
| NAME | int saveList( FILE *fh ); |
| FUNCTION | Save Book_Publisher to disk. |
| INPUTS | fh: A pointer to the already opened data file. |
| NOTES | File format not yet decided. |
| SEE ALSO | loadList |
| NAME | int loadList( FILE *fh ); |
| FUNCTION | Load Book_Publisher from disk. |
| INPUTS | fh: A pointer to the already opened data file. |
| NOTES | File format not yet decided. |
| SEE ALSO | saveList |
| NAME | Book_Publisher_node(); |
| FUNCTION | Constructs a new Book_Publisher_node object. Allocates the memory for isbn. |
| RESULTS | If the allocation for isbn fails then the program will exit. |
| NAME | ~Book_Publisher_node(); |
| FUNCTION | Deconstruct the Book_Publisher_node. Deletes all the data allocated to this node. |
| NAME | int getPublisherCode(); |
| FUNCTION | Get the publisher code for this publisher. |
| RESULTS | This publishers publisher code. |
| SEE ALSO | setPublisherCode |
| NAME | void deleteAll(); |
| FUNCTION | Delete all the data allocated for this node. |
| NAME | Publisher_node(); |
| FUNCTION | Construct this Publisher node. Sets all the pointers to NULL and the publisher code to 0. |
| NAME | Publisher_node::Publisher_node( char *newName, char *newContactName, char *newAddress, char *newPostCode, char *newPhone, char *newemail, int newcode); |
| FUNCTION | Construct this publisher node. |
| INPUTS | newName: This is passed to setName. newContactName: This is passed to setContactName. newAddress: This is passed to setAddress. newPostCode: This is passed to setPostCode. newPhone: This is passed to setTelephone. newemail: This is passed to setemail. newcode: This is passed to setPublisherCode |
| NOTES | If any of these attributes fail to be set then nothing will happen. |
| SEE ALSO | setName, setAddress, setPostCode, setTelephone, setemail, setPublisherCode |
| NAME | Publisher_node( Publisher_node *node ); |
| FUNCTION | Constructs this publisher node. |
| INPUTS | node: This is a pointer to a publisher_node. Name, address, PostCode, Telephone, Email and publisher code should all be set. |
| RESULTS | None, even if an attribute fails to be set properly. |
| NAME | ~Publisher_node(); |
| FUNCTION | Deconstruct this node and delete all the data allocated for it. |
| NAME | char *getPublisherName(); |
| FUNCTION | Get the name of this publisher. |
| RESULTS | Returns the pointer to the string containing the publisher name. Do not delete this pointer. |
| SEE ALSO | setPublisherName |
| NAME | bool setPublisherName( char *newName ); |
| FUNCTION | Set the name of this publisher. Changes the amount of memory allocated for the string as needed. |
| INPUTS | newName: A pointer to a string containing the name of the publisher. |
| RESULTS | true if the name was successfully set, false if not. |
| SEE ALSO | getPublisherName |
| NAME | int getPublisherCode(); |
| FUNCTION | Get the publisher code for this publisher. |
| RESULTS | This publishers publisher code. |
| SEE ALSO | setPublisherCode |
| NAME | char *getContactName(); |
| FUNCTION | Get the name of the contact at this publisher. |
| RESULTS | Returns the pointer to the string containing the contacts name. Do not delete this pointer. |
| SEE ALSO | setContactName |
| NAME | bool setContactName( char *newName ); |
| FUNCTION | Set the name of the contact for this publisher. Changes the amount of memory allocated for the string as needed. |
| INPUTS | newName: A pointer to a string containing the name of contact. |
| RESULTS | true if the name was successfully set, false if not. |
| SEE ALSO | getContactName |
| NAME | char *getAddress(); |
| FUNCTION | Get the address of this publisher. |
| RESULTS | Returns the pointer to the string containing the address of this publisher. Do not delete this pointer. |
| SEE ALSO | setAddress |
| NAME | bool setAddress( char *newAddress ); |
| FUNCTION | Set the address for this publisher. Changes the amount of memory allocated for the string as needed. |
| INPUTS | newAddress: A pointer to a string containing the new address. |
| RESULTS | true if the address was successfully set, false if not. |
| SEE ALSO | getAddress |
| NAME | char *getPostCode(); |
| FUNCTION | Get the post code for this publisher. |
| RESULTS | Returns the pointer to the string containing the post code. Do not delete this pointer. |
| SEE ALSO | setPostCode |
| NAME | bool setPostCode( char *newPostCode ); |
| FUNCTION | Set the post code for this publisher. Changes the amount of memory allocated for the string as needed. |
| INPUTS | newPostCode: A pointer to a string containing the new post code. |
| RESULTS | true if the post code was successfully set, false if not. |
| SEE ALSO | getPostCode |
| NAME | char *getTelephone(); |
| FUNCTION | Get the telephone number of this publisher. |
| RESULTS | Returns the pointer to the string containing the publisher telephone. Do not delete this pointer. |
| SEE ALSO | setTelephone |
| NAME | bool setTelephone( char *newTelephone); |
| FUNCTION | Set the telephone number for this publisher. Changes the amount of memory allocated for the string as needed. |
| INPUTS | newTelephone: A pointer to a string containing the new telephone number. |
| RESULTS | true if the telephone number was successfully set, false if not. |
| SEE ALSO | getTelephone |
| NAME | char *getemail(); |
| FUNCTION | Get the Email address for this publisher. |
| RESULTS | Returns the pointer to the string containing the email address. Do not delete this pointer. |
| SEE ALSO | setemail |
| NAME | bool setemail( char *newemail); |
| FUNCTION | Set the emai address for this publisher. Changes the amount of memory allocated for the string as needed. |
| INPUTS | newemail: A pointer to a string containing the new e-mail address. |
| RESULTS | true if the e-mail was successfully set, false if not. |
| NOTES | Does not check that the format of the e-mail is correct as the format of e-mail address's could change, and may vary upon the e-mail system being used. |
| SEE ALSO | getemail |
| NAME | void deleteAll(); |
| FUNCTION | Delete all the memory allocated for this node. |
| NAME | bool setPublisherCode( int newCode ); |
| FUNCTION | Set the publisher code for this publisher. |
| INPUTS | newCode: The code to set the publisher code to. |
| RESULTS | true if the code was successfully set, false if not. |
| NOTES | You should ensure that this code is unique, by calling Book_Publisher::getNewPublisherCode. |
| SEE ALSO | Book_Publisher::getNewPublisherCode |
| NAME | ReferenceLibrary(); |
| FUNCTION | Create instances for all the linked list classes, Author, Book_Author, Book, Book_Copies, Publisher, and Book_Publisher. |
| RESULTS | If the memory allocation fails then the program exits. |
| NAME | ~ReferenceLibrary(); |
| FUNCTION | Deletes all the linked lists created by the constructor. |
| NAME | int loadLibrary( char *filename ); |
| FUNCTION | Calls methods in all the linked list classes that load data from disk. |
| INPUTS | filename: The name of the file to load. |
| RESULTS | Returns DOS error codes. |
| SEE ALSO | saveLibrary |
| NAME | int saveLibrary( char *filename ); |
| FUNCTION | Calls methods in all the linked list classes that save data to disk. |
| INPUTS | filename: The name of the file to save. |
| RESULTS | Returns DOS error codes. |
| SEE ALSO | loadLibrary |
The user interface will be Windows95 based. The colours used in the interface will be different according to the users configuration.
A basic diagram of a window displayed when the user displays some data. This basic window will be used for displaying records and, search results. Using this window the user will also be able to delete the records.
A list of all matching items is displayed on the right of the window, when the user selects an entry in the list the details are displayed on the left. The details are read only.
The user will be able to perform a search for each detail listed.
The "Back to search" button takes the user to the previous screen so that they can change the search criteria if they want.
Clicking on the delete record button displays a confirmation requestor. This deletes the currently displayed record. For example if a book is being displayed the books entry in the Book_Copies list is removed, and if it was the only copy it entry in the Book list is also removed.
If the user clicks on the Edit record button a new window appears. This window is called "Edit record".
This window is displayed when the user wants to edit an existing record, or create a new one. If a new record is being created then each field contains a default value. If an existing record is being edited the existing data is displayed.
If any changes have been made clicking on the "Done" button asks the user if the want to make the changes, clicking on "Cancel" asks the user if they want to loose their changes (if any).
The fields displayed depends upon what type of record is being created/edited.
I don't currently have Select Enterprise installed, so cannot access the class diagram.
I don't currently have Select Enterprise installed, so cannot access the use cases.