-
Notifications
You must be signed in to change notification settings - Fork 0
/
ResourceReader.h
41 lines (30 loc) · 870 Bytes
/
ResourceReader.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
//
// Created by Glenn R. Martin on 2019-05-08.
//
#ifndef CVDICE_RESOURCEREADER_H
#define CVDICE_RESOURCEREADER_H
#include <map>
#include <vector>
#include <string>
typedef std::vector<unsigned char> RawByteVector;
class ResourceReader {
// Singleton
public:
static ResourceReader& getInstance() {
static ResourceReader instance;
return instance;
}
ResourceReader(ResourceReader const&) = delete;
void operator=(ResourceReader const&) = delete;
private:
ResourceReader() {
cache = std::map<std::string, RawByteVector>{};
}
// Implementation
private:
std::map<std::string, RawByteVector> cache;
public:
RawByteVector getBytes(const std::string& resourceFileName);
RawByteVector getJpegMarkedBytes(const std::string& resourceFileName, const RawByteVector& bytes);
};
#endif //CVDICE_RESOURCEREADER_H