The classes provided here support conventional modern C++ library design principles for component software to achieve binary compatibility across shared library boundaries and future extensibility. More...
Classes | |
class | mi::base::Handle<Interface> |
Handle class template for interfaces, automatizing the lifetime control via reference counting. More... | |
class | mi::base::IInterface |
The basic extensible interface. More... | |
class | mi::base::Interface_declare< id1, ... > |
Mixin class template for deriving new interface declarations. More... | |
class | mi::base::Interface_implement<I> |
Mixin class template for deriving interface implementations. More... | |
class | mi::base::Interface_implement_2<I1, I2> |
Mixin class template for deriving interface implementations from two interfaces. More... | |
class | mi::base::Interface_implement_singleton<I> |
Mixin class template for deriving singleton interface implementations, where the reference count is fixed to one. More... | |
class | mi::base::Interface_merger<MAJOR, MINOR> |
This mixin merges the implementation of one interface with a second interface. More... | |
struct | mi::base::Uuid |
A 128 bit representation of a universally unique identifier (UUID or GUID). More... | |
class | mi::base::Uuid_t< id1, ... > |
Class template for a compile-time representation of universally unique identifiers (UUIDs or GUIDs). More... | |
Typedefs | |
typedef const Dup_interface_helper * | mi::base::Dup_interface |
Type for a symbolic constant to trigger a special constructor in the Handle class. More... | |
typedef Handle<Interface> | mi::base::Handle<Interface>::Self |
Own type. More... | |
typedef Interface | mi::base::Handle<Interface>::Interface_type |
Type of the underlying interface. More... | |
typedef Interface | mi::base::Handle<Interface>::value_type |
Type of the underlying interface. More... | |
typedef Difference | mi::base::Handle<Interface>::difference_type |
Difference type (signed integral type to hold pointer differences). More... | |
typedef Interface * | mi::base::Handle<Interface>::pointer |
Mutable-pointer type to underlying interface. More... | |
typedef Interface & | mi::base::Handle<Interface>::reference |
Mutable-reference type to underlying interface. More... | |
typedef bool(Handle::* | mi::base::Handle<Interface>::bool_conversion_support) () const |
Helper typedef. More... | |
typedef Uuid_t<0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0> | mi::base::IInterface::IID |
Declares the interface ID (IID) of this interface. More... | |
typedef Interface_declare< id1, ... > | mi::base::Interface_declare< id1, ... >::Self |
Own type. More... | |
typedef Uuid_t< id1, ... > | mi::base::Interface_declare< id1, ... >::IID |
Declares the interface ID (IID) of this interface. More... | |
typedef MAJOR | mi::base::Interface_merger<MAJOR, MINOR>::MAJOR_BASE |
Typedef for the MAJOR base class. More... | |
typedef MINOR | mi::base::Interface_merger<MAJOR, MINOR>::MINOR_BASE |
Typedef for the MINOR base class. More... | |
typedef Interface_merger<MAJOR, MINOR> | mi::base::Interface_merger<MAJOR, MINOR>::Self |
Typedef for this type. More... | |
Functions | |
mi::base::Handle<Interface>::Handle () | |
Default constructor, initializes handle to hold an invalid interface. More... | |
mi::base::Handle<Interface>::Handle (Interface *ptr) | |
Constructor from interface pointer, takes ownership of interface. More... | |
mi::base::Handle<Interface>::Handle (Interface *ptr, Dup_interface) | |
Constructor from interface pointer, does not take ownership of interface but duplicates it. More... | |
mi::base::Handle<Interface>::Handle (const Self &other) | |
Copy constructor, increments reference count if interface is valid. More... | |
template<class Interface2> | |
mi::base::Handle<Interface>::Handle (const Handle<Interface2> &other) | |
Copy constructor template which allows the construction from assignment compatible interface pointers, increments reference count if interface is valid. More... | |
mi::base::Handle<Interface>::Handle (Self &&other) noexcept | |
Move constructor. More... | |
template<class Interface2> | |
mi::base::Handle<Interface>::Handle (Handle<Interface2> &&other) noexcept | |
Converting move constructor. More... | |
void | mi::base::Handle<Interface>::swap (Self &other) |
Swap two interfaces. More... | |
Self & | mi::base::Handle<Interface>::operator= (const Self &other) |
Assignment operator, releases old interface and increments reference count of the new interface if interface is valid. More... | |
template<class Interface2> | |
Self & | mi::base::Handle<Interface>::operator= (const Handle<Interface2> &other) |
Assignment operator template, releases old interface and increments reference count of the new interface if interface is valid. More... | |
Self & | mi::base::Handle<Interface>::operator= (Self &&other) noexcept |
Move assignment operator, releases old interface. More... | |
template<class Interface2> | |
Self & | mi::base::Handle<Interface>::operator= (Handle<Interface2> &&other) noexcept |
Converting move assignment operator, releases old interface. More... | |
Self & | mi::base::Handle<Interface>::operator= (Interface *ptr) |
Assignment operator from interface pointer, releases old interface and assigns new interface ptr , takes ownership of interface. More... | |
void | mi::base::Handle<Interface>::reset () |
Releases the current interface, decrementing the reference count. More... | |
mi::base::Handle<Interface>::~Handle () | |
Destructor, releases the interface if it is valid, which decrements the reference count, and triggers thus the deletion of the interface implementation once the reference count reaches zero. More... | |
bool | mi::base::Handle<Interface>::is_valid_interface () const |
Returns true if the interface is valid. More... | |
Interface * | mi::base::Handle<Interface>::get () const |
Access to the interface. Returns 0 for an invalid interface. More... | |
Interface * | mi::base::Handle<Interface>::extract () |
Extracts the interface and releases the handle. More... | |
Interface & | mi::base::Handle<Interface>::operator* () const |
The dereference operator accesses the interface. More... | |
Interface * | mi::base::Handle<Interface>::operator-> () const |
The arrow operator accesses the interface. More... | |
template<class New_interface> | |
Handle<New_interface> | mi::base::Handle<Interface>::get_interface () const |
Returns a new handle for a possibly different interface type, similar to a dynamic cast, but not necessarily restricted to derived interfaces, but also for otherwise related interfaces. More... | |
mi::base::Handle<Interface>::operator bool_conversion_support () const | |
Helper function for the conversion of a Handle<Interface> to a bool. More... | |
template<class Interface1 , class Interface2> | |
bool | mi::base::operator== (const Handle<Interface1> &lhs, const Handle<Interface2> &rhs) |
Returns true if the underlying interface pointers are equal. More... | |
template<class Interface1 , class Interface2> | |
bool | mi::base::operator!= (const Handle<Interface1> &lhs, const Handle<Interface2> &rhs) |
Returns true if the underlying interface pointers are not equal. More... | |
template<class Interface> | |
Handle<Interface> | mi::base::make_handle (Interface *iptr) |
Returns a handle that holds the interface pointer passed in as argument. More... | |
template<class Interface> | |
Handle<Interface> | mi::base::make_handle_dup (Interface *iptr) |
Converts passed-in interface pointer to a handle, without taking interface over. More... | |
static bool | mi::base::IInterface::compare_iid (const Uuid &iid) |
Compares the interface ID iid against the interface ID of this interface. More... | |
virtual Uint32 | mi::base::IInterface::retain () const =0 |
Increments the reference count. More... | |
virtual Uint32 | mi::base::IInterface::release () const =0 |
Decrements the reference count. More... | |
virtual const IInterface * | mi::base::IInterface::get_interface (const Uuid &interface_id) const =0 |
Acquires a const interface from another. More... | |
template<class T> | |
const T * | mi::base::IInterface::get_interface () const |
Acquires a const interface from another. More... | |
virtual IInterface * | mi::base::IInterface::get_interface (const Uuid &interface_id)=0 |
Acquires a mutable interface from another. More... | |
template<class T> | |
T * | mi::base::IInterface::get_interface () |
Acquires a mutable interface from another. More... | |
virtual Uuid | mi::base::IInterface::get_iid () const =0 |
Returns the interface ID of the most derived interface. More... | |
static bool | mi::base::Interface_declare< id1, ... >::compare_iid (const Uuid &iid) |
Compares the interface ID iid against the interface ID of this interface and of its ancestors. More... | |
mi::base::Interface_implement<I>::Interface_implement (Uint32 initial=1) | |
Constructor. More... | |
mi::base::Interface_implement<I>::Interface_implement (const Interface_implement<I> &other) | |
Copy constructor. More... | |
Interface_implement<I> & | mi::base::Interface_implement<I>::operator= (const Interface_implement<I> &other) |
Assignment operator. More... | |
mi::base::Interface_implement<I>::Interface_implement (Interface_implement &&other) | |
Move constructor. More... | |
Interface_implement & | mi::base::Interface_implement<I>::operator= (Interface_implement &&other) |
Move assignment. More... | |
virtual Uint32 | mi::base::Interface_implement<I>::retain () const |
Increments the reference count. More... | |
virtual Uint32 | mi::base::Interface_implement<I>::release () const |
Decrements the reference count. More... | |
virtual const IInterface * | mi::base::Interface_implement<I>::get_interface (const Uuid &interface_id) const |
Acquires a const interface. More... | |
virtual IInterface * | mi::base::Interface_implement<I>::get_interface (const Uuid &interface_id) |
Acquires a mutable interface. More... | |
Uuid | mi::base::Interface_implement<I>::get_iid () const |
Returns the interface ID of the most derived interface. More... | |
Atom32 & | mi::base::Interface_implement<I>::refcount () const |
Get the current refcount. More... | |
mi::base::Interface_implement_2<I1, I2>::Interface_implement_2 (Uint32 initial=1) | |
Constructor. More... | |
mi::base::Interface_implement_2<I1, I2>::Interface_implement_2 (const Interface_implement_2<I1, I2> &other) | |
Copy constructor. More... | |
Interface_implement_2<I1, I2> & | mi::base::Interface_implement_2<I1, I2>::operator= (const Interface_implement_2<I1, I2> &other) |
Assignment operator. More... | |
virtual Uint32 | mi::base::Interface_implement_2<I1, I2>::retain () const |
Increments the reference count. More... | |
virtual Uint32 | mi::base::Interface_implement_2<I1, I2>::release () const |
Decrements the reference count. More... | |
virtual const IInterface * | mi::base::Interface_implement_2<I1, I2>::get_interface (const Uuid &interface_id) const |
Acquires a const interface. More... | |
virtual IInterface * | mi::base::Interface_implement_2<I1, I2>::get_interface (const Uuid &interface_id) |
Acquires a mutable interface. More... | |
Uuid | mi::base::Interface_implement_2<I1, I2>::get_iid () const |
Returns the interface ID of the most derived interface. More... | |
virtual Uint32 | mi::base::Interface_implement_singleton<I>::retain () const |
Returns the fixed reference count of one. More... | |
virtual Uint32 | mi::base::Interface_implement_singleton<I>::release () const |
Returns the fixed reference count of one. More... | |
virtual const IInterface * | mi::base::Interface_implement_singleton<I>::get_interface (const Uuid &interface_id) const |
Acquires a const interface. More... | |
virtual IInterface * | mi::base::Interface_implement_singleton<I>::get_interface (const Uuid &interface_id) |
Acquires a mutable interface. More... | |
Uuid | mi::base::Interface_implement_singleton<I>::get_iid () const |
Returns the interface ID of the most derived interface. More... | |
static bool | mi::base::Interface_merger<MAJOR, MINOR>::compare_iid (const Uuid &iid) |
Reimplements mi::base::IInterface::compare_iid(). More... | |
const IInterface * | mi::base::Interface_merger<MAJOR, MINOR>::get_interface (const Uuid &interface_id) const |
Reimplements mi::base::IInterface::get_interface(const Uuid&) const. More... | |
template<class T> | |
const T * | mi::base::Interface_merger<MAJOR, MINOR>::get_interface () const |
Reimplements mi::base::IInterface::get_interface() const. More... | |
IInterface * | mi::base::Interface_merger<MAJOR, MINOR>::get_interface (const Uuid &interface_id) |
Reimplements mi::base::IInterface::get_interface(const Uuid&). More... | |
template<class T> | |
T * | mi::base::Interface_merger<MAJOR, MINOR>::get_interface () |
Reimplements mi::base::IInterface::get_interface(). More... | |
Uuid | mi::base::Interface_merger<MAJOR, MINOR>::get_iid () const |
Reimplements mi::base::IInterface::get_iid(). More... | |
mi::Uint32 | mi::base::Interface_merger<MAJOR, MINOR>::retain () const |
Reimplements mi::base::IInterface::retain(). More... | |
mi::Uint32 | mi::base::Interface_merger<MAJOR, MINOR>::release () const |
Reimplements mi::base::IInterface::release(). More... | |
const MAJOR * | mi::base::Interface_merger<MAJOR, MINOR>::cast_to_major () const |
Returns a pointer to the MAJOR base class. More... | |
MAJOR * | mi::base::Interface_merger<MAJOR, MINOR>::cast_to_major () |
Returns a pointer to the MAJOR base class. More... | |
bool | mi::base::operator== (const Uuid &id1, const Uuid &id2) |
Returns true if id1 is equal to id2 . More... | |
bool | mi::base::operator!= (const Uuid &id1, const Uuid &id2) |
Returns true if id1 is not equal to id2 . More... | |
bool | mi::base::operator< (const Uuid &id1, const Uuid &id2) |
Returns true if id1 is less than id2 . More... | |
bool | mi::base::operator> (const Uuid &id1, const Uuid &id2) |
Returns true if id1 is greater than id2 . More... | |
bool | mi::base::operator<= (const Uuid &id1, const Uuid &id2) |
Returns true if id1 is less than or equal to id2 . More... | |
bool | mi::base::operator>= (const Uuid &id1, const Uuid &id2) |
Returns true if id1 is greater than or equal to id2 . More... | |
Uint32 | mi::base::uuid_hash32 (const Uuid &id) |
Returns a 32 bit hash value by performing a bitwise xor of all four 32 bit values. More... | |
mi::base::Uuid_t< id1, ... >::operator const Uuid & () const | |
Conversion operator. More... | |
Variables | |
static const Dup_interface | mi::base::DUP_INTERFACE = 0 |
Symbolic constant to trigger a special constructor in the Handle class. More... | |
Uint32 | mi::base::Uuid::m_id1 |
First value. More... | |
Uint32 | mi::base::Uuid::m_id2 |
Second value. More... | |
Uint32 | mi::base::Uuid::m_id3 |
Third value. More... | |
Uint32 | mi::base::Uuid::m_id4 |
Fourth value. More... | |
static const Uint32 | mi::base::Uuid_t< id1, ... >::m_id1 = id1 |
First 32 bit out of four. More... | |
static const Uint32 | mi::base::Uuid_t< id1, ... >::m_id2 = static_cast<Uint32>( id2 | (id3 << 16)) |
Second 32 bit out of four. More... | |
static const Uint32 | mi::base::Uuid_t< id1, ... >::m_id3 = static_cast<Uint32>( id4 | (id5 << 8) | (id6 << 16) | (id7 << 24)) |
Third 32 bit out of four. More... | |
static const Uint32 | mi::base::Uuid_t< id1, ... >::m_id4 = static_cast<Uint32>( id8 | (id9 << 8) | (id10 << 16) | (id11 << 24)) |
Fourth 32 bit out of four. More... | |
static const Uint32 | mi::base::Uuid_t< id1, ... >::hash32 = m_id1 ^ m_id2 ^ m_id3 ^ m_id4 |
A 32 bit hash value from a bitwise xor of all four 32 bit values. More... | |
The classes provided here support conventional modern C++ library design principles for component software to achieve binary compatibility across shared library boundaries and future extensibility.
The design provides access through interfaces, which are abstract base classes with pure virtual member functions.
Interfaces derived from mi::base::IInterface refer to reference-counted dynamic resources that need to be released. To avoid manual reference counting, you can use the provided handle class mi::base::Handle, which is a smart-pointer implementation with automatic reference counting. You can also use other handle class implementations, e.g., std::tr1::shared_ptr<T>
(or boost::shared_ptr<T>
).
typedef bool(Handle::* mi::base::Handle<Interface>::bool_conversion_support) () const |
Helper typedef.
This typedef represent the type of is_valid_interface() used by the bool_conversion_support() operator.
typedef Difference mi::base::Handle<Interface>::difference_type |
Difference type (signed integral type to hold pointer differences).
typedef const Dup_interface_helper* mi::base::Dup_interface |
Type for a symbolic constant to trigger a special constructor in the Handle class.
typedef Uuid_t<0,0,0,0,0,0,0,0,0,0,0> mi::base::IInterface::IID |
Declares the interface ID (IID) of this interface.
A local type in each interface type, which is distinct and unique for each interface. The type has a default constructor and the constructed value represents the universally unique identifier (UUID) for this interface. The local type is readily convertible to a mi::base::Uuid.
typedef Uuid_t<id1,id2,id3,id4,id5,id6,id7,id8,id9,id10,id11> mi::base::Interface_declare< id1, ... >::IID |
Declares the interface ID (IID) of this interface.
typedef Interface mi::base::Handle<Interface>::Interface_type |
Type of the underlying interface.
typedef MAJOR mi::base::Interface_merger<MAJOR, MINOR>::MAJOR_BASE |
Typedef for the MAJOR base class.
typedef MINOR mi::base::Interface_merger<MAJOR, MINOR>::MINOR_BASE |
Typedef for the MINOR base class.
typedef Interface* mi::base::Handle<Interface>::pointer |
Mutable-pointer type to underlying interface.
typedef Interface& mi::base::Handle<Interface>::reference |
Mutable-reference type to underlying interface.
typedef Handle<Interface> mi::base::Handle<Interface>::Self |
Own type.
typedef Interface_declare<id1,id2,id3,id4,id5,id6,id7,id8,id9,id10,id11,I> mi::base::Interface_declare< id1, ... >::Self |
Own type.
typedef Interface_merger<MAJOR,MINOR> mi::base::Interface_merger<MAJOR, MINOR>::Self |
Typedef for this type.
typedef Interface mi::base::Handle<Interface>::value_type |
Type of the underlying interface.
|
inline |
Returns a pointer to the MAJOR base class.
Note that mi::base::IInterface is an ambiguous base class. Often you just need a pointer to mi::base::IInterface but do not really care to which base class it actually points to. This method is intended to be used in these cases. It returns the pointer to the MAJOR base class, which can then be statically casted to mi::base::IInterface (unless Interface_merger is nested).
cast_to_major()
of this method emphasizes that it behaves similar to a static cast, in particular, it does not increase the reference count.
|
inline |
Returns a pointer to the MAJOR base class.
Note that mi::base::IInterface is an ambiguous base class. Often you just need a pointer to mi::base::IInterface but do not really care to which base class it actually points to. This method is intended to be used in these cases. It returns the pointer to the MAJOR base class, which can then be statically casted to mi::base::IInterface (unless Interface_merger is nested).
cast_to_major()
of this method emphasizes that it behaves similar to a static cast, in particular, it does not increase the reference count.
|
inlinestatic |
Compares the interface ID iid
against the interface ID of this interface.
true
if iid
== mi::base::IInterface::IID(), and false
otherwise.
|
inlinestatic |
Compares the interface ID iid
against the interface ID of this interface and of its ancestors.
true
if iid
== IID()
or is equal to one of the interface IDs of its ancestors, and false
otherwise.
|
inlinestatic |
Reimplements mi::base::IInterface::compare_iid().
Forwards the call to the MAJOR base class, and then, in case of failure, to the MINOR base class.
|
inline |
Extracts the interface and releases the handle.
Returns 0 for an invalid interface.
Note that the owner takes responsible for managing the lifetime of the interface.
|
inline |
Access to the interface. Returns 0 for an invalid interface.
|
inline |
Returns the interface ID of the most derived interface.
|
inline |
Returns the interface ID of the most derived interface.
|
inline |
Returns the interface ID of the most derived interface.
|
inline |
Reimplements mi::base::IInterface::get_iid().
Forwards the call to the MAJOR base class.
|
pure virtual |
Returns the interface ID of the most derived interface.
Implemented in mi::base::Interface_implement< neuraylib::IBsdf_buffer >, mi::base::Interface_implement< neuraylib::IBsdf_isotropic_data >, mi::base::Interface_implement< neuraylib::ITimer_class_factory >, mi::base::Interface_implement< neuraylib::IUser_class_factory >, and mi::base::Interface_implement_singleton<IAllocator>.
|
inline |
Acquires a mutable interface from another.
If this interface supports the interface T
, then the method returns a non-NULL
pointer to the interface T
. Otherwise, the method returns NULL
.
In the case of a non-NULL
return value, the caller receives ownership of the new interface pointer, whose reference count has been retained once. The caller must release the returned interface pointer at the end to prevent a memory leak.
This templated member function is a wrapper of the non-template variant for the user's convenience. It eliminates the need to apply static_cast
to the returned pointer, since the return type already is a pointer to the type T
specified as template parameter.
T | The requested interface type. |
|
inline |
Reimplements mi::base::IInterface::get_interface().
The implementation is identical, but needed for visibility reasons.
|
inline |
Returns a new handle for a possibly different interface type, similar to a dynamic cast, but not necessarily restricted to derived interfaces, but also for otherwise related interfaces.
Returns a handle with an invalid interface if the requested interface type is not supported by the underlying interface implementation or if this interface is itself already invalid.
|
inline |
Acquires a const interface from another.
If this interface supports the interface T
, then the method returns a non-NULL
const
pointer to the interface T
. Otherwise, the method returns NULL
.
In the case of a non-NULL
return value, the caller receives ownership of the new interface pointer, whose reference count has been retained once. The caller must release the returned interface pointer at the end to prevent a memory leak.
This templated member function is a wrapper of the non-template variant for the user's convenience. It eliminates the need to apply static_cast
to the returned pointer, since the return type already is a const pointer to the type T
specified as template parameter.
T | The requested interface type. |
|
inline |
Reimplements mi::base::IInterface::get_interface() const.
The implementation is identical, but needed for visibility reasons.
|
inlinevirtual |
Acquires a mutable interface.
If this interface is derived from or is the interface with the passed interface_id
, then return a non-NULL
mi::base::IInterface* that can be casted via static_cast
to an interface pointer of the interface type corresponding to the passed interface_id
. Otherwise return NULL
.
In the case of a non-NULL
return value, the caller receives ownership of the new interface pointer, whose reference count has been retained once. The caller must release the returned interface pointer at the end to prevent a memory leak.
Reimplemented in mi::bridge::Client_job<i_id1, i_id2, i_id3, i_id4, i_id5, i_id6, i_id7, i_id8, i_id9, i_id10, i_id11, I>, mi::bridge::Client_job< 0xf9b3c8e2, ... >, and mi::bridge::Server_job<i_id1, i_id2, i_id3, i_id4, i_id5, i_id6, i_id7, i_id8, i_id9, i_id10, i_id11, I>.
|
inlinevirtual |
Acquires a mutable interface.
If this interface is derived from or is the interface with the passed interface_id
, then return a non-NULL
mi::base::IInterface* that can be casted via static_cast
to an interface pointer of the interface type corresponding to the passed interface_id
. Otherwise return NULL
.
In the case of a non-NULL
return value, the caller receives ownership of the new interface pointer, whose reference count has been retained once. The caller must release the returned interface pointer at the end to prevent a memory leak.
|
inlinevirtual |
Acquires a mutable interface.
If this interface is derived from or is the interface with the passed interface_id
, then return a non-NULL
mi::base::IInterface* that can be casted via static_cast
to an interface pointer of the interface type corresponding to the passed interface_id
. Otherwise return NULL
.
In the case of a non-NULL
return value, the caller receives ownership of the new interface pointer, whose reference count has been retained once. The caller must release the returned interface pointer at the end to prevent a memory leak.
IInterface * mi::base::Interface_merger<MAJOR, MINOR>::get_interface | ( | const Uuid & | interface_id | ) |
Reimplements mi::base::IInterface::get_interface(const Uuid&).
Forwards the call to the MAJOR base class, and then, in case of failure, to the MINOR base class.
|
inlinevirtual |
Acquires a const interface.
If this interface is derived from or is the interface with the passed interface_id
, then return a non-NULL
const
mi::base::IInterface* that can be casted via static_cast
to an interface pointer of the interface type corresponding to the passed interface_id
. Otherwise return NULL
.
In the case of a non-NULL
return value, the caller receives ownership of the new interface pointer, whose reference count has been retained once. The caller must release the returned interface pointer at the end to prevent a memory leak.
Reimplemented in mi::bridge::Client_job<i_id1, i_id2, i_id3, i_id4, i_id5, i_id6, i_id7, i_id8, i_id9, i_id10, i_id11, I>, mi::bridge::Client_job< 0xf9b3c8e2, ... >, and mi::bridge::Server_job<i_id1, i_id2, i_id3, i_id4, i_id5, i_id6, i_id7, i_id8, i_id9, i_id10, i_id11, I>.
|
inlinevirtual |
Acquires a const interface.
If this interface is derived from or is the interface with the passed interface_id
, then return a non-NULL
const
mi::base::IInterface* that can be casted via static_cast
to an interface pointer of the interface type corresponding to the passed interface_id
. Otherwise return NULL
.
In the case of a non-NULL
return value, the caller receives ownership of the new interface pointer, whose reference count has been retained once. The caller must release the returned interface pointer at the end to prevent a memory leak.
|
inlinevirtual |
Acquires a const interface.
If this interface is derived from or is the interface with the passed interface_id
, then return a non-NULL
const
mi::base::IInterface* that can be casted via static_cast
to an interface pointer of the interface type corresponding to the passed interface_id
. Otherwise return NULL
.
In the case of a non-NULL
return value, the caller receives ownership of the new interface pointer, whose reference count has been retained once. The caller must release the returned interface pointer at the end to prevent a memory leak.
const IInterface * mi::base::Interface_merger<MAJOR, MINOR>::get_interface | ( | const Uuid & | interface_id | ) | const |
Reimplements mi::base::IInterface::get_interface(const Uuid&) const.
Forwards the call to the MAJOR base class, and then, in case of failure, to the MINOR base class.
|
pure virtual |
Acquires a const interface from another.
If this interface supports the interface with the passed interface_id
, then the method returns a non-NULL
const
mi::base::IInterface* that can be casted via static_cast
to an interface pointer of the interface type corresponding to the passed interface_id
. Otherwise, the method returns NULL
.
In the case of a non-NULL
return value, the caller receives ownership of the new interface pointer, whose reference count has been retained once. The caller must release the returned interface pointer at the end to prevent a memory leak.
interface_id | Interface ID of the interface to acquire. |
Implemented in mi::base::Interface_implement< neuraylib::IBsdf_buffer >, mi::base::Interface_implement< neuraylib::IBsdf_isotropic_data >, mi::base::Interface_implement< neuraylib::ITimer_class_factory >, mi::base::Interface_implement< neuraylib::IUser_class_factory >, and mi::base::Interface_implement_singleton<IAllocator>.
|
pure virtual |
Acquires a mutable interface from another.
If this interface supports the interface with the passed interface_id
, then the methods returns a non-NULL
mi::base::IInterface* that can be casted via static_cast
to an interface pointer of the interface type corresponding to the passed interface_id
. Otherwise, the method returns NULL
.
In the case of a non-NULL
return value, the caller receives ownership of the new interface pointer, whose reference count has been retained once. The caller must release the returned interface pointer at the end to prevent a memory leak.
interface_id | Interface ID of the interface to acquire. |
Implemented in mi::base::Interface_implement< neuraylib::IBsdf_buffer >, mi::base::Interface_implement< neuraylib::IBsdf_isotropic_data >, mi::base::Interface_implement< neuraylib::ITimer_class_factory >, mi::base::Interface_implement< neuraylib::IUser_class_factory >, and mi::base::Interface_implement_singleton<IAllocator>.
|
inline |
Default constructor, initializes handle to hold an invalid interface.
|
inline |
Copy constructor template which allows the construction from assignment compatible interface pointers, increments reference count if interface is valid.
This constructor allows specifically the construction of a Handle<const I>
from a Handle<I>
value, which corresponds to the assignment of a mutable pointer to a const pointer. In addition, promotion of derived interfaces to base interfaces is allowed.
|
inline |
Copy constructor, increments reference count if interface is valid.
|
inlinenoexcept |
Converting move constructor.
|
inlineexplicit |
Constructor from interface pointer, takes ownership of interface.
The constructor does not increment the reference count of ptr
assuming it is already set properly, e.g., by a corresponding get_interface() call. It therefore takes over the ownership of the interface pointer.
|
inline |
Constructor from interface pointer, does not take ownership of interface but duplicates it.
The constructor increments the reference count of ptr
so that it does not influence the interface when it decrements the reference count later on. You can use this constructor for example to hold interfaces that are passed into functions as parameters because by convention they are owned by the function caller. You can pass the constant DUP_INTERFACE as the second argument.
|
inlinenoexcept |
Move constructor.
|
inline |
Copy constructor.
Initializes the reference count to 1.
|
inline |
Move constructor.
|
inline |
Constructor.
initial | The initial reference count (defaults to 1). |
|
inline |
Copy constructor.
Initializes the reference count to 1.
|
inline |
Constructor.
initial | The initial reference count (defaults to 1). |
|
inline |
Returns true
if the interface is valid.
|
inline |
Returns a handle that holds the interface pointer passed in as argument.
This helper function template simplifies the creation of handles with an interface type that matches the type of the interface argument. In contrast to make_handle_dup(), the handle takes ownership of the interface.
|
inline |
Converts passed-in interface pointer to a handle, without taking interface over.
This helper function template simplifies the creation of handles with an interface type that matches the type of the interface argument. In contrast to make_handle(), the handle does not take ownership of the interface.
|
inline |
Helper function for the conversion of a Handle<Interface> to a bool.
This helper function allows to write
instead of
|
inline |
Conversion operator.
The conversion to mi::base::Uuid initializes the UUID to (m_id1
, m_id2
, m_id3
, m_id4
).
|
inline |
Returns true
if the underlying interface pointers are not equal.
Returns true
if id1
is not equal to id2
.
|
inline |
The dereference operator accesses the interface.
|
inline |
The arrow operator accesses the interface.
Returns true
if id1
is less than id2
.
Returns true
if id1
is less than or equal to id2
.
|
inline |
Assignment operator template, releases old interface and increments reference count of the new interface if interface is valid.
This assignment operator allows specifically the assignment of a Handle<I>
to a Handle<const I>
value, which corresponds to the assignment of a mutable pointer to a const pointer. In addition, promotion of derived interfaces to base interfaces is allowed.
|
inline |
Assignment operator.
The reference count of *this
and other
remain unchanged.
|
inline |
Assignment operator.
The reference count of *this
and other
remain unchanged.
|
inline |
Assignment operator, releases old interface and increments reference count of the new interface if interface is valid.
|
inlinenoexcept |
Converting move assignment operator, releases old interface.
|
inline |
Assignment operator from interface pointer, releases old interface and assigns new interface ptr
, takes ownership of interface.
Does not increment reference count of ptr
assuming it is already set properly, e.g., by a corresponding get_interface() call.
|
inline |
Move assignment.
|
inlinenoexcept |
Move assignment operator, releases old interface.
|
inline |
Returns true
if the underlying interface pointers are equal.
Returns true
if id1
is equal to id2
.
Returns true
if id1
is greater than id2
.
Returns true
if id1
is greater than or equal to id2
.
|
inlineprotected |
Get the current refcount.
|
inlinevirtual |
Decrements the reference count.
Decrements the reference count of the object referenced through this interface and returns the new reference count. If the reference count dropped to zero, the object will be deleted. The operation is thread-safe.
Reimplemented in mi::neuraylib::User_class< id1, ... >.
|
inlinevirtual |
Decrements the reference count.
Decrements the reference count of the object referenced through this interface and returns the new reference count. If the reference count dropped to zero, the object will be deleted. The operation is thread-safe.
|
inlinevirtual |
Returns the fixed reference count of one.
Implements mi::base::IInterface::release() with a constant reference count of one. The object will never be deleted through a release call.
|
inline |
Reimplements mi::base::IInterface::release().
Forwards the call to the MAJOR base class.
|
pure virtual |
Decrements the reference count.
Decrements the reference count of the object referenced through this interface and returns the new reference count. If the reference count dropped to zero, the object will be deleted. The operation is thread-safe.
Implemented in mi::base::Interface_implement< neuraylib::IBsdf_buffer >, mi::base::Interface_implement< neuraylib::IBsdf_isotropic_data >, mi::base::Interface_implement< neuraylib::ITimer_class_factory >, mi::base::Interface_implement< neuraylib::IUser_class_factory >, and mi::base::Interface_implement_singleton<IAllocator>.
|
inline |
Releases the current interface, decrementing the reference count.
|
inlinevirtual |
Increments the reference count.
Increments the reference count of the object referenced through this interface and returns the new reference count. The operation is thread-safe.
|
inlinevirtual |
Increments the reference count.
Increments the reference count of the object referenced through this interface and returns the new reference count. The operation is thread-safe.
|
inlinevirtual |
Returns the fixed reference count of one.
Implements mi::base::IInterface::retain() with a constant reference count of one.
|
inline |
Reimplements mi::base::IInterface::retain().
Forwards the call to the MAJOR base class.
|
pure virtual |
Increments the reference count.
Increments the reference count of the object referenced through this interface and returns the new reference count. The operation is thread-safe.
Implemented in mi::base::Interface_implement< neuraylib::IBsdf_buffer >, mi::base::Interface_implement< neuraylib::IBsdf_isotropic_data >, mi::base::Interface_implement< neuraylib::ITimer_class_factory >, mi::base::Interface_implement< neuraylib::IUser_class_factory >, and mi::base::Interface_implement_singleton<IAllocator>.
|
inline |
Swap two interfaces.
Returns a 32 bit hash value by performing a bitwise xor of all four 32 bit values.
|
inline |
Destructor, releases the interface if it is valid, which decrements the reference count, and triggers thus the deletion of the interface implementation once the reference count reaches zero.
|
static |
Symbolic constant to trigger a special constructor in the Handle class.
|
static |
A 32 bit hash value from a bitwise xor of all four 32 bit values.
Uint32 mi::base::Uuid::m_id1 |
First value.
|
static |
First 32 bit out of four.
Uint32 mi::base::Uuid::m_id2 |
Second value.
|
static |
Second 32 bit out of four.
Uint32 mi::base::Uuid::m_id3 |
Third value.
|
static |
Third 32 bit out of four.
Uint32 mi::base::Uuid::m_id4 |
Fourth value.