-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathBufferBlock.cpp
61 lines (49 loc) · 890 Bytes
/
BufferBlock.cpp
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
51
52
53
54
55
56
57
58
59
60
61
//
// BufferBlock.cpp
// Michael_Bagnasco_Lab3
//
// Created by Michael Bagnasco on 4/2/17.
// Copyright © 2017 MBagnasco. All rights reserved.
//
#include "BufferBlock.h"
BufferBlock::BufferBlock()
{
blockPtr = block;
}
BufferBlock::BufferBlock(char* data, int sz)
{
blockPtr = block;
}
BufferBlock::~BufferBlock()
{
}
void BufferBlock::getData(int pos, int sz, char* data)
{
// Copies data from block into "data"
for (int i = 0; i < sz; i++) {
data[i] = block[pos];
pos++;
}
}
void BufferBlock::setID(int id)
{
blockID = id;
}
int BufferBlock::getID() const
{
return blockID;
}
int BufferBlock::getBlocksize() const
{
return blockSize;
}
char* BufferBlock::getBlock() const
{
return blockPtr;
}
void BufferBlock::setBlock(char* blk)
{
//
for (int i = 0; i < 4096; i++)
*(blockPtr + i) = blk[i];
}