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


Software and hardware choice

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.


System Design

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:

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:

ClassTypeInherits
AuthorListLinkList
Book_AuthorListLinkList
Book_Author_nodeNodeNode
Author_nodeNodeNode
BookListLinkList
Book_CopiesListLinkList
Book_Copies_nodeNodeNode
Book_nodeListLinkList
DateData 
ISBNData 
LinkListListLinkList
NodeNodeNode
PublisherListLinkList
Book_PublisherListLinkList
Book_Publisher_nodeNodeNode
Publisher_nodeNodeNode
ReferenceLibrary

File formats

There are two basic choices for a file format, binary or text. Each format has its own advantages and disadvantages:

Text

Advantages

Disadvantages

Binary

Advantages

Disadvantages

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.


Attributes

This is a list of all the classes with their attributed. Inherited attributes are shown.

Author

AttributeInherited fromTypeAccessNote
lastLinkListNodepublic 
headLinkListNodepublic 
currentLinkListNodepublic 
searchParametersNodepublicSetting the attributes in this node will effect the search results.

Book_Author

AttributeInherited fromTypeAccessNote
lastLinkListNodepublic 
headLinkListNodepublic 
currentLinkListNodepublic 
searchParametersNodepublicSetting the attributes in this node will effect the search results.

Book_Author_node

AttributeInherited fromTypeAccessNote
authorCode intprivateUnique to an author
ISBNISBNISBNpublicISBN# which author wrote.
prevNodeNodepublic 
succNodeNodepublic 

Author_node

AttributeInherited fromTypeAccessNote
authorCode intprivateUnique to an author
initials Stringprivate 
surname Stringprivate 
prevNodeNodepublic 
succNodeNodepublic 

Book

AttributeInherited fromTypeAccessNote
lastLinkListNodepublic 
headLinkListNodepublic 
currentLinkListNodepublic 
searchParameters NodepublicSetting the attributes in this node will effect the search results.

Book_Copies

AttributeInherited fromTypeAccessNote
lastLinkListNodepublic 
headLinkListNodepublic 
currentLinkListNodepublic 
searchParameters NodepublicSetting the attributes in this node will effect the search results.

Book_Copies_node

AttributeInherited fromTypeAccessNote
Accession intprivateUnique to each copy of a book.
ISBNISBNISBNpublic 
PurchaseDate DatepublicDate book was purchased
StateOfRepair intprivateHigher the number the better quality.
prevNodeNodepublic 
succNodeNodepublic 

Book_node

AttributeInherited fromTypeAccessNote
Title Stringprivate 
ISBN ISBNpublic 
IssueDate DatepublicDate first published. Only the year needs to be set as the exact date is unlikely to be known.
Keyword[5] StringprivateAn array of char pointers.
prevNodeNodepublic 
succNodeNodepublic 

Date

AttributeInherited fromTypeAccessNote
Day intprivateWhat day in the month it is.
Month intprivateMonths are defined in Date.h. Each month is a number.
Year intprivate 

ISBN

AttributeInherited fromTypeAccessNote
pISBN Stringprivate 

LinkList

AttributeInherited fromTypeAccessNote
last NodepublicPointer to the last node in the list.
head NodepublicPointer to the first node in the list.
current NodepublicPoints to the current node.

Node

AttributeInherited fromTypeAccessNote
prev NodepublicPoints to the previous node in the list.
succ NodepublicPoints to the next node in the list.

Publisher

AttributeInherited fromTypeAccessNote
lastLinkListNodepublic 
headLinkListNodepublic 
currentLinkListNodepublic 
searchParameters NodepublicSetting the attributes in this node will effect the search results.

Book_Publisher

AttributeInherited fromTypeAccessNote
lastLinkListNodepublic 
headLinkListNodepublic 
currentLinkListNodepublic 
searchParameters NodepublicSetting the attributes in this node will effect the search results.

Book_Publisher_node

AttributeInherited fromTypeAccessNote
ISBN ISBNpublicISBN# of the book published by publisher.
PublisherCode intprivateUnique to each publisher
prev Nodepublic 
succ Nodepublic 

Publisher_node

AttributeInherited fromTypeAccessNote
Address StringprivateAddress of publisher
PublisherCode intprivateUnique to each publisher
ContactName StringprivateName of contact
Email StringprivateEmail of contact
Name StringprivateName of publisher
PostCode StringprivatePost code of publisher
Telephone StringprivatePhone# of publisher
prev Nodepublic 
succ Nodepublic 

Example data

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.

Book

TitleISBN
The Little Oxford Dictionary0-19-861188-9
Roget's Thesaurus0-86288-162-5
The sociology of Health Promotion0-415-11647-3

Book_Copies

Accession#ISBN
10-19-861188-9
20-19-861188-9
30-86288-162-5
40-415-11647-3

Author

