RWLEnvelope API Documentation


Welcome to RWLEnvelope Documentation
This is the complete API documentation for RWLEnvelope, a header-only C++ template library providing thread-safe access to objects using reader-writer locks.
Quick Navigation
What is RWLEnvelope?
RWLEnvelope simplifies thread-safe access to shared objects by:
- Wrapping your object with automatic lock management
- Providing clear APIs:
observe() for reads, mutate() for writes
- Ensuring thread safety: Multiple concurrent readers, exclusive writers
- Maintaining exception safety: Locks released properly even if callbacks throw
Quick Example
#include "siddiqsoft/RWLEnvelope.hpp"
siddiqsoft::RWLEnvelope<std::map<std::string, int>> data;
// Read-only access (multiple threads can do this concurrently)
data.observe([](const auto& m) noexcept {
return m.find("key") != m.end();
});
// Read-write access (exclusive access)
data.mutate([](auto& m) noexcept {
m["key"] = 42;
});
Key Features
- ✅ Header-only - No compilation needed
- ✅ C++20 - Uses modern C++ concepts
- ✅ Zero overhead - No runtime cost beyond std::shared_mutex
- ✅ Exception safe - RAII semantics ensure proper cleanup
- ✅ Works with any type - Not limited to specific containers
Documentation Structure
The documentation is organized as follows:
- Main Page - Overview and core concepts
- Classes - RWLEnvelope class template documentation
- Namespaces - siddiqsoft namespace
- Files - Source file listings
- Examples - Code examples and usage patterns
Requirements
- C++ Standard: C++20 or later
- Compiler: Must support C++20 concepts and
[[nodiscard]] attribute
- Headers:
<shared_mutex>, <functional>, <tuple>, <utility>, <concepts>
Installation
Via NuGet:
Install-Package SiddiqSoft.RWLEnvelope
Header-only:
Copy include/siddiqsoft/RWLEnvelope.hpp to your project.
Getting Started
- Read the API Reference for complete documentation
- Check the Examples for common usage patterns
- Review Performance Considerations for best practices
- See Limitations for important constraints
Support
License
BSD 3-Clause License - See LICENSE for details.
Generated with Doxygen and Doxygen Awesome CSS