61 _mem = std::make_shared<container::stable_reference_buffer>(ptr);
83 : _ptr((void*)mem.get())
103 template <
typename T>
105 : _ptr(static_cast<void*>(ptr.get()))
106 , _holder(new std::shared_ptr<T>(ptr))
125 operator void*()
const
144 _holder = other._holder;
147 _mem = std::make_shared<container::stable_reference_buffer>(*other._mem);
167 throw cbeam::error::runtime_error(
"cbeam::pointer(\"" + (std::string) *
this +
"\") is not an cbeam::container::stable_reference_buffer");
177 explicit operator std::string()
const
184 std::shared_ptr<container::stable_reference_buffer> _mem;
185 std::shared_ptr<void> _holder;
197 os << static_cast<std::string>(p);
210 return static_cast<void*
>(lhs) ==
static_cast<void*
>(rhs);
218 return !(lhs == rhs);
228 return static_cast<void*
>(lhs) <
static_cast<void*
>(rhs);
236 return (lhs == rhs) || (lhs < rhs);
244 return !(lhs <= rhs);
Manages memory buffers with stable reference counting, optimized for shared library contexts.
Definition stable_reference_buffer.hpp:63
static bool is_known(const void *address)
return if the given address is one of the managed addresses
Definition stable_reference_buffer.hpp:305
A Cbeam-specific runtime error that also acts like std::runtime_error.
Definition runtime_error.hpp:46
The pointer class is one of the types supported by container::xpod::type.
Definition pointer.hpp:46
pointer(void *ptr)
Construct from the given raw pointer. Checks if this ptr is managed by stable_reference_buffer.
Definition pointer.hpp:56
pointer(const std::shared_ptr< T > &ptr)
Definition pointer.hpp:104
pointer(const container::stable_reference_buffer &mem)
Construct from an existing stable_reference_buffer, incrementing its reference counter.
Definition pointer.hpp:82
bool is_managed() const
Checks whether the pointer is managed by stable_reference_buffer (or a std::shared_ptr) or not.
Definition pointer.hpp:115
pointer & operator=(const pointer &other)
Copy assignment operator. Increments the reference counter if the other pointer is managed.
Definition pointer.hpp:136
pointer(const std::string &str_ptr)
Construct from the given pointer in string representation (e.g. "0x...").
Definition pointer.hpp:72
operator container::stable_reference_buffer() const
Converts the pointer to a stable_reference_buffer if it is managed, otherwise throws a runtime_error.
Definition pointer.hpp:163
Offers advanced container types with unique approaches to stability and interprocess sharing....
Definition buffer.hpp:44
Contains conversion utilities to transform data between different formats and types....
Definition buffer.hpp:35
std::string to_string(const container::buffer &b)
Creates a std::string from the contents of a container::buffer.
Definition buffer.hpp:42
Houses abstractions for shared-memory and interprocess data exchange. This includes interprocess_shar...
Definition interprocess_shared_memory.hpp:49
bool operator>(const pointer &lhs, const pointer &rhs)
Greater-than comparison operator for pointer.
Definition pointer.hpp:242
bool operator<(const pointer &lhs, const pointer &rhs)
Less-than comparison operator for pointer.
Definition pointer.hpp:226
bool operator<=(const pointer &lhs, const pointer &rhs)
Less-or-equal comparison operator for pointer.
Definition pointer.hpp:234
std::ostream & operator<<(std::ostream &os, const pointer &p)
Outputs the pointer object as its hex string representation.
Definition pointer.hpp:195
bool operator!=(const pointer &lhs, const pointer &rhs)
Inequality comparison operator for pointer.
Definition pointer.hpp:216
bool operator==(const pointer &lhs, const pointer &rhs)
Equality comparison operator for pointer.
Definition pointer.hpp:208
bool operator>=(const pointer &lhs, const pointer &rhs)
Greater-or-equal comparison operator for pointer.
Definition pointer.hpp:250