Author codeSurnameInitials
1BuntonR
2NettletonS
3BurrowsR
4SwannelJ
5OstlerG
6RogetP M

Book_Author

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.

ISBNAuthor code
0-415-11647-31
0-415-11647-32
0-415-11647-33
0-19-861188-94
0-19-861188-95
0-86288-162-56

Publisher

Publisher codeName
1Routledge
2Oxford University Press
3Tophi Books

Book_Publisher

ISBNPublisher code
0-415-11647-31
0-19-861188-92
0-86288-162-53

Class Diagram

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.


Use cases

The use cases are all in appendix B. Each use case also has an Interaction sequence diagram.

There are uses cases for: 

Class Methods

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.

NAMEThe name of the method and any inputs.
FUNCTIONWhat does the method do.
INPUTSDescription of the inputs (if any).
RESULTSWhat the method returns.
EXAMPLEA short example about calling this method
NOTESAny notes about the method. Possibly come background information as well.
SEE ALSOOther 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".

Author

NAMEAuthor()
FUNCTIONAllocates the memory needed for searchParameters.
NAME~Author()
FUNCTIONDeconstructs this class. Calls freeList(); Deletes searchParameters
NAMEAuthor_node *addNode( Author_node node );
FUNCTIONAdds a new node to the list of authors. Assigns a new author code to the author.
INPUTSnode:    Instance of Author_node. Expects that the surname and initials attributes are set to meaning full values.
RESULTSReturns a pointer to the node added to the list.
EXAMPLEAuthor_node newAuthor;
newAuthor.setSurname( "Dow" );
newAuthor.setInitials( "J" );
addNode( newAuthor );
NOTESThis does not check if the author is already in the list.
SEE ALSOLinkList::addToList
NAMEAuthor_node *addNode( Author_node *node );
FUNCTIONSee addNode( Author_node node )
INPUTSnode:    Pointer to Author_node. Expects that the surname and initials attributes are set to meaning full values.
RESULTSReturns a pointer to the node added to the list.
EXAMPLEAuthor_node *newAuthor = new Author_node;
newAuthor->setSurname( "Dow" );
newAuthor->setInitials( "J" );
addNode( newAuthor );
delete newAuthor;
NOTESThis 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 ALSOLinkList::addToList
NAMEAuthor_node *findNext();
FUNCTIONReturns the next author that next matches the searchParameters.
RESULTSA 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.
NOTESChange the attributes in searchParameters to change the search results.
SEE ALSOclearParameters, findAuthor
NAMEbool clearParameters();
FUNCTIONClears all the search parameters.
NAMEint getnewAuthorCode();
FUNCTIONReturns a new author code.
RESULTSNew author code.
NOTESAssumes 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.
NAMEvoid freeList();
FUNCTIONDeletes the list and all its nodes.
INPUTSAuthor_node::deleteAll
NAMEint saveList( FILE *fh );
FUNCTIONSaves the all the authors to disk.
RESULTSReturns DOS error codes.
SEE ALSOloadList
NAMEint loadList(FILE *fh );
FUNCTIONLoads all the author details to memory.
RESULTSReturns DOS error codes.
SEE ALSOsaveList

Book_Author

NAMEBook_Author();
FUNCTIONDoes nothing yet.
NAME~Book_Author();
FUNCTIONFrees the Book_Author list.
NOTESFree the Book_Author list by calling freeList();
SEE ALSOfreeList
NAMEBook_Author_node *addNode( Book_Author_node *node );
FUNCTIONAdds a new node to Book_Author. It expects that node->isbn and node->authorCode to be set.
INPUTSnode:    A pointer to the node to add to Book_Author.
RESULTSIf the node was added successfully a pointer to the node is returned. If it failed then a NULL is returned.
EXAMPLEBook_Author_node *a = new Book_Author_node;
a->isbn->setISBN( "0-16598-56-54" );
a->setAuthorCode( "1");
addNode( a );
delete a;
NOTESChecks that the combination of AuthorCode and ISBN are unique.
SEE ALSOisUnique, LinkList::addToList
NAMEbool isUnique(char *ISBN, int authorCode );
FUNCTIONSearches through Book_Author to ensure that the combination of ISBN and authorCode is unique.
INPUTSPointer to a string containing an ISBN number.
authorCode:    The author code.
RESULTSIf the combination is unique then true is returned, if not false.
SEE ALSOaddNode
NAMEvoid freeList();
FUNCTIONFrees Book_Author. Deletes all the nodes in the list.
SEE ALSOBook_Author_node::deleteAll
NAMEBook_Author_node *findNext();
FUNCTIONReturns the next node that matches the searchParameters.
RESULTSA pointer to the next matching Book_Author_node. NULL if there are no more matches or if the search parameters are empty.
NOTESChange the attributes in searchParameters to change what the search will match.
SEE ALSOclearParameters();
NAMEint saveList( FILE *fh );
FUNCTIONSaves the Book_Author list to disk.
INPUTSfh:    A pointer to the already open data file.
RESULTSDOS error codes.
SEE ALSOloadList
NAMEint loadList( FILE *fh );
FUNCTIONLoads the Book_Author list from disk.
INPUTSfh:    A pointer to the already open data file.
RESULTSDOS error codes.
NAMEbool clearParameters();
FUNCTIONClears all the search parameters.

