-
Notifications
You must be signed in to change notification settings - Fork 0
/
Application.hpp
executable file
·101 lines (78 loc) · 2.05 KB
/
Application.hpp
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
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
#ifndef _EEH_APP_HPP_
#define _EEH_APP_HPP_
#include <cmath>
#include <cstdint>
#include <iostream>
#include <iomanip>
#include <array>
#include <string>
#include <vector>
#include <list>
#include <map>
#include <sstream>
#include <cctype>
namespace App
{
struct ClosestMatch
{
uint32_t r1;
uint32_t r2;
float ratio;
double RatioDifference;
ClosestMatch(uint32_t r1_, uint32_t r2_, float ratio_, double ratiodiffIn)
: r1(r1_), r2(r2_), ratio(ratio_), RatioDifference(ratiodiffIn)
{}
};
void Init();
void Run();
void Destroy();
}
#endif // _EEH_APP_HPP_
#define VERSION_NUMBER "0.0.1"
#ifdef NEVER
class Application : public Singleton<Application>
{
std::map<std::string, std::vector<double>> mEValues;
char mUserInput; // A buffer variable for storing a single character of user input - eg. a number or y/n answer.
float mDesiredRatio;
float mSupplyVoltage;
float mScaleFactor;
std::string mInput;
std::string mSeries;
bool mDone;
public:
Application();
void Run();
private:
/*
* A member function that prints out the main menu options.
*/
void DisplayMenu();
/*
* Performs an action based on the value held in mUserInput.
*
* It is assumed that this is called only once for every printing of the main menu, so that input isn't processed twice.
*/
void UseInput();
/*
* Clears the screen, by outputting many newline characters. This improves readability of the console interface.
*/
inline void ClearScreen()
{
std::cout << std::string ( 100, '\n' );
}
void CalculateResistors();
void ChangeSeries();
void PrintMatches();
void PrintHelp();
void ClearMatches()
{
for(std::list<ClosestMatch*>::iterator it = mMatches.begin(); it != mMatches.end(); ++it)
{
delete (*it);
(*it) = nullptr;
}
mMatches.clear();
}
};
#endif