userver: Containers
Loading...
Searching...
No Matches
Containers

Detailed Description

Utility containers.

+ Collaboration diagram for Containers:

Classes

class  cache::LruMap< T, U, Hash, Equal >
 
class  cache::LruSet< T, Hash, Equal >
 
class  crypto::Certificate
 
class  crypto::PrivateKey
 
class  crypto::PublicKey
 
class  decimal64::Decimal< Prec, RoundPolicy_ >
 Fixed-point decimal data type for use in deterministic calculations, oftentimes involving money. More...
 
class  formats::json::StringBuilder
 SAX like builder of JSON string. Use with extreme caution and only in performance critical part of your code. More...
 
class  formats::json::Value
 Non-mutable JSON value representation. More...
 
class  formats::json::ValueBuilder
 Builder for JSON. More...
 
class  formats::yaml::Value
 Non-mutable YAML value representation. More...
 
class  formats::yaml::ValueBuilder
 Builder for YAML. More...
 
class  fs::blocking::CFile
 A std::FILE* wrapper. More...
 
class  fs::blocking::FileDescriptor
 A file descriptor wrapper. More...
 
class  fs::blocking::TempDirectory
 A unique directory for temporary files. The directory is deleted when the TempDirectory is destroyed. More...
 
class  fs::blocking::TempFile
 A unique temporary file. The file is deleted when the TempFile object is destroyed. More...
 
class  http::ContentType
 Content-Type representation. More...
 
class  http::headers::HeaderMap
 Container that maps case-insensitive header name into header value. More...
 
class  http::headers::PredefinedHeader
 A struct to represent compile-time known header name. More...
 
class  utils::AnyMovable
 Replacement for std::any that is not copyable. It allows to store non-copyable and even non-movable types. More...
 
class  utils::AnyStorage< StorageTag >
 map-like heterogeneous data storage More...
 
class  utils::CheckedPtr< T >
 Utility template for returning a pointer to an object that is owned by someone else; throws std::runtime_error if nullptr is stored. More...
 
class  utils::datetime::Date
 Date in format YYYY-MM-DD, std::chrono::year_month_day like type. More...
 
class  utils::DefaultDict< ValueType >
 Dictionary that for missing keys falls back to a default value stored by key utils::kDefaultDictDefaultName. More...
 
class  utils::expected< S, E >
 For holding a value or an error. More...
 
class  utils::FastPimpl< T, Size, Alignment, Strict >
 Implements pimpl idiom without dynamic memory allocation. More...
 
class  utils::FastScopeGuard< Callback >
 a helper class to perform actions on scope exit More...
 
class  utils::FixedArray< T >
 A fixed-size array with the size determined at runtime. More...
 
class  utils::Flags< Enum >
 Wrapper to extend enum with flags interface. More...
 
class  utils::AtomicFlags< Enum >
 Wrapper to extend enum with atomic flags interface. More...
 
class  utils::ip::AddressBase< N >
 Base class for IPv4/IPv6 addresses. More...
 
class  utils::ip::NetworkBase< Address, typename >
 Base class for IPv4/IPv6 network. More...
 
class  utils::ip::InetNetwork
 INET IPv4/IPv4 network. More...
 
class  utils::MacaddrBase< N >
 Base class for Macaddr/Macaddr8. More...
 
class  utils::NotNull< T >
 Restricts a pointer or smart pointer to only hold non-null values. More...
 
class  utils::OptionalRef< T >
 Class that behaves as a nullable reference. Main difference from the pointer - value comparison of pointed values. More...
 
class  utils::regex
 Small alias for boost::regex / std::regex without huge includes. More...
 
class  utils::ResultStore< T >
 
class  utils::ResultStore< void >
 
class  utils::ScopeGuard
 a helper class to perform actions on scope exit More...
 
class  utils::SharedReadablePtr< T >
 std::shared_ptr<const T> wrapper that makes sure that the pointer is stored before dereferencing. Protects from dangling references: More...
 
class  utils::SlidingInterval< T >
 Sliding interval of values that provides functions to compute average, min and max values from the last window_size values of interval. More...
 
class  utils::SmallString< N >
 An alternative to std::string with a custom SSO (small string optimization) container size. Unlike std::string, SmallString is not null-terminated thus it has no c_str(), data() returns a not null-terminated buffer. More...
 
class  utils::StrongTypedef< Tag, T, Ops, class >
 Strong typedef for a type T. More...
 
class  utils::datetime::TimeOfDay< Duration >
 A simple implementation of a "time since midnight" datatype. More...
 
class  utils::TrivialBiMap< BuilderFunc >
 Bidirectional unordered map for trivial types, including string literals; could be efficiently used as a unordered non-bidirectional map. More...
 
class  utils::TrivialSet< BuilderFunc >
 Unordered set for trivial types, including string literals. More...
 
class  cache::ExpirableLruCache< Key, Value, Hash, Equal >
 Class for expirable LRU cache. Use cache::LruMap for not expirable LRU Cache. More...
 
class  cache::NWayLRU< T, U, Hash, Equal >
 
class  concurrent::BackgroundTaskStorageCore
 
