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

Function main

examples/internals/SharedMemoryClient.cpp:36–63  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

34#include <iostream>
35
36int main() {
37 auto opts = osvr::common::IPCRingBuffer::Options("Test");
38 auto buf = osvr::common::IPCRingBuffer::find(opts);
39 if (!buf) {
40 std::cout << "Couldn't find it." << std::endl;
41 return 1;
42 }
43
44 std::cout << "Capacity: " << buf->getEntries() << " entries.\n";
45 std::cout << "Entry size: " << buf->getEntrySize() << " bytes per entry."
46 << std::endl;
47
48 osvr::common::IPCRingBuffer::sequence_type seq(0);
49 while (true) {
50 std::cin.ignore();
51 std::cout << "Sequence number " << seq << ": ";
52 auto res = buf->get(seq);
53 if (res) {
54 std::cout << (res.get())[0] << (res.get())[1] << (res.get())[2];
55 } else {
56 std::cout << "Not available";
57 }
58 std::cout << std::endl;
59 seq++;
60 }
61
62 return 0;
63}

Callers

nothing calls this directly

Calls 4

OptionsClass · 0.50
getEntriesMethod · 0.45
getEntrySizeMethod · 0.45
getMethod · 0.45

Tested by

no test coverage detected