DRAFT: This module has unpublished changes.



Software Design Document

 

for

 

Programming Assignment #1

 

February 6th, 2014





Prepared by Sanjay Kapoor

skaroop2@gmail.com





Prepared For:

Dr. Rick Coleman, Instructor

CS 221, Data Structures in C++

Computer Science Department

University of Alabama in Huntsville




















1.0 System Overview………………………………………………………………..3

2.0 Referenced Documents………………………………………………………..3

3.0 Architectural Design…………………………………………………………….3

3.1 Concept of Execution…………………………………………………..3

3.2 Code Outline……………………………………………………………..3

4.0 Detailed Design………………………………………………………………….4

4.1 Source File: Character.h……………………………………………….4

4.2 Source File: Character.cpp…………………………………………….4




































1.0 System Overview

The purpose of this program is to enumerate a Character class which could be used to make Character objects for a role-playing game such as Dungeons and Dragons, including all attributes and types that might be used by the writer of the Statement of Work.



2.0 Referenced Documents

 

Programming Assignment 1 Statement of Work

Dale, Nell C++ Plus Data Structures (2011)

 

3.0 Architectural Design

 

3.1 Concept of Execution

This program will simply contain a class which has in it several attributes of the

supposed Character object, which presumably could be created elsewhere.

 

The program will contain getter and setter functions for each of these attributes, some

of which will be reference functions, some of which will take pointers as arguments,

and some of which will be ordinary functions taking in normal variables.

 

The class will be fairly simple, really just being the roots of something potentially more

sophisticated, which we aren’t writing right now.

 

3.2 Code Outline

The program will consist of the following files:

Class: Character.h and Character.cpp

 

m_sName - A Character array capable of holding up to 64 characters

 

int m_iClass, m_iAlignment, m_iHitPoints

 

int m_iCharTraits[6] - Represents the character traints of strength, dexterity,

constitution, intelligence, wisdom, and charisma.

 

Character(), ~Character() -  A default constructor and destructor.

 

Character(char* name, int cl, int al, int hp, int str, int dex, int con, int itl, int

wis, int chr) -  A parameterized constructor which shall take as arguments a character

array giving the name and integer arguments specifying the class, alignment, hit

points, strength, dexterity, constitution, intelligence, wisdom, and charisma of the

character.

 

void getName(char *name), void setName(char *name) - Get and set the player

name.

 

void getClass(int& cl), void setClass(int cl) - Get and set the player class. The get

function shall be a reference function.

 

void getAlignment(int& al), void setAlignment(int al) - Get and set the player

alignment value. The get function shall be a reference function.

 

void getHitPoints(int& hp), void setHitPoints(int hp) - Get and set the player hit

points. The get function shall be a reference function.

 

void getStrength(int *str), void setStrength(int str) - Get and set the player

Strength  score (m_iCharTraits[0]).

 

 

void getDexterity(int *dex), void setDexterity(int dex) - Get and set the player

Dexterity score (m_iCharTraits[1]).

 

void getConstitution(int *cn), void setConstitution(int cn) - Get and set the player

Constitution score (m_iCharTraits[2]).

 

 

void getIntelligence(int *itl), void setIntelligence(int itl) - Get and set the player

Intelligence score (m_iCharTraits[3]).

 

 

void getWisdom(int *wis), void setWisdom(int wis) - Get and set the player

Wisdom score (m_iCharTraits[4]).

 

void getCharisma(int *chr), void setCharisma(int chr) - Get and set the player

Charisma score (m_iCharTraits[5])

 

void printAll() - Print all information on this character. This includes, Name, Class,

Alignment, Hit points, and all 6 character trait values.



