lab_memory
Malevolent Memories
Room Class Reference

Represents a testing room, which has a group of letters allocated to it (where letters are first letters of last names). More...

#include "room.h"

+ Collaboration diagram for Room:

Public Member Functions

 Room ()
 Room Default Constructor. More...
 
 Room (const Room &other)
 Room copy constructor. More...
 
 Room (const string &init_name, int init_capacity)
 Main Room constructor. More...
 
Roomoperator= (const Room &other)
 Room assignment operator. More...
 
 ~Room ()
 Room destructor. More...
 
void addLetter (const Letter &L)
 Allocates a letter group to this room. More...
 
int spaceRemaining ()
 
void print (std::ostream &stream=std::cout)
 Outputs the room to cout. More...
 

Public Attributes

string name
 The room name. More...
 
int capacity
 The capacity of the room. More...
 
int count
 The number of students currently allocated. More...
 
int max_letters
 The maximum size of the letters array (26) More...
 
Letterletters
 An array of Letters currently allocated. More...
 
int letterCount
 The number of valid Letters in the Letters array. More...
 

Private Member Functions

void clear ()
 Destructor/assignment operator clear helper function. More...
 
void copy (const Room &other)
 Cctor/assignment operator copy helper function. More...
 

Detailed Description

Represents a testing room, which has a group of letters allocated to it (where letters are first letters of last names).

Constructor & Destructor Documentation

Room::Room ( )

Room Default Constructor.

Creates a blank (uninitialized) room

Room::Room ( const Room other)

Room copy constructor.

Parameters
otherThe Room to copy into this room.
Room::Room ( const string init_name,
int  init_capacity 
)

Main Room constructor.

Creates an empty room with the given name and capacity

Parameters
init_nameThe name to create this Room with
init_capacityThe size of this Room
Room::~Room ( )

Room destructor.

Member Function Documentation

Room & Room::operator= ( const Room other)

Room assignment operator.

Parameters
otherThe Room to make a copy of
Returns
A reference to the copied Room
void Room::addLetter ( const Letter L)

Allocates a letter group to this room.

Parameters
LThe letter group to add
int Room::spaceRemaining ( )
Returns
the number of empty seats remaining in the room after current allocations.
void Room::print ( std::ostream stream = std::cout)

Outputs the room to cout.

Parameters
streamThe stream to print to
void Room::clear ( )
private

Destructor/assignment operator clear helper function.

void Room::copy ( const Room other)
private

Cctor/assignment operator copy helper function.

Member Data Documentation

string Room::name

The room name.

int Room::capacity

The capacity of the room.

int Room::count

The number of students currently allocated.

int Room::max_letters

The maximum size of the letters array (26)

Letter* Room::letters

An array of Letters currently allocated.

int Room::letterCount

The number of valid Letters in the Letters array.


The documentation for this class was generated from the following files: