-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbridge.cpp
More file actions
60 lines (53 loc) · 1.3 KB
/
Copy pathbridge.cpp
File metadata and controls
60 lines (53 loc) · 1.3 KB
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
#include "bridge.h"
#include "format.h"
#include "file_env.h"
#include "reader.h"
#include "writer.h"
#include "mem_list.h"
#include "item.h"
namespace levelque {
bool Bridge::CreateQueueName(const string &path, const string &name)
{
if(ques_.find(name) != ques_.end()) {
return true;
}
ques_[name] = new Item(path, name);
ques_[name]->Initial();
return true;
}
bool Bridge::Read(const std::string &queueName, std::string &str, uint8_t level)
{
if(ques_.find(queueName) == ques_.end()) {
return false;
}
return ques_[queueName]->Read(str, level);
}
bool Bridge::Read(const std::string &queueName, std::string &str)
{
if(ques_.find(queueName) == ques_.end()) {
return false;
}
return ques_[queueName]->Read(str);
}
bool Bridge::Write(const std::string &queueName, const char *str, uint64_t length, uint8_t level)
{
if(ques_.find(queueName) == ques_.end()) {
return false;
}
return ques_[queueName]->Write(str, length, level);
}
uint32_t Bridge::Size(const std::string &queueName, uint8_t level)
{
if(ques_.find(queueName) == ques_.end()) {
return 0;
}
return ques_[queueName]->Size(level);
}
uint32_t Bridge::Size(const std::string &queueName)
{
if(ques_.find(queueName) == ques_.end()) {
return 0;
}
return ques_[queueName]->SizeAll();
}
}