4.1 Source File: Character.cpp

  4.1.1 Function Character()

      4.1.1.1 Purpose

      This function will create a Character object with all of the values initialized to defaults.

      4.1.1.2 Arguments

      None.

      4.1.1.3 Return value

      A pointer to a Character object

      4.1.1.4 Function outline in pseudocode

      Initialize a Character object, setting values to expected quantities.

      4.1.1.5 Traceability

      This function satisfies requirement 2.1.2.1 in the SoW.

 

      4.1.2 Function ~Character()

      4.1.2.1 Purpose

      This function will destruct a Character object with all of the values initialized to defaults.

      4.1.2.2 Arguments

      None.

      4.1.2.3 Return value

      None.

      4.1.2.4 Function outline in pseudocode

      Destroy the Character object.

      4.1.2.5 Traceability

      This function satisfies requirement 2.1.2.1 in the SoW.

      4.1.3 Function Character(char* name, int cl, int al, int hp, int str, int dex, int con,

                                                  int itl, int wis, int chr)

      4.1.3.1 Purpose

      This function will construct a Character object with all of the values initialized to the

      values which are passed in

      4.1.3.2 Arguments

      Integers: cl, al, hp, str, dex, con, itl, wis, chr, and a Character array: name

      4.1.3.3 Return value

      A Character object with values set to the values inputted into the constructor function.

      4.1.3.4 Function outline in pseudocode

      Construct a Character object.

      Set m_sName to name, m_iClass to cl, m_iAlignment to al, m_iHitPoints to hp, and the six

      entries in the m_iCharTraits array to str, dex, con, itl, wis, and chr, respectively from indices

      0 to 5, in order.

      4.1.3.5 Traceability

      This function satisfies requirement 2.1.2.2 in the SoW.

 

      4.1.5 Function void getName(char *name)

      4.1.5.1 Purpose

      This function will retrieve the name by putting it into the character array passed into the

      function, when called.

      4.1.5.2 Arguments

      A pointer to a character, char *name.

      4.1.5.3 Return value

      None.

      4.1.5.4 Function outline in pseudocode

      Copy the char array m_sName into the char array name.

      4.1.5.5 Traceability

      This function satisfies requirement 2.1.2.3.1 in the SoW.



      4.1.6 Function void setName(char *name)

      4.1.6.1 Purpose

      This function will set the name in the Character object to the name which is stored

      in the character array, name.

      

