MCPcopy Create free account
hub / github.com/ImageEngine/cortex / internedString

Method internedString

src/IECore/InternedString.cpp:157–172  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

155} // namespace Detail
156
157const std::string *InternedString::internedString( const char *value )
158{
159 Detail::HashSet *hashSet = Detail::hashSet();
160 Detail::Index &hashIndex = hashSet->get<0>();
161 Detail::Mutex::scoped_lock lock( *Detail::mutex(), false ); // read-only lock
162 Detail::HashSet::const_iterator it = hashIndex.find( value );
163 if( it!=hashIndex.end() )
164 {
165 return &(*it);
166 }
167 else
168 {
169 lock.upgrade_to_writer();
170 return &(*(hashSet->insert( std::string( value ) ).first ) );
171 }
172}
173
174const std::string *InternedString::internedString( const char *value, size_t length )
175{

Callers

nothing calls this directly

Calls 5

mutexFunction · 0.85
insertMethod · 0.80
hashSetFunction · 0.70
findMethod · 0.45
endMethod · 0.45

Tested by

no test coverage detected