# LazyStringMap.hpp

This File On Github
Ask A Question

API: latest
module: oatpp
#include "oatpp/core/data/share/LazyStringMap.hpp"

# LazyStringMap

Lazy String Map keeps keys, and values as memory label. Once value is requested by user, the new memory block is allocated and value is copied to be stored permanently.

namespace oatpp { namespace data { namespace share { 
  template<class Key>
  class LazyStringMap {}
}}}

# Methods

Return Type Name Summary
[none] LazyStringMap Multiple implementations:
  1. Constructor.
  2. Copy-constructor.
  3. Move constructor.
void put Put value to map.
void put_LockFree Put value to map. Not thread-safe.
bool putIfNotExists Put value to map if not already exists.
bool putIfNotExists_LockFree Put value to map if not already exists. Not thread-safe.
String get Get value as oatpp::String.
T getAsMemoryLabel Get value as a memory label.
T getAsMemoryLabel_Unsafe Get value as a memory label without allocating memory for value.
const std::unordered_map<Key, StringKeyLabel>& getAll Get map of all values.
const std::unordered_map<Key, StringKeyLabel>& getAll_Unsafe Get map of all values without allocating memory for those keys/values.
v_int32 getSize Get number of entries in the map.

# LazyStringMap::LazyStringMap

  1. Constructor.
    LazyStringMap()
      : m_fullyInitialized(true)
    
  2. Copy-constructor.
    • @param other
    LazyStringMap(const LazyStringMap& other)
    
  3. Move constructor.
    • @param other
    LazyStringMap(LazyStringMap&& other)
    

# LazyStringMap::put

Put value to map.

  • @param key
  • @param value

void put(const Key& key, const StringKeyLabel& value)

# LazyStringMap::put_LockFree

Put value to map. Not thread-safe.

  • @param key
  • @param value

void put_LockFree(const Key& key, const StringKeyLabel& value)

# LazyStringMap::putIfNotExists

Put value to map if not already exists.

  • @param key
  • @param value
  • @return

bool putIfNotExists(const Key& key, const StringKeyLabel& value)

# LazyStringMap::putIfNotExists_LockFree

Put value to map if not already exists. Not thread-safe.

  • @param key
  • @param value
  • @return

bool putIfNotExists_LockFree(const Key& key, const StringKeyLabel& value)

# LazyStringMap::get

Get value as oatpp::String.

  • @param key
  • @return

String get(const Key& key) const

# LazyStringMap::getAsMemoryLabel

Get value as a memory label.

template<class T>
T getAsMemoryLabel(const Key& key) const

# LazyStringMap::getAsMemoryLabel_Unsafe

Get value as a memory label without allocating memory for value.

template<class T>
T getAsMemoryLabel_Unsafe(const Key& key) const

# LazyStringMap::getAll

Get map of all values.

  • @return

const std::unordered_map<Key, StringKeyLabel>& getAll() const

# LazyStringMap::getAll_Unsafe

Get map of all values without allocating memory for those keys/values.

  • @return

const std::unordered_map<Key, StringKeyLabel>& getAll_Unsafe() const

# LazyStringMap::getSize

Get number of entries in the map.

  • @return

v_int32 getSize() const