-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathAPxLinkData.hh
50 lines (35 loc) · 1.06 KB
/
APxLinkData.hh
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
#ifndef __APXLINKDATA_H__
#define __APXLINKDATA_H__
#include <stdint.h>
#include <iostream>
#include <fstream>
#include <string>
#include <map>
#include <stdexcept>
#include <iomanip>
class APxLinkData {
public:
struct LinkValue {
uint16_t user;
uint64_t data;
bool operator ==(const LinkValue &b) const;
bool operator !=(const LinkValue &b) const { return !(*this == b); };
};
APxLinkData(size_t links);
void add(size_t cycle, size_t link, const LinkValue value);
bool get(size_t cycle, size_t link, LinkValue& value) const;
void write(const std::string filename) const;
void read(const std::string filename);
void print() const;
inline size_t getLinks() const { return this->links; };
inline size_t getCycles() const { return this->max_cycles; };
bool operator ==(const APxLinkData &b) const;
inline bool operator !=(const APxLinkData &b) const { return !(*this == b); };
private:
size_t links;
size_t max_cycles;
typedef std::map<size_t, LinkValue> CycleDataMap;
typedef std::map<size_t, CycleDataMap> LinkDataMap;
LinkDataMap data;
};
#endif