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

Method getStringID

src/osvr/Common/RegisteredStringMap.cpp:49–62  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

47 }
48
49 util::StringID RegisteredStringMap::getStringID(std::string const &str) {
50 auto entry = std::find(begin(m_regEntries), end(m_regEntries), str);
51 if (end(m_regEntries) != entry) {
52 // we found it.
53 return util::StringID(std::distance(begin(m_regEntries), entry));
54 }
55
56 // we didn't find an entry in the registry so we'll add a new one
57 auto ret = util::StringID(
58 m_regEntries.size()); // will be the location of the next insert.
59 m_regEntries.push_back(str);
60 m_modified = true;
61 return ret;
62 }
63
64 std::string RegisteredStringMap::getStringFromId(util::StringID id) const {
65

Callers 4

setupPeerMappingsMethod · 0.80
TESTFunction · 0.80
TEST_FFunction · 0.80

Calls 2

sizeMethod · 0.45
push_backMethod · 0.45

Tested by

no test coverage detected