-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathIMT2019030_Bitset.h
42 lines (36 loc) · 970 Bytes
/
IMT2019030_Bitset.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
#ifndef BITSET_H_
#define BITSET_H_
#include<string>
#include<map>
using namespace std;
//Basic unit
//Used to store the bits
//Stores in form of a string
class Bitset{
//Class attributes
private:
string bitset;
//Constructors and Destructors
public:
Bitset();
Bitset(string);
Bitset(int);
Bitset(const Bitset&);
~Bitset();
//Getters and Setters
public:
int size();
void setBitset(string);
string stringform();
//Member functions
public:
//Used to extract some given range of bits
Bitset extract(int,int);
//Used to extract some given range of bits and returns its string form
string extractString(int,int);
//static Function to convert an Hex number to a binary
static Bitset HexToBin(string);
//static Function to convert an Binary number to a Decimal
static int BinToDec(Bitset);
};
#endif