4.1.6.2 Arguments

      A pointer to a character, *name.

      4.1.6.3 Return value

      None.

      4.1.6.4 Function outline in pseudocode

      Set m_sName equal to name using strcpy.

      4.1.6.5 Traceability

      This function satisfies requirement 2.1.2.3.1 in the SoW.

 

      4.1.7 Function void getClass(int& cl)

      4.1.7.1 Purpose

      This function will retrieve the class by copying the value of the Class int into the address of

      cl variable which is passed in.

      4.1.7.2 Arguments

      The cl variable, but really the address that the variable is stored at is being used.

      4.1.7.3 Return value

      None.

      4.1.7.4 Function outline in pseudocode

      Copy m_iClass into the variable cl.

      4.1.7.5 Traceability

      This function satisfies requirement 2.1.2.3.2 in the SoW.

 

      4.1.8 Function void setClass(int cl)

      4.1.8.1 Purpose

      This function will set the Class in the Character object to whatever value is stored in int cl.

      4.1.8.2 Arguments

      An int variable, cl.

      4.1.8.3 Return value

      None.

      4.1.8.4 Function outline in pseudocode

      Set m_iClass equal to cl.

      4.1.8.5 Traceability

      This function satisfies requirement 2.1.2.3.2 in the SoW.

      

      4.1.9 Function void getAlignment(int& al)

      4.1.9.1 Purpose

      This function will retrieve the alignment by copying the value of the Alignment int into the

      address of the al variable which is passed in.

      4.1.9.2 Arguments

      The al variable, but really the address that the variable is stored at is being used.

      4.1.9.3 Return value

      None.

      4.1.9.4 Function outline in pseudocode

      Copy m_iAlignment into al.

      4.1.9.5 Traceability

      This function satisfies requirement 2.1.2.3.3 in the SoW.

 

      4.1.10 Function void setAlignment(int al)

      4.1.10.1 Purpose

      This function will set the Alignment in the Character object to whatever value is stored in int

       al.

      4.1.10.2 Arguments

      An int variable, al.

      4.1.10.3 Return value

      None.

      4.1.10.4 Function outline in pseudocode

      Copy al into m_iAlignment.

      4.1.10.5 Traceability

      This function satisfies requirement 2.1.2.3.3 in the SoW.

 

      4.1.11 Function void getHitPoints(int& hp)

      4.1.11.1 Purpose

      This function will retrieve the Hit Points by copying the value of the Hit Points int into the

      address of the hp variable which is passed in.

      4.1.11.2 Arguments

      The hp variable, but really the address that the variable is stored at is being used.

      4.1.11.3 Return value

      None.

      4.1.11.4 Function outline in pseudocode

      Copy m_iHitPoints into hp.

      4.1.11.5 Traceability

      This function satisfies requirement 2.1.2.3.4 in the SoW.

 

      4.1.12 Function void setHitPoints(int hp)

      4.1.12.1 Purpose

      This function will set the Hit Points in the Character object to whatever value is stored in int

      hp.

      4.1.12.2 Arguments

      An int variable, hp.

      4.1.12.3 Return value

      None.

      4.1.12.4 Function outline in pseudocode

      Copy hp into m_iHitPoints.

      4.1.12.5 Traceability

      This function satisfies requirement 2.1.2.3.4 in the SoW.

 

      4.1.13 Function void getStrength(int *str))

      4.1.13.1 Purpose

      This function will retrieve the Strength by copying the value of the Strength int into the

      location indicated by the address which the str pointer points to.

      4.1.13.2 Arguments

      A pointer to an int, str.

      4.1.13.3 Return value

      None.

      4.1.13.4 Function outline in pseudocode

      Copy the value from m_iCharTraits[1] into *str.

      4.1.13.5 Traceability

      This function satisfies requirement 2.1.2.3.5 in the SoW.

 

      4.1.14 Function void setStrength(int str)

      4.1.14.1 Purpose

      This function will set the Strength in the m_iCharTraits[0] to whatever value is stored in str.

      4.1.14.2 Arguments

      An integer, str.

      4.1.14.3 Return value

      None.

      4.1.14.4 Function outline in pseudocode

      Copy the value from str into m_iCharTraits[0].

      4.1.14.5 Traceability

      This function satisfies requirement 2.1.2.3.5 in the SoW.

 

      4.1.15 Function void getDexterity(int *dex))

      4.1.15.1 Purpose

      This function will retrieve the Dexterity by copying the value of the Dexterity int into the

      location indicated by the address which the dex pointer points to.

      4.1.15.2 Arguments

      A pointer to an int, dex.

      4.1.15.3 Return value

      None.

      4.1.15.4 Function outline in pseudocode

      Copy the value from m_iCharTraits[1] into *dex.

      4.1.15.5 Traceability

      This function satisfies requirement 2.1.2.3.5 in the SoW.

 

      4.1.16 Function void setDexterity(int dex)

      4.1.16.1 Purpose

      This function will set the Dexterity in the m_iCharTraits[1] location within the Character

      object to whatever value is stored in dex.

      4.1.16.2 Arguments

      An integer, dex..

      4.1.16.3 Return value

      None.

      4.1.16.4 Function outline in pseudocode

      Copy the value in dex into m_iCharTraits[1].

      4.1.16.5 Traceability

      This function satisfies requirement 2.1.2.3.5 in the SoW.

     

      4.1.17 Function void getConstitution(int *cn)

      4.1.17.1 Purpose

      This function will retrieve the Constitution by copying the value of the Constitution int into the

      location indicated by the address which the cn pointer points to.

      4.1.17.2 Arguments

      A pointer to an int, cn.

      4.1.17.3 Return value

      None.

      4.1.17.4 Function outline in pseudocode

      Copy the value from m_iCharTraits[2] into *cn.

      4.1.17.5 Traceability

      This function satisfies requirement 2.1.2.3.5 in the SoW.

 

      4.1.18 Function void setConstitution(int cn)

      4.1.18.1 Purpose

      This function will set the Constitution in the m_iCharTraits[2] location within the Character

      object to whatever value is stored in cn.

      4.1.18.2 Arguments

      An integer, cn.

      4.1.18.3 Return value

      None.

      4.1.18.4 Function outline in pseudocode

      Copy the value from from cn into m_iCharTraits[2].

      4.1.18.5 Traceability

      This function satisfies requirement 2.1.2.3.5 in the SoW.

 

      4.1.19 Function void getIntelligence(int *itl)

      4.1.19.1 Purpose

      This function will retrieve the Intelligence by copying the value of the Intelligence int into the

      location indicated by the address which the itl pointer points to.

      4.1.19.2 Arguments

      A pointer to an int, itl.

      4.1.19.3 Return value

      None.

      4.1.19.4 Function outline in pseudocode

      Copy the value from m_iCharTraits[3] into *itl.

      4.1.19.5 Traceability

      This function satisfies requirement 2.1.2.3.5 in the SoW.

 

      4.1.20 Function void setIntelligence(int itl)

      4.1.20.1 Purpose

      This function will set the Intelligence in the m_iCharTraits[3] location within the Character

      object to whatever value is stored in cn.

      4.1.20.2 Arguments

      An integer, cn.

      4.1.20.3 Return value

      None.

      4.1.20.4 Function outline in pseudocode

      Copy the value from itl into m_iCharTraits[3].

      4.1.20.5 Traceability

      This function satisfies requirement 2.1.2.3.5 in the SoW.


      4.1.21 Function void getWisdom(int *wis)

      4.1.21.1 Purpose

      This function will retrieve the Wisdom by copying the value of the Wisdom int into the

      location indicated by the address which the wis pointer points to.

      4.1.21.2 Arguments

      A pointer to an int, wis.

      4.1.21.3 Return value

      None.

      4.1.21.4 Function outline in pseudocode

      Copy the value from m_iCharTraits[4] into *wis.

      4.1.21.5 Traceability

      This function satisfies requirement 2.1.2.3.5 in the SoW.


      4.1.22 Function void setWisdom(int wis)

      4.1.22.1 Purpose

      This function will set the Wisdom in the m_iCharTraits[4] location within the Character

      object to whatever value is stored in wis.

      4.1.22.2 Arguments

      An integer, wis.

      4.1.22.3 Return value

      None.

      4.1.22.4 Function outline in pseudocode

      Copy the value from wis into m_iCharTraits[4].

      4.1.22.5 Traceability

      This function satisfies requirement 2.1.2.3.5 in the SoW.

 

      4.1.23 Function void getCharisma(int *chr)

      4.1.23.1 Purpose

      This function will retrieve the Charisma by copying the value of the Charisma int into the

      location indicated by the address which the chr pointer points to.

      4.1.23.2 Arguments

      A pointer to an int, chr.

      4.1.23.3 Return value

      None.

      4.1.23.4 Function outline in pseudocode

      Copy the value from m_iCharTraits[5] into *chr.

      4.1.23.5 Traceability

      This function satisfies requirement 2.1.2.3.5 in the SoW.

 

      4.1.24 Function void setCharisma(int chr)

      4.1.24.1 Purpose

      This function will set the Charisma in the m_iCharTraits[5] location within the Character

      object to whatever value is stored in wis.

      4.1.24.2 Arguments

      An integer, chr.

      4.1.24.3 Return value

      None.

      4.1.24.4 Function outline in pseudocode

      Copy the value from chr into m_iCharTraits[5].

      4.1.24.5 Traceability

      This function satisfies requirement 2.1.2.3.5 in the SoW.





 

dddddddddddddddddddd

 
     
     
     
DRAFT: This module has unpublished changes.