-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathapplication.cc
More file actions
84 lines (56 loc) · 2.13 KB
/
application.cc
File metadata and controls
84 lines (56 loc) · 2.13 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
// Time-stamp: <2016-01-29 16:06:59 daniel>
// Author: Daniel Mendyke [daniel@mendyke.com]
//
// application.cc: Routines of the sample::application class are defined here
//
// Required header files
//-----------------------------------------------------------------------------
#include <iostream> // std::cerr
#include <cstdlib> // EXIT_SUCCESS
#include "application.hh" // sample::application
#include "stack.hh" // bit9::stack
#include "fifo.hh" // bit9::queue
// NS short hands
//-----------------------------------------------------------------------------
using namespace std; // standard library
using namespace sample; // Project NS
// Constructor
//-----------------------------------------------------------------------------
application::application() {
}; // end application constructor
// Destructor
//-----------------------------------------------------------------------------
application::~application() {
}; // end destructor
// Begin actual functionality of this application - called from 'main'
//-----------------------------------------------------------------------------
int application::run() {
test_stack();
test_queue();
cerr << endl << "Thank you!" << endl << endl;
return EXIT_SUCCESS;
}; // end run
// Test the bit9::stack object
//-----------------------------------------------------------------------------
void application::test_stack() {
bit9::stack stack;
cerr << endl << "Test of the Stack object" << endl;
stack.push( 3 );
stack.push( 5 );
stack.push( 7 );
cerr << "pop " << stack.pop() << endl;
cerr << "pop " << stack.pop() << endl;
cerr << "pop " << stack.pop() << endl;
}; // end test_stack
// Test the bit9::queue object
//-----------------------------------------------------------------------------
void application::test_queue() {
bit9::fifo fifo;
cerr << endl << "Test of the Queue (fifo) object" << endl;
fifo.queue( 8 );
fifo.queue( 16 );
fifo.queue( 24 );
cerr << "removing from fifo " << fifo.dequeue() << endl;
cerr << "removing from fifo " << fifo.dequeue() << endl;
cerr << "removing from fifo " << fifo.dequeue() << endl;
}; // end test_queue