Book_Author_node

NAMEBook_Author_node();
FUNCTIONAllocates the isbn pointer.
RESULTSIf the memory allocation fails the program will exit.
NAME~Book_Author_node();
FUNCTIONDeconstructs the node. Calls deleteAll() to free all the memory allocated for this node.
SEE ALSOdeleteAll
NAMEbool setAuthorCode( int newac );
FUNCTIONSets the authorCode.
INPUTSnewac:    The number to set the authorCode to.
RESULTSReturns true if the author code was set, false if the author code was not set.
EXAMPLEBook_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 );
}
NOTESBook_Author::isUnique() should be called to ensure that the proposed ISBN/authorCode combination is unique.
SEE ALSOBook_Author::isUnique
NAMEint getAuthorCode();
FUNCTIONReturns this nodes authorCode.
RESULTSThe author code.
SEE ALSOsetAuthorCode
NAMEvoid deleteAll();
FUNCTIONDe-allocates all the memory allocates by this node.

Author_node

NAMEAuthor_node();
FUNCTIONSets surname and initials to NULL.
NAMEAuthor_node( Author_node *node );
FUNCTIONSets surname, initials, and author code to those of the node passed.
INPUTSnode:    Pointer to a node containing details about an author.
NOTESThis does not result in an exact copy of the node passed. The prev, and succ pointers remain un-set.
NAME~Author_node();
FUNCTIONDeconstructs this node. Deletes all the memory allocated for this node.
SEE ALSOdeleteAll
NAMEchar* getSurname();
FUNCTIONGet the authors surname.
RESULTSA pointer to the authors surname.
NOTESDeleting 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 ALSOsetSurname, getName
NAMEbool setSurname( char *newSurname );
FUNCTIONSet the authors name.
INPUTSnewSurname:    The string to set the authors name to.
RESULTStrue if the surname was set. false if the surname wasn't set.
EXAMPLEAuthor_node *an = new Author_node;
char *s = new char[15];
strcpy( s, "Smith" );
setSurname( s );
delete s;
// Other code...
delete an;
NOTESIf 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 ALSOgetSurname
NAMEchar* getInitials();
FUNCTIONGet the authors initials.
RESULTSA pointer to a string containing the authors initials.
NOTESDeleting 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 ALSOsetInitials, getName
NAMEbool setInitials( char *newInitials );
FUNCTIONSets the authors initials.
INPUTSnewInitials:    A pointer to a string containing the new initials.
RESULTSReturns true if the initials were set, false if it failed.
NOTESIf 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 ALSOgetInitials
NAMEint getauthorCode();
FUNCTIONGet the author code.
RESULTSAn integer containing the authorCode.
SEE ALSOsetauthorCode
NAMEbool setauthorCode( int newCode );
FUNCTIONSet the author code for this author.
INPUTSnewCode:    The number to set the authorCode to.
RESULTSReturns true if successfully set, if not then false.
NOTESDoes 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 ALSOgetauthorCode
NAMEchar *getName();
FUNCTIONGet the authors name in the format "<initials>. <surname>".
RESULTSReturns the authors initials and surname in a pointer to a string.
NOTESOnce you have finished with the pointer returned you must remember to delete it.
SEE ALSOgetInitials, getSurname
NAMEvoid deleteAll();
FUNCTIONFree all memory allocated as part of this node.

Book

NAMEBook();
FUNCTIONDoes not do anything yet.
NAME~Book();
FUNCTIONDeconstructs Book and frees the list.
NAMEBook_node *addNode( Book_node node );
FUNCTIONAdds a new node to the Book list.
INPUTSnode:     An instance of Book_node. Title, ISBN, and IssueDate are all expected to be valid data.
RESULTSIf successful a pointer to the node added to the list is returned. If unsuccessful NULL is returned.
SEE ALSOaddNode( Book_node *node ), LinkList::addToList
NAMEBook_node *addNode( Book_node *node );
FUNCTIONAdds a new node to the Book list.
INPUTSnode:    A pointer to a Book_node. Title, ISBN, and IssueDate are all expected to be valid data.
RESULTSIf successful a pointer to the node added to the list is returned. If unsuccessful NULL is returned.
SEE ALSOaddNode( Book_node node ), LinkList::addToList
NAMEvoid freeList();
FUNCTIONFree the memory allocated for Book.
NAMEBook_node *findNext();
FUNCTIONReturns the next node that matches the searchParameters.
RESULTSA pointer to the next matching Book_node.
NULL if there are no more matches or if the search parameters are empty.
NOTESChange the attributes in searchParameters to change what the search will match.
SEE ALSOclearParameters();
NAMEbool clearParameters();
FUNCTIONClears all the search parameters.
NAMEint saveList( FILE *fh );
FUNCTIONSave Book to disk.
INPUTSfh:    A pointer to the already opened data file.
RESULTSReturns DOS error codes.
SEE ALSOloadList
NAMEint loadList( FILE *fh );
FUNCTIONLoad Book from disk.
INPUTSfh:    A pointer to the already opened data file.
RESULTSReturns DOS error code.
SEE ALSOsaveList