class  concurrent::BackgroundTaskStorage
 
class  concurrent::MutexSet< Key, Hash, Equal >
 A dynamic set of mutexes. More...
 
class  concurrent::Variable< Data, Mutex >
 
class  fs::TempFile
 A unique temporary file. The file is deleted when the TempFile object is destroyed. More...
 
class  rcu::Variable< T, RcuTraits >
 Read-Copy-Update variable. More...
 
class  rcu::RcuMap< Key, Value, RcuMapTraits >
 Map-like structure allowing RCU keyset updates. More...
 
class  server::http::Cookie
 HTTP response cookie. More...
 
class  utils::LazySharedPtr< T >
 A lazy wrapper around utils::SharedReadablePtr that fetches the data on first access. More...
 
class  storages::postgres::ParameterStore
 Class for dynamic PostgreSQL parameter list construction. More...
 

Typedefs

using utils::ip::AddressV4 = AddressBase<4>
 IPv4 address in network bytes order.
 
using utils::ip::AddressV6 = AddressBase<16>
 IPv6 address in network bytes order.
 
using utils::ip::NetworkV4 = NetworkBase<AddressV4>
 IPv4 network.
 
using utils::ip::NetworkV6 = NetworkBase<AddressV6>
 IPv6 network.
 
using utils::Macaddr = MacaddrBase<6>
 48-bit MAC address
 
using utils::Macaddr8 = MacaddrBase<8>
 64-bit MAC address
 
template<typename U >
using utils::SharedRef = NotNull<std::shared_ptr<U>>
 A std::shared_ptr that is guaranteed to be not-null.
 
template<typename U >
using utils::UniqueRef = NotNull<std::unique_ptr<U>>
 A std::unique_ptr that is guaranteed to be not-null.
 
template<typename Value , auto Projection, typename Hash = void, typename Equal = std::equal_to<>, typename Allocator = std::allocator<Value>>
using utils::ProjectedUnorderedSet
 A std::unordered_set that compares its elements (of type Value) based on their Projection. It allows to create, essentially, an equivalent of std::unordered_map where keys are stored inside values.
 
template<typename Value , auto Projection, typename Compare = std::less<>, typename Allocator = std::allocator<Value>>
using utils::ProjectedSet
 Same as ProjectedUnorderedSet, but for std::set.
 

Enumerations

enum class  utils::BytesPerSecond : long long
 Data type that represents bytes per second unit. More...
 

Typedef Documentation

◆ AddressV4

IPv4 address in network bytes order.

Definition at line 55 of file ip.hpp.

◆ AddressV6

IPv6 address in network bytes order.

Definition at line 60 of file ip.hpp.

◆ Macaddr

48-bit MAC address

Definition at line 52 of file macaddr.hpp.

◆ Macaddr8

64-bit MAC address

Definition at line 57 of file macaddr.hpp.

◆ NetworkV4

IPv4 network.

Definition at line 127 of file ip.hpp.

◆ NetworkV6

IPv6 network.

Definition at line 132 of file ip.hpp.

◆ ProjectedSet

template<typename Value , auto Projection, typename Compare = std::less<>, typename Allocator = std::allocator<Value>>
using utils::ProjectedSet
Initial value:
std::set<Value, impl::projected_set::Compare<Value, Projection, Compare>,
Allocator>

Same as ProjectedUnorderedSet, but for std::set.

Definition at line 97 of file projected_set.hpp.

◆ ProjectedUnorderedSet

template<typename Value , auto Projection, typename Hash = void, typename Equal = std::equal_to<>, typename Allocator = std::allocator<Value>>
using utils::ProjectedUnorderedSet
Initial value:
std::unordered_set<
Value, impl::projected_set::Hash<Value, Projection, Hash>,
impl::projected_set::Compare<Value, Projection, Equal>, Allocator>

A std::unordered_set that compares its elements (of type Value) based on their Projection. It allows to create, essentially, an equivalent of std::unordered_map where keys are stored inside values.

Usage example:

struct User {
std::string username;
std::string first_name;
int age{};
};
inline constexpr auto kUserKey = &User::username;
UserProjectedSet set;
set.insert({"fabulous_tony", "Anthony", 17});
set.insert({"sassy_nancy", "Anne", 71});
EXPECT_EQ(set.find("sassy_nancy")->first_name, "Anne");
EXPECT_EQ(set.find("meaning_of_life"), set.end());

Definition at line 89 of file projected_set.hpp.

◆ SharedRef

template<typename U >
using utils::SharedRef = NotNull<std::shared_ptr<U>>

A std::shared_ptr that is guaranteed to be not-null.

See also
MakeSharedRef

Definition at line 108 of file not_null.hpp.

◆ UniqueRef

template<typename U >
using utils::UniqueRef = NotNull<std::unique_ptr<U>>

A std::unique_ptr that is guaranteed to be not-null.

See also
MakeUniqueRef

Definition at line 115 of file not_null.hpp.

Enumeration Type Documentation

◆ BytesPerSecond

Data type that represents bytes per second unit.

Definition at line 18 of file bytes_per_second.hpp.