OmniSciDB  c0231cc57d
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
StringNetworkCallback Class Reference
+ Inheritance diagram for StringNetworkCallback:
+ Collaboration diagram for StringNetworkCallback:

Public Member Functions

 StringNetworkCallback (StringDictionaryProxy *sdp, StringDictionaryProxy::IdMap &id_map)
 
void operator() (std::string const &str, int32_t const old_id) override
 
void operator() (std::string_view const, int32_t const string_id) override
 
- Public Member Functions inherited from StringDictionary::StringCallback
virtual ~StringCallback ()=default
 

Private Types

using Lambda = std::function< int32_t(std::string const &)>
 

Private Attributes

StringDictionaryProxysdp_
 
StringDictionaryProxy::IdMapid_map_
 
Lambda const string_to_id_
 

Detailed Description

Definition at line 597 of file StringDictionaryProxy.cpp.

Member Typedef Documentation

using StringNetworkCallback::Lambda = std::function<int32_t(std::string const&)>
private

Definition at line 600 of file StringDictionaryProxy.cpp.

Constructor & Destructor Documentation

StringNetworkCallback::StringNetworkCallback ( StringDictionaryProxy sdp,
StringDictionaryProxy::IdMap id_map 
)
inline

Definition at line 604 of file StringDictionaryProxy.cpp.

605  : sdp_(sdp)
606  , id_map_(id_map)
607  , string_to_id_(sdp->string_dict_->makeLambdaStringToId()) {}
StringDictionaryProxy::IdMap & id_map_
std::shared_ptr< StringDictionary > string_dict_
StringDictionaryProxy * sdp_

Member Function Documentation

void StringNetworkCallback::operator() ( std::string const &  str,
int32_t const  old_id 
)
inlineoverridevirtual

Implements StringDictionary::StringCallback.

Definition at line 608 of file StringDictionaryProxy.cpp.

References StringDictionaryProxy::getOrAddTransientUnlocked(), id_map_, StringDictionary::INVALID_STR_ID, sdp_, and string_to_id_.

608  {
609  int32_t const new_id = string_to_id_(str);
610  id_map_[old_id] = new_id == StringDictionary::INVALID_STR_ID
612  : new_id;
613  }
StringDictionaryProxy::IdMap & id_map_
static constexpr int32_t INVALID_STR_ID
StringDictionaryProxy * sdp_
int32_t getOrAddTransientUnlocked(String const &)

+ Here is the call graph for this function:

void StringNetworkCallback::operator() ( std::string_view  const,
int32_t const  string_id 
)
inlineoverridevirtual

Implements StringDictionary::StringCallback.

Definition at line 614 of file StringDictionaryProxy.cpp.

References UNREACHABLE.

614  {
615  UNREACHABLE() << "StringNetworkCallback requires a std::string.";
616  }
#define UNREACHABLE()
Definition: Logger.h:266

Member Data Documentation

StringDictionaryProxy::IdMap& StringNetworkCallback::id_map_
private

Definition at line 599 of file StringDictionaryProxy.cpp.

Referenced by operator()().

StringDictionaryProxy* StringNetworkCallback::sdp_
private

Definition at line 598 of file StringDictionaryProxy.cpp.

Referenced by operator()().

Lambda const StringNetworkCallback::string_to_id_
private

Definition at line 601 of file StringDictionaryProxy.cpp.

Referenced by operator()().


The documentation for this class was generated from the following file: