|
Pigweed
|
Provides basic helpers for reading and writing UTF-8 encoded strings. More...
Typedefs | |
| template<typename T > | |
| using | AlignedAtomic = std::atomic< NaturallyAligned< T > > |
| template<typename T , size_t kCapacity = containers::internal::kGenericSized> | |
| using | InlineDeque = BasicInlineDeque< T, uint16_t, kCapacity > |
| template<typename T , size_t kCapacity = containers::internal::kGenericSized> | |
| using | InlineQueue = BasicInlineQueue< T, uint16_t, kCapacity > |
| template<size_t kMaxSizeBytes = containers::internal::kGenericSized> | |
| using | InlineVarLenEntryQueue = BasicInlineVarLenEntryQueue< std::byte, kMaxSizeBytes > |
Variable-length entry queue that uses std::byte for the byte type. | |
| template<typename FunctionType , std::size_t inline_target_size = function_internal::config::kInlineCallableSize, typename Allocator = PW_FUNCTION_DEFAULT_ALLOCATOR_TYPE> | |
| using | Function = fit::function_impl< inline_target_size, !function_internal::config::kEnableDynamicAllocation, FunctionType, Allocator > |
| template<typename FunctionType , std::size_t inline_target_size = function_internal::config::kInlineCallableSize> | |
| using | InlineFunction = fit::inline_function< FunctionType, inline_target_size > |
| using | Closure = Function< void()> |
| template<typename FunctionType , std::size_t inline_target_size = function_internal::config::kInlineCallableSize, typename Allocator = PW_FUNCTION_DEFAULT_ALLOCATOR_TYPE> | |
| using | Callback = fit::callback_impl< inline_target_size, !function_internal::config::kEnableDynamicAllocation, FunctionType, Allocator > |
| template<typename FunctionType , std::size_t inline_target_size = function_internal::config::kInlineCallableSize> | |
| using | InlineCallback = fit::inline_callback< FunctionType, inline_target_size > |
Version of pw::Callback that exclusively uses inline storage. | |
| template<size_t kCapacity = string_impl::kGeneric> | |
| using | InlineString = InlineBasicString< char, kCapacity > |
pw::InlineString is an alias of pw::InlineBasicString<char> and is equivalent to std::string. | |
| template<size_t kCapacity = string_impl::kGeneric> | |
| using | InlineByteString = InlineBasicString< std::byte, kCapacity > |
pw::InlineByteString is an alias of pw::InlineBasicString<std::byte>. InlineByteString may be used as a simple, efficient byte container. | |
Functions | |
| constexpr size_t | countl_zero (size_t x) noexcept |
| constexpr size_t | bit_width (size_t x) noexcept |
| constexpr size_t | bit_ceil (size_t x) noexcept |
| class pw::Deallocator | DoGetInfo (InfoType info_type, const void *ptr) override |
| template<> | |
| StatusWithSize | ToString (const async2::ReadyType &, span< char > buffer) |
| template<> | |
| StatusWithSize | ToString (const async2::PendingType &, span< char > buffer) |
| template<typename T > | |
| StatusWithSize | ToString (const async2::Poll< T > &poll, span< char > buffer) |
| template<> | |
| StatusWithSize | ToString (const async2::Poll<> &poll, span< char > buffer) |
| constexpr size_t | AlignDown (size_t value, size_t alignment) |
| Returns the value rounded down to the nearest multiple of alignment. | |
| template<typename T > | |
| constexpr T * | AlignDown (T *value, size_t alignment) |
| Returns the value rounded down to the nearest multiple of alignment. | |
| constexpr size_t | AlignUp (size_t value, size_t alignment) |
| Returns the value rounded up to the nearest multiple of alignment. | |
| template<typename T > | |
| constexpr T * | AlignUp (T *value, size_t alignment) |
| Returns the value rounded up to the nearest multiple of alignment. | |
| constexpr size_t | Padding (size_t length, size_t alignment) |
| Returns the number of padding bytes required to align the provided length. | |
| ByteSpan | GetAlignedSubspan (ByteSpan bytes, size_t alignment) |
| constexpr ByteBuilder::iterator | operator+ (int n, ByteBuilder::iterator it) |
| template<auto method, typename T > | |
| auto | bind_member (T *instance) |
| template<typename Function > | |
| ScopeGuard (Function()) -> ScopeGuard< Function(*)()> | |
| constexpr Status | OkStatus () |
| constexpr bool | operator== (const Status &lhs, const Status &rhs) |
| constexpr bool | operator!= (const Status &lhs, const Status &rhs) |
| template<typename T , size_t kLhsCapacity, size_t kRhsCapacity> | |
| constexpr bool | operator== (const InlineBasicString< T, kLhsCapacity > &lhs, const InlineBasicString< T, kRhsCapacity > &rhs) noexcept |
| template<typename T , size_t kLhsCapacity, size_t kRhsCapacity> | |
| constexpr bool | operator!= (const InlineBasicString< T, kLhsCapacity > &lhs, const InlineBasicString< T, kRhsCapacity > &rhs) noexcept |
| template<typename T , size_t kLhsCapacity, size_t kRhsCapacity> | |
| constexpr bool | operator< (const InlineBasicString< T, kLhsCapacity > &lhs, const InlineBasicString< T, kRhsCapacity > &rhs) noexcept |
| template<typename T , size_t kLhsCapacity, size_t kRhsCapacity> | |
| constexpr bool | operator<= (const InlineBasicString< T, kLhsCapacity > &lhs, const InlineBasicString< T, kRhsCapacity > &rhs) noexcept |
| template<typename T , size_t kLhsCapacity, size_t kRhsCapacity> | |
| constexpr bool | operator> (const InlineBasicString< T, kLhsCapacity > &lhs, const InlineBasicString< T, kRhsCapacity > &rhs) noexcept |
| template<typename T , size_t kLhsCapacity, size_t kRhsCapacity> | |
| constexpr bool | operator>= (const InlineBasicString< T, kLhsCapacity > &lhs, const InlineBasicString< T, kRhsCapacity > &rhs) noexcept |
| template<typename T , size_t kLhsCapacity> | |
| constexpr bool | operator== (const InlineBasicString< T, kLhsCapacity > &lhs, const T *rhs) |
| template<typename T , size_t kRhsCapacity> | |
| constexpr bool | operator== (const T *lhs, const InlineBasicString< T, kRhsCapacity > &rhs) |
| template<typename T , size_t kLhsCapacity> | |
| constexpr bool | operator!= (const InlineBasicString< T, kLhsCapacity > &lhs, const T *rhs) |
| template<typename T , size_t kRhsCapacity> | |
| constexpr bool | operator!= (const T *lhs, const InlineBasicString< T, kRhsCapacity > &rhs) |
| template<typename T , size_t kLhsCapacity> | |
| constexpr bool | operator< (const InlineBasicString< T, kLhsCapacity > &lhs, const T *rhs) |
| template<typename T , size_t kRhsCapacity> | |
| constexpr bool | operator< (const T *lhs, const InlineBasicString< T, kRhsCapacity > &rhs) |
| template<typename T , size_t kLhsCapacity> | |
| constexpr bool | operator<= (const InlineBasicString< T, kLhsCapacity > &lhs, const T *rhs) |
| template<typename T , size_t kRhsCapacity> | |
| constexpr bool | operator<= (const T *lhs, const InlineBasicString< T, kRhsCapacity > &rhs) |
| template<typename T , size_t kLhsCapacity> | |
| constexpr bool | operator> (const InlineBasicString< T, kLhsCapacity > &lhs, const T *rhs) |
| template<typename T , size_t kRhsCapacity> | |
| constexpr bool | operator> (const T *lhs, const InlineBasicString< T, kRhsCapacity > &rhs) |
| template<typename T , size_t kLhsCapacity> | |
| constexpr bool | operator>= (const InlineBasicString< T, kLhsCapacity > &lhs, const T *rhs) |
| template<typename T , size_t kRhsCapacity> | |
| constexpr bool | operator>= (const T *lhs, const InlineBasicString< T, kRhsCapacity > &rhs) |
| template<size_t kBufferSize = 0u, typename... Args> | |
| auto | MakeString (Args &&... args) |
| system::AsyncCore & | System () |
| void | SystemStart (channel::ByteReaderWriter &io_channel) |
Provides basic helpers for reading and writing UTF-8 encoded strings.
| using pw::Callback = typedef fit::callback_impl< inline_target_size, !function_internal::config::kEnableDynamicAllocation, FunctionType, Allocator> |
pw::Callback is identical to
embed:rst:inline :cpp:type:`pw::Function`
except:
pw::Callback, the target function held by the pw::Callback cannot be called again.pw::Callback is invoked for the first time, the target function is released and destructed, along with any resources owned by that function (typically the objects captured by a lambda).A pw::Callback in the "already called" state has the same state as a pw::Callback that has been assigned to nullptr.
| using pw::Function = typedef fit::function_impl< inline_target_size, !function_internal::config::kEnableDynamicAllocation, FunctionType, Allocator> |
pw::Function is a wrapper for an arbitrary callable object. It can be used by callback-based APIs to allow callers to provide any type of callable.
Example:
| using pw::InlineDeque = typedef BasicInlineDeque<T, uint16_t, kCapacity> |
The InlineDeque class is similar to the STL's double ended queue (std::deque), except it is backed by a fixed-size buffer. InlineDeque's must be declared with an explicit maximum size (e.g. InlineDeque<int, 10>>) but deques can be used and referred to without the max size template parameter (e.g. InlineDeque<int>).
To allow referring to a pw::InlineDeque without an explicit maximum size, all InlineDeque classes inherit from the BasicInlineDequeStorage class, which in turn inherits from InlineDeque<T>, which stores the maximum size in a variable. This allows InlineDeques to be used without having to know their maximum size at compile time. It also keeps code size small since function implementations are shared for all maximum sizes.
| using pw::InlineFunction = typedef fit::inline_function<FunctionType, inline_target_size> |
Version of pw::Function that exclusively uses inline storage.
IMPORTANT: If pw::Function is configured to allow dynamic allocations then any attempt to convert pw::InlineFunction to pw::Function will ALWAYS allocate.
| using pw::InlineQueue = typedef BasicInlineQueue<T, uint16_t, kCapacity> |
The InlineQueue class is similar to std::queue<T, std::deque>, except it is backed by a fixed-size buffer. InlineQueue's must be declared with an explicit maximum size (e.g. InlineQueue<int, 10>>) but deques can be used and referred to without the max size template parameter (e.g. InlineQueue<int>).
pw::InlineQueue is wrapper around pw::InlineDeque with a simplified API and push_overwrite() & emplace_overwrite() helpers.
| auto pw::bind_member | ( | T * | instance | ) |
Returns a Callable which, when called, invokes method on instance using the arguments provided.
This is useful for binding the this argument of a callable.
pw::bind_member<&T::MethodName>(instance) is roughly equivalent to [instance](Arg arg1, ...) { instance->MethodName(arg1, ...) }, albeit with proper support for overloads and argument forwarding.
| ByteSpan pw::GetAlignedSubspan | ( | ByteSpan | bytes, |
| size_t | alignment | ||
| ) |
Returns the largest aligned subspan of a given byte span.
The subspan will start and end on alignment boundaries.
ByteSpan within bytes aligned to alignment, or an empty ByteSpan if alignment was not possible.
|
constexpr |
Returns an
embed:rst:inline :c:enumerator:`OK`
status. Equivalent to Status() or Status(PW_STATUS_OK). This function is used instead of a Status::Ok() function, which would be too similar to Status::ok().
|
inline |
Returns a reference to the global pw_system instance. pw::System() provides several features for applications: a memory allocator, an async dispatcher, and a RPC server.
| void pw::SystemStart | ( | channel::ByteReaderWriter & | io_channel | ) |
Starts running pw_system:async with the provided IO channel. This function never returns.