-
Notifications
You must be signed in to change notification settings - Fork 0
/
Units.h
50 lines (38 loc) · 888 Bytes
/
Units.h
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
#pragma once
#include <string>
#include <map>
#include <vector>
#include <iostream>
class BaseUnit {
private:
std::string _name;
std::string _code; // µ¥Î»·ûºÅ±àÂë
public:
BaseUnit();
~BaseUnit();
BaseUnit(std::string name, std::string code);
std::string name();
std::string code();
bool operator < (const BaseUnit& B);
bool operator == (const BaseUnit& B);
bool operator > (const BaseUnit& B);
bool operator != (const BaseUnit& B);
void printAllInfo();
};
struct BaseUnitNode {
BaseUnitNode* pre;
double trans_factor_pre;
BaseUnit value;
std::vector<BaseUnitNode*> next;
std::vector<double> trans_factor_next;
BaseUnitNode();
~BaseUnitNode();
void add_nextNode(BaseUnitNode& node);
void link_preNode(BaseUnitNode& node);
};
class BaseUnitManager {
private:
std::vector<BaseUnitNode> rootUnits;
std::map<std::string, BaseUnitNode*> codeList;
public:
};