Network System 0.1.1
High-performance modular networking library for scalable client-server applications
Loading...
Searching...
No Matches
kcenon::network::integration::container_manager::impl Class Reference
Collaboration diagram for kcenon::network::integration::container_manager::impl:
Collaboration graph

Public Member Functions

 impl ()=default
 
void register_container (const std::string &name, std::shared_ptr< container_interface > container)
 
std::shared_ptr< container_interfaceget_container (const std::string &name) const
 
void set_default_container (std::shared_ptr< container_interface > container)
 
std::shared_ptr< container_interfaceget_default_container ()
 
std::vector< uint8_t > serialize (const std::any &data)
 
std::any deserialize (const std::vector< uint8_t > &bytes)
 
std::vector< std::string > list_containers () const
 

Private Attributes

std::mutex mutex_
 
std::unordered_map< std::string, std::shared_ptr< container_interface > > containers_
 
std::shared_ptr< container_interfacedefault_container_
 

Detailed Description

Definition at line 177 of file container_integration.cpp.

Constructor & Destructor Documentation

◆ impl()

kcenon::network::integration::container_manager::impl::impl ( )
default

Member Function Documentation

◆ deserialize()

std::any kcenon::network::integration::container_manager::impl::deserialize ( const std::vector< uint8_t > & bytes)
inline

Definition at line 219 of file container_integration.cpp.

219 {
220 return get_default_container()->deserialize(bytes);
221 }
std::shared_ptr< container_interface > get_default_container()

References get_default_container().

Referenced by kcenon::network::integration::container_manager::deserialize().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ get_container()

std::shared_ptr< container_interface > kcenon::network::integration::container_manager::impl::get_container ( const std::string & name) const
inline

Definition at line 189 of file container_integration.cpp.

191 {
192 std::unique_lock<std::mutex> lock(mutex_);
193 auto it = containers_.find(name);
194 if (it != containers_.end()) {
195 return it->second;
196 }
197 return nullptr;
198 }
std::unordered_map< std::string, std::shared_ptr< container_interface > > containers_

References containers_, and mutex_.

Referenced by kcenon::network::integration::container_manager::get_container().

Here is the caller graph for this function:

◆ get_default_container()

std::shared_ptr< container_interface > kcenon::network::integration::container_manager::impl::get_default_container ( )
inline

Definition at line 207 of file container_integration.cpp.

207 {
208 std::unique_lock<std::mutex> lock(mutex_);
209 if (!default_container_) {
210 default_container_ = std::make_shared<basic_container>();
211 }
212 return default_container_;
213 }
std::shared_ptr< container_interface > default_container_

References default_container_, and mutex_.

Referenced by deserialize(), kcenon::network::integration::container_manager::get_default_container(), and serialize().

Here is the caller graph for this function:

◆ list_containers()

std::vector< std::string > kcenon::network::integration::container_manager::impl::list_containers ( ) const
inline

Definition at line 223 of file container_integration.cpp.

223 {
224 std::unique_lock<std::mutex> lock(mutex_);
225 std::vector<std::string> names;
226 names.reserve(containers_.size());
227 for (const auto& [name, _] : containers_) {
228 names.push_back(name);
229 }
230 return names;
231 }

References containers_, and mutex_.

Referenced by kcenon::network::integration::container_manager::list_containers().

Here is the caller graph for this function:

◆ register_container()

void kcenon::network::integration::container_manager::impl::register_container ( const std::string & name,
std::shared_ptr< container_interface > container )
inline

Definition at line 181 of file container_integration.cpp.

184 {
185 std::unique_lock<std::mutex> lock(mutex_);
186 containers_[name] = container;
187 }

References containers_, and mutex_.

Referenced by kcenon::network::integration::container_manager::register_container().

Here is the caller graph for this function:

◆ serialize()

std::vector< uint8_t > kcenon::network::integration::container_manager::impl::serialize ( const std::any & data)
inline

Definition at line 215 of file container_integration.cpp.

215 {
216 return get_default_container()->serialize(data);
217 }

References get_default_container().

Referenced by kcenon::network::integration::container_manager::serialize().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ set_default_container()

void kcenon::network::integration::container_manager::impl::set_default_container ( std::shared_ptr< container_interface > container)
inline

Definition at line 200 of file container_integration.cpp.

202 {
203 std::unique_lock<std::mutex> lock(mutex_);
204 default_container_ = container;
205 }

References default_container_, and mutex_.

Referenced by kcenon::network::integration::container_manager::set_default_container().

Here is the caller graph for this function:

Member Data Documentation

◆ containers_

std::unordered_map<std::string, std::shared_ptr<container_interface> > kcenon::network::integration::container_manager::impl::containers_
private

Definition at line 235 of file container_integration.cpp.

Referenced by get_container(), list_containers(), and register_container().

◆ default_container_

std::shared_ptr<container_interface> kcenon::network::integration::container_manager::impl::default_container_
private

Definition at line 236 of file container_integration.cpp.

Referenced by get_default_container(), and set_default_container().

◆ mutex_

std::mutex kcenon::network::integration::container_manager::impl::mutex_
mutableprivate

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