A dynamically typed reference to data with automatic memory management and read/write locking semantic. More...
Public Member Functions | |
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... | |
Public Member Functions inherited from PDI::Reference_base | |
const Datatype & | type () const noexcept |
accesses the type of the referenced raw data More... | |
size_t | hash () const noexcept |
Additional Inherited Members | |
Protected Member Functions inherited from PDI::Reference_base | |
Reference_base () noexcept | |
Constructs a null reference. More... | |
Reference_base (const Reference_base &)=delete | |
Reference_base (Reference_base &&)=delete | |
Reference_base & | operator= (const Reference_base &)=delete |
Reference_base & | operator= (Reference_base &&)=delete |
Static Protected Member Functions inherited from PDI::Reference_base | |
static Referenced_data * | get_content (const Reference_base &other) noexcept |
Function to access the content from a reference with different access right. More... | |
static Ref | do_copy (Ref_r ref) |
Protected Attributes inherited from PDI::Reference_base | |
Referenced_data * | m_content |
Pointer on the data content, can be null if the ref is null. More... | |
A dynamically typed reference to data with automatic memory management and read/write locking semantic.
Ref_any is a smart pointer that features:
|
default |
Constructs a null reference.
|
inlinenoexcept |
Copies an existing reference.
if the requested rights can not be granted, the reference is made null
other | the ref to copy |
|
inlinenoexcept |
Copies an existing reference with different privileges.
if the requested rights can not be granted, the reference is made null
other | the ref to copy |
|
inlinenoexcept |
Moves an existing reference.
other | the ref to copy |
|
inline |
Creates a reference to currently unreferenced data.
data | the raw data to reference |
freefunc | the function to use to free the data buffer |
type | the type of the referenced data, ownership will be taken |
readable | the maximum allowed access to the underlying content |
writable | the maximum allowed access to the underlying content |
|
inline |
Creates a subreference from reference.
other | source reference |
accessor | accessor to use to create subreference |
|
inline |
Creates a subreference from reference.
other | source reference |
accessors | vector of accessor to use to create subreference |
|
inline |
Destructor.
|
inlinenoexcept |
|
inlinenoexcept |
|
inlinenoexcept |
|
inlinenoexcept |
|
inlinenoexcept |
|
inlinenoexcept |
|
inlinenoexcept |
|
inlinenoexcept |
|
inline |
Create a sub-reference to a member in case the content behind the ref is a record.
member_name | member to make a subref for |
|
inline |
Create a sub-reference to a member in case the content behind the ref is a record.
member_name | member to make a subref for |
|
inline |
Create a sub-reference to the content at a given index in case the content behind the ref is an array.
index | index to make a subref for |
|
inline |
Create a sub-reference to the content at a given slice in case the content behind the ref is an array.
slice | pair with start and end index |
|
inline |
Offers access to the referenced raw data.
|
inline |
Offers access to the referenced raw data, throws on null references.
|
inlinenoexcept |
Offers access to the referenced raw data, returns null for null references.
Returns a scalar value of type T taken from the data buffer.
|
inlinenoexcept |
Checks whether this is a null reference.
|
inlinenoexcept |
Nullify the reference.
|
inline |
Makes a copy of the raw content behind this reference and returns a new reference.
|
inlinenoexcept |
Releases ownership of the referenced raw data by nullifying all existing references.
|
inlinenoexcept |
Registers a nullification callback.
notifier | the function to call when this reference becomes null |