Book_Copies

NAMEBook_Copies();
FUNCTIONDoes not do anything yet.
NAME~Book_Copies();
FUNCTIONDeconstruct the Book_Copies list and free all its memory, and the delete all the nodes.
NAMEBook_Copies_node *addNode( Book_Copies_node node );
FUNCTIONAdds a new node to the Book_Copies.
INPUTSnode:    An instance to Book_Copies_node. Expects ISBN, PurchaseDate and StateOfRepair to be set.
RESULTSIf successful a pointer to the node added to the list. If failed a NULL is returned.
SEE ALSOaddNode( Book_Copies_node *node ), LinkList::addToList()
NAMEBook_Copies_node *addNode( Book_Copies_node *node );
FUNCTIONAdds a new node to the Book_Copies list.
INPUTSnode:    Pointer to Book_Copies_node.
RESULTSIf successful a pointer to the node added to the list. If failed a NULL is returned.
SEE ALSOaddNode( Book_Copies_node node ), LinkList::addToList()
NAMEvoid freeList();
FUNCTIONFrees all the memory allocated for Book_Copies.
NAMEBook_Copies_node *findNext();
FUNCTIONReturns the next node that matches the searchParameters
RESULTSA pointer to the next matching Book_Copies_node.
NULL if there are no more matches or if the search parameters are empty.
NOTESChange the attributes in searchParameters to change what the search will match.
SEE ALSOclearParameters();
NAMEbool clearParameters();
FUNCTIONClears all the search parameters.
NAMEint saveList(FILE *fh );
FUNCTIONSaves Book_Copies to disk.
INPUTSfh:    A pointer to the already opened data file.
RESULTSReturns DOS error codes.
SEE ALSOloadList
NAMEint loadList(FILE *fh );
FUNCTIONLoads Book_Copies from disk.
INPUTSfh:    A pointer to the already opened data file.
RESULTSReturns DOS error codes.
SEE ALSOsaveList
NAMEint getNewAccession();
FUNCTIONReturns the next accession number
RESULTSThe new accession number.
NOTESReturns the accession number +1 of the last node in the list.

Book_Copies_node

NAMEBook_Copies_node();
FUNCTIONCreate a new Book_Copies_node for use. Sets the accession number to 0, StateOfRepair to GOOD, and allocates memory for PurchaseDate and isbn.
RESULTSIf the memory allocation fails the program will exit.
NAMEBook_Copies_node( int newAccession );
FUNCTIONCreate 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.
INPUTSnewAccession A number to set the accession number to. Does not check that the accession number is unique.
NAME~Book_Copies_node();
FUNCTIONDelete the Book_Copies list and all its nodes.
NAMEint getAccession();
FUNCTIONGet the accession number of this book.
RESULTSReturns the books accession number.
NOTESEach book state has a #define set in the file "StateOfRepair.h".
SEE ALSOBook_Copies::getNewAccession, StateOfRepair.h
NAMEint getStateOfRepair();
FUNCTIONGet the condition of the book.
RESULTSReturns 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 ALSOsetStateOfRepair
NAMEbool setStateOfRepair( int newState );
FUNCTIONSet the books state of repair.
INPUTSnewState:    A number indicating the condition of the book. (See getStateOfRepair)
RESULTSReturns true if successful, false if not.
NOTESEach book state has a #define set in the file "StateOfRepair.h".
SEE ALSOgetStateOfRepair, StateOfRepair.h
NAMEvoid deleteAll();
FUNCTIONDelete all memory allocated for the data in this node.

Book_node

