Skip to content
Permalink
master
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Go to file
 
 
Cannot retrieve contributors at this time
#ifndef SET_H
#define SET_H
#include <exception>
#include <memory>
class Set
{
private:
const int maxSize;
std::unique_ptr<char[]> set;
public:
class Full: public std::exception
{
public:
virtual const char* what() const throw();
};
class Empty: public std::exception
{
public:
virtual const char* what() const throw();
};
/** Initialise the queue, maxSize is the maximum number of
values that can be stored in the queue at any time **/
Set( const int _maxSize );
~Set();
/** Returns the number of values currently stored in the
queue **/
int num_items() const;
/** Add value to the set, return true if the value was added
* returns false if the value was already in the set.
* raises Set::Full if value was not in set but no space to
* add it. **/
bool add( char value );
/** Returns true if the value is in the set, false if not in
* the set **/
bool is_in( char value ) const;
/** Removes the value from the set. returns false if value
* was not in the set **/
bool remove( char value );
};
#endif