#include <set>
#include <assert.h>
#include "atomic.h"
#include "sync.h"
#include "status.h"
Classes | |
class | BazisLib::ObjectManager::EmptyClass |
Used as a template argument to derive unmanaged classes. More... | |
class | BazisLib::ObjectManager::ManagedObjectBase |
Represents a managed object. More... | |
struct | BazisLib::ObjectManager::ManagedObjectBase::DebugObjectReference |
Represents a single managed object for debugging purposes. More... | |
class | BazisLib::ObjectManager::ServiceObject |
Represents a service (an object that may have clients). More... | |
class | BazisLib::ObjectManager::IntermediateServiceObject< _ServiceType > |
Represents a simple intermediate service. More... | |
class | BazisLib::ObjectManager::ConstManagedPointer< _ServiceType > |
Represents a read-only managed pointer for function parameters. Should only be used for creating references/pointers. More... | |
class | BazisLib::ObjectManager::ParentServiceReference< _ServiceType > |
Represents a managed pointer field. More... | |
class | BazisLib::ObjectManager::ManagedPointer< _ManagedType > |
Represents a managed pointer to an object. More... | |
Namespaces | |
namespace | BazisLib |
namespace | BazisLib::ObjectManager |
Contains classes that implement the referencing counting within the service/client model. | |
Defines | |
#define | AUTO_THIS (Retain(), (this)) |
Always use AUTO_THIS instead of 'this' pointer when passing 'this' as a managed paramter. | |
#define | DECLARE_REFERENCE(type, name) ParentServiceReference<type> name |
Declares a managed field reference. See this article for details & usage example. | |
#define | INIT_REFERENCE(member, value) member(this, value) |
Initializes a managed field reference. Should be used from a member initialization list. See this article for details & usage example. | |
#define | ZERO_REFERENCE(member) member(this, NULL) |
Initializes a managed field reference with NULL pointer. Should be used from a member initialization list. See this article for details & usage example. | |
#define | COPY_REFERENCE(member, source) member(this, source.member) |
Copies a managed field reference. Should be used from a member initialization list. See this article for details & usage example. | |
#define | AUTO_INTERFACE public virtual ServiceObject |
#define | AUTO_OBJECT public virtual ServiceObject |
#define | MAKE_AUTO_INTERFACE(iface) class A ## iface : public iface, AUTO_INTERFACE {} |
Functions | |
template<class _DestType , class _SourceType > | |
static ManagedPointer< _DestType > | BazisLib::ObjectManager::managed_cast (const ConstManagedPointer< _SourceType > &ptr) |
Provides type casting for managed pointers. |
#define AUTO_INTERFACE public virtual ServiceObject |
To declare an auto interface, use the following syntax:
class AIxxx : AUTO_INTERFACE { ... }
#define AUTO_OBJECT public virtual ServiceObject |
To declare an auto object, use the following syntax:
class AIxxx : AUTO_OBJECT, ... { ... }If an auto object implements one or more auto interfaces, the usage of AUTO_OBJECT is optionsl.
#define AUTO_THIS (Retain(), (this)) |
Always use AUTO_THIS instead of 'this' pointer when passing 'this' as a managed paramter.
One of the key principles of the ObjectManager library is that an unmanaged pointer is always referenced. It means that if something is created based on an unmanaged pointer, it is not referenced anymore. However, there is a language case that does not comply to this rule: the 'this' pointer. It is an unmanaged pointer that can be obtained using the corresponding keyword without referencing the object. To avoid this problem, use the AUTO_THIS macro instead of 'this' when passing a managed parameter. Example:
static void SomeStatic(ManagedPointer<SomeClass> param) { ... }
void SomeClass::SomeFunc() { ManagedPointer<SomeClass> ptr = AUTO_THIS; //Correct
SomeStatic(this); //Incorrect!!!
SomeStatic(AUTO_THIS); //Correct! }
#define COPY_REFERENCE | ( | member, | |||
source | ) | member(this, source.member) |
Copies a managed field reference. Should be used from a member initialization list. See this article for details & usage example.
#define DECLARE_REFERENCE | ( | type, | |||
name | ) | ParentServiceReference<type> name |
Declares a managed field reference. See this article for details & usage example.
#define INIT_REFERENCE | ( | member, | |||
value | ) | member(this, value) |
Initializes a managed field reference. Should be used from a member initialization list. See this article for details & usage example.
#define MAKE_AUTO_INTERFACE | ( | iface | ) | class A ## iface : public iface, AUTO_INTERFACE {} |
Use this macro to declare an auto interface that copies an existing unmanaged interface. The syntax is the following:
class Ixxx { ... };
MAKE_AUTO_INTERFACE(Ixxx);
#define ZERO_REFERENCE | ( | member | ) | member(this, NULL) |
Initializes a managed field reference with NULL pointer. Should be used from a member initialization list. See this article for details & usage example.