NAMEBook_node();
FUNCTIONSet-up the data for a new Book_node. Sets the Title and Keyword pointers to NULL, and allocates isbn, and PurchaseDate.
RESULTSProgram will exit if the memory allocation fails.
NAME~Book_node();
FUNCTIONDeconstruct this node. Deletes all data allocated for this node.
NAMEchar *getTitle();
FUNCTIONGet the title of this book.
RESULTSReturns the pointer to a string containing the book title.
NOTESDo not delete the pointer returned. If a copy of the title is needed use: strcpy( dest, Book_node->getTitle() ).
SEE ALSOsetTitle
NAMEbool setTitle( char *newTitle );
FUNCTIONSet the title of the book. Ensures that the memory allocated for the title is large enough.
INPUTSnewTitle:    A pointer to a string with the new title for the book.
RESULTSReturns true if the title was successfully set, false if not.
SEE ALSOgetTitle
NAMEchar *getKeyword( int no );
FUNCTIONReturns a keyword
INPUTSno:    The keyword number to return.
RESULTSA pointer to the string with the keyword in it. If there is an error NULL is returned.
SEE ALSOsetKeyword, replaceKeyword
NAMEbool setKeyword( char *newKeyword );
FUNCTIONSets a keyword.
INPUTSnewKeyword:    A pointer to a string with the new keyword.
RESULTStrue if the keyword was set. false if it couldn't be set.
NOTESLoops 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 ALSOgetKeyword, replaceKeyword
NAMEbool replaceKeyword( int no, char *newKeyword );
FUNCTIONSets a specific keyword, deleting the old one.
INPUTSno:    The keyword to replace.
NewKeyword:    The new keyword.
RESULTStrue if the keyword was set. false if it couldn't be set.
SEE ALSOgetKeyword, setKeyword
NAMEvoid deleteAll();
FUNCTIONDelete all the memory allocated for this nodes data.

cDate

NAMEcDate();
FUNCTIONConstructs a new date. Sets the date to January, 1st 1970.
NAMEcDate( int newDay, int newMonth, int newYear );
FUNCTIONConstructs a new date.
INPUTSnewDay:    Set the day to this value.
newMonth:    Set the month to this value.
newYear:    Set the year to this value.
RESULTSNone. If a value could not be set nothing is returned.
NAME~cDate();
FUNCTIONDeconstruct the date. Does not do anything yet.
NAMEbool setDate( int newDay, int newMonth, int newYear );
FUNCTIONSet the date.
INPUTSnewDay:   Set the day to this value.
newMonth:   Set the month to this value.
newYear:   Set the year to this value.
RESULTSReturns true if the date has been set, false if date has not been set.
EXAMPLEsetDate( 31, JANUARY, 1980 );
NOTESDate.h includes defines for the days of the week, and months. These defines should be used.
SEE ALSOsetDay, setMonth, setYear, getDate
NAMEbool setDay( int newDay );
FUNCTIONSets the day.
INPUTSnewDay:    Set the day to this value.
RESULTSReturns true if set, false if not.
SEE ALSOsetDate, getDay
NAMEbool setMonth( int newMonth );
FUNCTIONSets the month. Checks that day is not to high for this month.
INPUTSnewMonth:    Set the month to this value.
RESULTStrue if set, false if day is to high for the proposed month, or if the month is higher than 12.
NOTESDate.h includes #defines for each month, and these should be used.
SEE ALSOsetDate, getMonth
NAMEbool setYear( int newYear );
FUNCTIONSet the year to this value.
INPUTSnewYear:    Set the year to this value.
RESULTSReturns true if set, false if not.
SEE ALSOsetDate, getYear
NAMEint getDay();
FUNCTIONGet the day.
RESULTSThe number of the day.
SEE ALSOsetDay, getDate
NAMEint getMonth();
FUNCTIONGet the month.
RESULTSThe number of the month.
SEE ALSOsetMonth, getDate
NAMEint getYear();
FUNCTIONGet the year.
RESULTSAn integer containing the year.
SEE ALSOsetYear, getDate
NAMEchar *getDate();
FUNCTIONReturn the date as a string in the format "<day>, <Month>, <Year>".
RESULTSA pointer to a string. Once you have finished with the pointer you should delete it. NULL is returned if there was an error.
SEE ALSOgetDay, getMonth, getYear
NAMEbool copyDate( cDate *src );
FUNCTIONCopy the date from src.
INPUTSsrc:    A pointer to a date object that is to be copied.
RESULTStrue is returned if the copy was successful. false is returned if there was an error .
NAMEint compareDate( int cDay, int cMonth, int cYear );
FUNCTIONCompares the date against the date passed.
INPUTScDay:    Day to compare.
cMonth:    Month to compare.
cYear:    Year to compare.
RESULTS1 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 ALSOcompareDate( cDate cdate )
NAMEint compareDate( cDate cdate );
FUNCTIONCompares the date against the date passed.
INPUTScdate:    Instance of a date object.
RESULTS1 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 ALSOint compareDate( int cDay, int cMonth, int cYear );

ISBN

