MCPcopy Create free account
hub / github.com/OSVR/OSVR-Core / main

Function main

examples/internals/SharedMemoryServer.cpp:36–62  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

34#include <iostream>
35
36int main() {
37
38 auto opts = osvr::common::IPCRingBuffer::Options("Test");
39 auto buf = osvr::common::IPCRingBuffer::create(opts);
40 if (!buf) {
41 std::cout << "Couldn't create it." << std::endl;
42 return 1;
43 }
44 std::cout << "Using backend: " << int(buf->getBackend()) << std::endl;
45
46 std::cout << "Capacity: " << buf->getEntries() << " entries.\n";
47 std::cout << "Entry size: " << buf->getEntrySize() << " bytes per entry."
48 << std::endl;
49
50 while (true) {
51 // std::this_thread::sleep_for(std::chrono::milliseconds(100));
52 std::string data;
53 std::getline(std::cin, data);
54 auto seq =
55 buf->put(reinterpret_cast<const unsigned char *>(data.data()),
56 data.length());
57 std::cout << "Sequence number " << seq << std::endl;
58 // auto proxy = buf->put();
59 }
60
61 return 0;
62}

Callers

nothing calls this directly

Calls 7

dataMethod · 0.80
lengthMethod · 0.80
OptionsClass · 0.50
getBackendMethod · 0.45
getEntriesMethod · 0.45
getEntrySizeMethod · 0.45
putMethod · 0.45

Tested by

no test coverage detected