132
57
}
58
}
59
return MAX_OPS;
60
}
61
62
int
63
main(int argc, char *argv[])
64
{
65
if (argc < 2) {
66
std::cerr << "Usage: " << argv[0] << " path_to_pool"
<< std::endl;
67
return 1;
68
}
69
70
auto path = argv[1];
71
pmem::obj::pool pool;
72
73
try {
74
pool = pmem::obj::pool::open(path, "queue");
75
} catch(pmem::pool_error &e) {
76
std::cerr << e.what() << std::endl;
77
std::cerr << "To create pool run: pmempool create obj
--layout=queue -s 100M path_to_pool" << std::endl;
78
}
79
80
auto q = pool.root();
81
82
while (1) {
83
std::cout << "[push value|pop|show|exit]" << std::endl;
84
85
std::string command;
86
std::cin >> command;
87
88
// parse string
89
auto ops = parse_queue_ops(std::string(command));
90
Chapter 8 libpmemobj-Cpp: the adaptable language - C++ and persistent memory
57
}
58
}
59
return MAX_OPS;
60
}
61
62
int
63
main(int argc, char *argv[])
64
{
65
if (argc < 2) {
66
std::cerr << "Usage: " << argv[0] << " path_to_pool"
<< std::endl;
67
return 1;
68
}
69
70
auto path = argv[1];
71
pmem::obj::pool
72
73
try {
74
pool = pmem::obj::pool
75
} catch(pmem::pool_error &e) {
76
std::cerr << e.what() << std::endl;
77
std::cerr << "To create pool run: pmempool create obj
--layout=queue -s 100M path_to_pool" << std::endl;
78
}
79
80
auto q = pool.root();
81
82
while (1) {
83
std::cout << "[push value|pop|show|exit]" << std::endl;
84
85
std::string command;
86
std::cin >> command;
87
88
// parse string
89
auto ops = parse_queue_ops(std::string(command));
90
Chapter 8 libpmemobj-Cpp: the adaptable language - C++ and persistent memory