NAMEISBN();
FUNCTIONConstructs a ISBN object. Sets the isbn to NULL;
NOTESThe pointer to the isbn string is not allocated here. It is allocated by setISBN.
NAME~ISBN();
FUNCTIONDeconstructs object ISBN. Deletes the pointer to the isbn string.
NAMEbool setISBN( char *newISBN );
FUNCTIONCopies the ISBN# passed into ISBN->isbn.
INPUTSnewISBN:    The new ISBN#.
RESULTStrue if the ISBN was set, false if not.
NOTESThe amount of memory allocated for the isbn string changes as needed.
SEE ALSOgetISBN
NAMEchar *getISBN();
FUNCTIONGet the isbn#.
RESULTSA pointer to the isbn string.
NOTESDo not delete the returned pointer, as it will be deleted by the system when it has finished with it.
SEE ALSOsetISBN

LinkList

NAMELinkList();
FUNCTIONConstruct the LinkList object. Sets current, head, and last to NULL.
NAME~LinkList();
FUNCTIONDoes nothing.
NAMEbool IsEmpty();
FUNCTIONFinds out if the list is empty.
RESULTStrue if the list is empty, false if its not.
NOTESThe list is deemed to be empty if last is NULL.
NAMEbool removeNode( Node *node );
FUNCTIONRemove a node from the list. Re-links the list and if necessary resets head, last, and current (to head).
INPUTSA pointer to the node to remove.
EXAMPLEAuthor_node *an = new Author_node
// Give this node some data and add it to the list
an->deleteAll();
removeNode( (Node *)an );
NOTESAny data allocated to the node should be deleted before calling this method.
NAMEvoid addToList( Node *newNode );
FUNCTIONCalled when adding a node to a list. Decides if the list is empty or not, and called either addListNotEmpty, or addListEmpty.
INPUTSnewNode:    The node to add to the list.
SEE ALSOaddListNotEmpty, addListEmpty
NAMEvoid addListNotEmpty( Node *newNode );
FUNCTIONAdds a node to a list that is not empty.
INPUTSnewNode:    The node to add
NOTESThis is a private method, and should only be called from addToList
SEE ALSOaddListEmpty, addToList
NAMEvoid addListEmpty( Node *newNode );
FUNCTIONAdds a node to a list that is empty.
INPUTSnewNode:    The node to add
NOTESThis is a private method, and should only be called from addToList
SEE ALSOaddListNotEmpty, addToList
NAMENode *addNode( Node node );
FUNCTIONAdds a node to the list
INPUTSnode:    The node to add.
RESULTSA pointer to the node added to the list.
NOTESFor reference only, must be overridden by any class inheriting LinkList. This method is private.
SEE ALSOaddNode( Node *node )
NAMENode *addNode( Node *node );
FUNCTIONAdds a node to the list
INPUTSnode:    The node to add.
RESULTSA pointer to the node added to the list.
NOTESFor reference only, must be overridden by any class inheriting LinkList. This method is private.
SEE ALSOaddNode( Node node )
NAMEint saveList( FILE *fh );
FUNCTIONSave the list to disk.
INPUTSfh:    A pointer to the already opened data file.
NOTESFor reference only. Must be overridden by any class inheriting LinkList. This method is private.
SEE ALSOloadList
NAMEint loadList( FILE *fh );
FUNCTIONLoad the list from disk .
INPUTSfh:    A pointer to the already opened data file.
NOTESFor reference only. Must be overridden by any class inheriting LinkList. This method is private.
SEE ALSOsaveList
NAMEvoid freeList();
FUNCTIONFrees the list, and all the nodes in it.
NOTESFor reference only. Must be overridden by any class inheriting LinkList. This method is private.

Node

NAMENode();
FUNCTIONConstruct a new node. Sets prev and succ to NULL.
NAME~Node();
FUNCTIONDelete all the data allocated for node.
NAMEvoid deleteAll();
FUNCTIONDeletes all the data allocated for node.

Publisher

NAMEPublisher();
FUNCTIONConstructs a new Publisher object.
NAME~Publisher();
FUNCTIONDeconstructs this Publisher object. Deletes all memory allocated for this list and all the nodes in the list.
NAMEPublisher_node *addNode( Publisher_node node );
FUNCTIONAdds a new node to the Publisher list.
INPUTSnode:    An instance of class Publisher_node. It is expected to have, Name, ContactName, Address, PostCode, Telephone, and Email properly set.
RESULTSReturns a pointer to the node added to the list. If the node could not be added a NULL is returned.
SEE ALSOaddNode( Publisher_node *node )
NAMEPublisher_node *addNode( Publisher_node *node );
FUNCTIONAdds a new node to the Publisher list.
INPUTSnode:    A pointer to Publisher_node. It is expected to have, Name, ContactName, Address, PostCode, Telephone, and Email properly set.
RESULTSReturns a pointer to the node added to the list. If it fails then a NULL is returned.
SEE ALSOaddNode( Publisher_node node )
NAMEvoid freeList();
FUNCTIONDeletes the Publisher list. Deletes all the nodes in the list.
NAMEPublisher_node *findNext();
FUNCTIONReturns the next node that matches the searchParameters.
RESULTSA pointer to the next matching Publisher_node.
NULL if there are no more matches or if the search parameters are empty.
NOTESChange the attributes in searchParameters to change what the search will match.
SEE ALSOclearParameters();
NAMEbool clearParameters();
FUNCTIONClears all the search parameters.
NAMEint getNewPublisherCode();
FUNCTIONGets a new unique publisher code.
RESULTSThe new publisher code.
NOTESAssumes 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 ALSOPublisher_node::getPublisherCode, Publisher_node::setPublisherCode
NAMEint saveList( FILE *fh );
FUNCTIONSaves the publisher list to disk.
INPUTSfh:    A pointer to the already opened data file.
NOTESFile format has not yet been decided.
SEE ALSOloadList
NAMEint loadList( FILE *fh);
FUNCTIONLoads the publisher list from disk.
INPUTSfh:    A pointer to the already opened data file.
NOTESFile format has not yet been decided.
SEE ALSOsaveList

