A dynamically typed reference to data with automatic memory management and read/write locking semantic.
More...
|
| Ref_any ()=default |
| Constructs a null reference. More...
|
|
| Ref_any (const Ref_any &other) noexcept |
| Copies an existing reference. More...
|
|
template<bool OR, bool OW> |
| Ref_any (const Ref_any< OR, OW > &other) noexcept |
| Copies an existing reference with different privileges. More...
|
|
| Ref_any (Ref_any &&other) noexcept |
| Moves an existing reference. More...
|
|
| Ref_any (void *data, std::function< void(void *)> freefunc, Datatype_uptr type, bool readable, bool writable) |
| Creates a reference to currently unreferenced data. More...
|
|
| Ref_any (Ref other, const Datatype::Accessor_base &accessor) |
| Creates a subreference from reference. More...
|
|
| Ref_any (Ref other, const std::vector< std::unique_ptr< Datatype::Accessor_base >> &accessors) |
| Creates a subreference from reference. More...
|
|
| ~Ref_any () |
| Destructor. More...
|
|
Ref_any & | operator= (Ref_any &&other) noexcept |
|
Ref_any & | operator= (const Ref_any &other) const noexcept |
|
bool | operator== (const Reference_base &o) const noexcept |
|
bool | operator!= (const Reference_base &o) const noexcept |
|
bool | operator< (const Reference_base &o) const noexcept |
|
bool | operator> (const Reference_base &o) const noexcept |
|
bool | operator<= (const Reference_base &o) const noexcept |
|
bool | operator>= (const Reference_base &o) const noexcept |
|
Ref | operator[] (const std::string &member_name) const |
| Create a sub-reference to a member in case the content behind the ref is a record. More...
|
|
Ref | operator[] (const char *member_name) const |
| Create a sub-reference to a member in case the content behind the ref is a record. More...
|
|
Ref | operator[] (std::size_t index) const |
| Create a sub-reference to the content at a given index in case the content behind the ref is an array. More...
|
|
Ref | operator[] (std::pair< std::size_t, std::size_t > slice) const |
| Create a sub-reference to the content at a given slice in case the content behind the ref is an array. More...
|
|
| operator typename Ref_access< R, W >::type () const |
| Offers access to the referenced raw data. More...
|
|
Ref_access< R, W >::type | get () const |
| Offers access to the referenced raw data, throws on null references. More...
|
|
Ref_access< R, W >::type | get (std::nothrow_t) const noexcept |
| Offers access to the referenced raw data, returns null for null references. More...
|
|
template<class T > |
T | scalar_value () |
| Returns a scalar value of type T taken from the data buffer. More...
|
|
| operator bool () const noexcept |
| Checks whether this is a null reference. More...
|
|
void | reset () noexcept |
| Nullify the reference. More...
|
|
Ref | copy () const |
| Makes a copy of the raw content behind this reference and returns a new reference. More...
|
|
void * | release () noexcept |
| Releases ownership of the referenced raw data by nullifying all existing references. More...
|
|
void | on_nullify (std::function< void(Ref)> notifier) const noexcept |
| Registers a nullification callback. More...
|
|
const Datatype & | type () const noexcept |
| accesses the type of the referenced raw data More...
|
|
size_t | hash () const noexcept |
|
template<bool R, bool W>
class PDI::Ref_any< R, W >
A dynamically typed reference to data with automatic memory management and read/write locking semantic.
Ref_any is a smart pointer that features:
- a dynamic type system,
- garbage collection mechanism similar to std::shared_ptr,
- a read/write locking mechanism similar to std::shared_mutex,
- a release system that nullifies all existing references to the raw data,
- a notification system to be notified when a reference is going to be nullified.
- Warning
- As of now, and unlike std::shared_ptr, the lock system can not be relied upon in a multithreaded environment.