1 | #ifndef COLUMNS_H |
---|
2 | #define COLUMNS_H |
---|
3 | |
---|
4 | #include <iostream> |
---|
5 | #include <iomanip> |
---|
6 | #include <string> |
---|
7 | #include <vector> |
---|
8 | |
---|
9 | using std::string; |
---|
10 | using std::vector; |
---|
11 | |
---|
12 | namespace Column |
---|
13 | { |
---|
14 | |
---|
15 | const int fluxPrec=3, velPrec=3, xyzPrec=1, posPrec=6, wposPrec=2; |
---|
16 | |
---|
17 | class Col{ |
---|
18 | public: |
---|
19 | Col(){width=0;name="";unit="";}; |
---|
20 | Col(int w, string n, string u){width=w; name=n; unit=u;}; |
---|
21 | ~Col(){}; |
---|
22 | int widen(){width++;}; |
---|
23 | int getWidth(){return width;}; |
---|
24 | void setWidth(int i){width=i;}; |
---|
25 | string getName(){return name;}; |
---|
26 | void setName(string s){name=s;}; |
---|
27 | string getUnit(){return unit;}; |
---|
28 | void setUnit(string s){unit=s;}; |
---|
29 | void title(std::ostream &stream){ |
---|
30 | stream << std::setw(this->width) << this->name;}; |
---|
31 | void units(std::ostream &stream){ |
---|
32 | stream << std::setw(this->width) << this->unit;}; |
---|
33 | void dash (std::ostream &stream){ |
---|
34 | stream << std::setfill('-') << std::setw(this->width) |
---|
35 | << ""<< std::setfill(' ');}; |
---|
36 | void blank(std::ostream &stream){ |
---|
37 | stream << std::setfill(' ') << std::setw(this->width) << "";}; |
---|
38 | |
---|
39 | template <class type> void entry(std::ostream &stream, type e){ |
---|
40 | stream << std::setw(this->width) << e;}; |
---|
41 | |
---|
42 | int width; |
---|
43 | string name; |
---|
44 | string unit; |
---|
45 | }; |
---|
46 | |
---|
47 | class ColSet{ |
---|
48 | public: |
---|
49 | ColSet(){defined=false; inserted=false;} |
---|
50 | ~ColSet(){}; |
---|
51 | vector<Col> vec; |
---|
52 | bool defined; |
---|
53 | bool inserted; |
---|
54 | void addFluxCol(Col fluxCol){ |
---|
55 | if(!this->inserted) this->vec.insert(this->vec.begin()+11, fluxCol); |
---|
56 | this->inserted = true; |
---|
57 | } |
---|
58 | |
---|
59 | }; |
---|
60 | |
---|
61 | } |
---|
62 | |
---|
63 | |
---|
64 | #endif |
---|
65 | |
---|