Book_Publisher

NAMEBook_Publisher();
FUNCTIONConstructs the Book_Publisher object.
NAME~Book_Publisher();
FUNCTIONDeconstructs the Book_Publisher. Deletes all memory allocated for the list and all the nodes in the list.
NAMEBook_Publisher_node *addNode( Book_Publisher_node node );
FUNCTIONAdds a node to the Book_Publisher.
INPUTSnode:    An instance of Book_Publisher_node. The attributes Publisher code and isbn must be set.
RESULTSA pointer to the node added to the list if successful, false if not.
SEE ALSOaddNode( Book_Publisher_node *node )
NAMEBook_Publisher_node *addNode( Book_Publisher_node *node );
FUNCTIONAdds a node to the Book_Publisher list.
INPUTSnode:    A pointer to Book_Publisher_node. The attributes Publisher code and isbn must be set.
RESULTSA pointer to the node added to the list if successful, false if not.
SEE ALSOaddNode( Book_Publisher_node node )
NAMEvoid freeList();
FUNCTIONDeletes the list and all the nodes.
NAMEBook_Publisher_node *findNext();
FUNCTIONReturns the next node that matches the searchParameters.
RESULTSA pointer to the next matching Book_Publisher_node.
NULL if there are no more matches or if the search parameters are empty.
NOTESChange the attributes in searchParameters to change what the search will match.
SEE ALSOclearParameters();
NAMEbool clearParameters();
FUNCTIONClears all the search parameters.
NAMEint getNewPublisherCode();
FUNCTIONReturns the next PublisherCode.
RESULTSThe new PublisherCode.
NOTESReturns the PublisherCode +1 of the last node in the list.
NAMEbool isUnique( int PublisherCode, char *isbn );
FUNCTIONIs the combination of publisher code and isbn unique.
INPUTSPublisherCode:    The publisher code to check.
isbn:    A pointer to a string containing the isbn to check.
RESULTStrue is the combination is unique, false if not.
NAMEint saveList( FILE *fh );
FUNCTIONSave Book_Publisher to disk.
INPUTSfh:    A pointer to the already opened data file.
NOTESFile format not yet decided.
SEE ALSOloadList
NAMEint loadList( FILE *fh );
FUNCTIONLoad Book_Publisher from disk.
INPUTSfh:    A pointer to the already opened data file.
NOTESFile format not yet decided.
SEE ALSOsaveList

Book_Publisher_node

NAMEBook_Publisher_node();
FUNCTIONConstructs a new Book_Publisher_node object. Allocates the memory for isbn.
RESULTSIf the allocation for isbn fails then the program will exit.
NAME~Book_Publisher_node();
FUNCTIONDeconstruct the Book_Publisher_node. Deletes all the data allocated to this node.
NAMEint getPublisherCode();
FUNCTIONGet the publisher code for this publisher.
RESULTSThis publishers publisher code.
SEE ALSOsetPublisherCode
NAMEvoid deleteAll();
FUNCTIONDelete all the data allocated for this node.

Publisher_node

