-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsegment.h
30 lines (21 loc) · 820 Bytes
/
segment.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
#ifndef SEGMENT_H
#define SEGMENT_H
#include <vector>
#include <cstdint>
#include <stdexcept>
class Segment
{
public:
unsigned int minimum_address;
unsigned int maximum_address;
std::vector<uint8_t> data;
unsigned int word_size_bytes;
Segment(unsigned int min_addr, unsigned int max_addr, std::vector<uint8_t> dat, unsigned int word_size);
bool operator==(const Segment &other) const;
unsigned int address() const;
void add_data(unsigned int min_addr, unsigned int max_addr, const std::vector<uint8_t> &new_data);
bool remove_data(unsigned int new_min_address, unsigned int new_max_address, Segment &splitSegment);
std::vector<Segment> chunks(unsigned int size, unsigned int alignment, std::vector<uint8_t> padding);
unsigned int getSize();
};
#endif /* SEGMENT_H */