NAMEPublisher_node();
FUNCTIONConstruct this Publisher node. Sets all the pointers to NULL and the publisher code to 0.
NAMEPublisher_node::Publisher_node( char *newName, char *newContactName, char *newAddress, char *newPostCode, char *newPhone, char *newemail, int newcode);
FUNCTIONConstruct this publisher node.
INPUTSnewName:    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
NOTESIf any of these attributes fail to be set then nothing will happen.
SEE ALSOsetName, setAddress, setPostCode, setTelephone, setemail, setPublisherCode
NAMEPublisher_node( Publisher_node *node );
FUNCTIONConstructs this publisher node.
INPUTSnode:    This is a pointer to a publisher_node. Name, address, PostCode, Telephone, Email and publisher code should all be set.
RESULTSNone, even if an attribute fails to be set properly.
NAME~Publisher_node();
FUNCTIONDeconstruct this node and delete all the data allocated for it.
NAMEchar *getPublisherName();
FUNCTIONGet the name of this publisher.
RESULTSReturns the pointer to the string containing the publisher name. Do not delete this pointer.
SEE ALSOsetPublisherName
NAMEbool setPublisherName( char *newName );
FUNCTIONSet the name of this publisher. Changes the amount of memory allocated for the string as needed.
INPUTSnewName:    A pointer to a string containing the name of the publisher.
RESULTStrue if the name was successfully set, false if not.
SEE ALSOgetPublisherName
NAMEint getPublisherCode();
FUNCTIONGet the publisher code for this publisher.
RESULTSThis publishers publisher code.
SEE ALSOsetPublisherCode
NAMEchar *getContactName();
FUNCTIONGet the name of the contact at this publisher.
RESULTSReturns the pointer to the string containing the contacts name. Do not delete this pointer.
SEE ALSOsetContactName
NAMEbool setContactName( char *newName );
FUNCTIONSet the name of the contact for this publisher. Changes the amount of memory allocated for the string as needed.
INPUTSnewName:    A pointer to a string containing the name of contact.
RESULTStrue if the name was successfully set, false if not.
SEE ALSOgetContactName
NAMEchar *getAddress();
FUNCTIONGet the address of this publisher.
RESULTSReturns the pointer to the string containing the address of this publisher. Do not delete this pointer.
SEE ALSOsetAddress
NAMEbool setAddress( char *newAddress );
FUNCTIONSet the address for this publisher. Changes the amount of memory allocated for the string as needed.
INPUTSnewAddress:    A pointer to a string containing the new address.
RESULTStrue if the address was successfully set, false if not.
SEE ALSOgetAddress
NAMEchar *getPostCode();
FUNCTIONGet the post code for this publisher.
RESULTSReturns the pointer to the string containing the post code. Do not delete this pointer.
SEE ALSOsetPostCode
NAMEbool setPostCode( char *newPostCode );
FUNCTIONSet the post code for this publisher. Changes the amount of memory allocated for the string as needed.
INPUTSnewPostCode:    A pointer to a string containing the new post code.
RESULTStrue if the post code was successfully set, false if not.
SEE ALSOgetPostCode
NAMEchar *getTelephone();
FUNCTIONGet the telephone number of this publisher.
RESULTSReturns the pointer to the string containing the publisher telephone. Do not delete this pointer.
SEE ALSOsetTelephone
NAMEbool setTelephone( char *newTelephone);
FUNCTIONSet the telephone number for this publisher. Changes the amount of memory allocated for the string as needed.
INPUTSnewTelephone:    A pointer to a string containing the new telephone number.
RESULTStrue if the telephone number was successfully set, false if not.
SEE ALSOgetTelephone
NAMEchar *getemail();
FUNCTIONGet the Email address for this publisher.
RESULTSReturns the pointer to the string containing the email address. Do not delete this pointer.
SEE ALSOsetemail
NAMEbool setemail( char *newemail);
FUNCTIONSet the emai address for this publisher. Changes the amount of memory allocated for the string as needed.
INPUTSnewemail:    A pointer to a string containing the new e-mail address.
RESULTStrue if the e-mail was successfully set, false if not.
NOTESDoes 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 ALSOgetemail
NAMEvoid deleteAll();
FUNCTIONDelete all the memory allocated for this node.
NAMEbool setPublisherCode( int newCode );
FUNCTIONSet the publisher code for this publisher.
INPUTSnewCode:    The code to set the publisher code to.
RESULTStrue if the code was successfully set, false if not.
NOTESYou should ensure that this code is unique, by calling Book_Publisher::getNewPublisherCode.
SEE ALSOBook_Publisher::getNewPublisherCode

ReferenceLibrary

NAMEReferenceLibrary();
FUNCTIONCreate instances for all the linked list classes, Author, Book_Author, Book, Book_Copies, Publisher, and Book_Publisher.
RESULTSIf the memory allocation fails then the program exits.
NAME~ReferenceLibrary();
FUNCTIONDeletes all the linked lists created by the constructor.
NAMEint loadLibrary( char *filename );
FUNCTIONCalls methods in all the linked list classes that load data from disk.
INPUTSfilename:    The name of the file to load.
RESULTSReturns DOS error codes.
SEE ALSOsaveLibrary
NAMEint saveLibrary( char *filename );
FUNCTIONCalls methods in all the linked list classes that save data to disk.
INPUTSfilename:    The name of the file to save.
RESULTSReturns DOS error codes.
SEE ALSOloadLibrary

User Interface

The user interface will be Windows95 based. The colours used in the interface will be different according to the users configuration.

Details

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".

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.


Appendix A
Class Diagram

I don't currently have Select Enterprise installed, so cannot access the class diagram.


Appendix B
Use cases

I don't currently have Select Enterprise installed, so cannot access the use cases.