iObjectRegistry Struct Reference (Crystal Space 2.0 Public API Reference)

| ## Public API Reference

- Main Page
- Related Pages
- Modules
- Namespaces
- Classes
- Files

- Class List
- Class Index
- Class Hierarchy
- Class Members

Public Member Functions
iObjectRegistry Struct Reference
Shared Class Facility (SCF)

This interface serves as a registry of other objects. More...

`#include <iutil/objreg.h>`

Inheritance diagram for iObjectRegistry:

List of all members.

## Public Member Functions
virtual void | Clear ()=0
| Clear the object registry and release all references.
virtual iBase * | Get (char const *tag)=0
| Get the registered object corresponding with the given tag.
virtual iBase * | Get (char const *tag, scfInterfaceID id, int version)=0
| Get the registered object corresponding with the given tag and implementing the specified interface.
virtual csPtr < iObjectRegistryIterator > | Get (scfInterfaceID id, int version)=0
| Get an iterator with all objects implementing the given interface.
virtual csPtr < iObjectRegistryIterator > | Get ()=0
| Get an iterator with all objects in this object registry.
virtual bool | Register (iBase *obj, char const *tag=0)=0
| Register an object with this registry.
virtual void | Unregister (iBase *obj, char const *tag=0)=0
| Unregister an object with this registry.

## Detailed Description

This interface serves as a registry of other objects.

The object registry is thread-safe.

Main creators of instances implementing this interface:

- csInitializer::CreateObjectRegistry()

Main ways to get pointers to this interface:

- Stored by application.

Main users of this interface:

- Everything.

Definition at line 48 of file objreg.h.

## Member Function Documentation

virtual void iObjectRegistry::Clear | ( |  | ) | `[pure virtual]`

Clear the object registry and release all references.

Implemented in csObjectRegistry.

virtual iBase* iObjectRegistry::Get | ( | char const * | tag | ) | `[pure virtual]`

Get the registered object corresponding with the given tag.

Remarks:
  The reference count of the returned object will be artifically incremented, so clients must take care to decrement the reference when no longer needed.

Implemented in csObjectRegistry.

virtual iBase* iObjectRegistry::Get | ( | char const * | tag,
|  | scfInterfaceID | id,
|  | int | version
| ) |  | `[pure virtual]`

Get the registered object corresponding with the given tag and implementing the specified interface.

Remarks:
  The reference count of the returned object will be artifically incremented, so clients must take care to decrement the reference when no longer needed.

Implemented in csObjectRegistry.

virtual csPtr<iObjectRegistryIterator> iObjectRegistry::Get | ( | scfInterfaceID | id,
|  | int | version
| ) |  | `[pure virtual]`

Get an iterator with all objects implementing the given interface.

Note that the iterator iterates over a copy of the elements in the object registry so no thread-locking on the object registry happens except at the time the iterator is created.

Implemented in csObjectRegistry.

virtual csPtr<iObjectRegistryIterator> iObjectRegistry::Get | ( |  | ) | `[pure virtual]`

Get an iterator with all objects in this object registry.

Note that the iterator iterates over a copy of the elements in the object registry so no thread-locking on the object registry happens except at the time the iterator is created.

Implemented in csObjectRegistry.

virtual bool iObjectRegistry::Register | ( | iBase * | obj,
|  | char const * | tag = `0`
| ) |  | `[pure virtual]`

Register an object with this registry.

The same object can be registered multiple times but in that case it is probably best to have different tags so they can be distinguished.

Parameters:

  obj | Object to place into the registry.
  tag | Optional tag. The tag is interpreted in any way the client sees fit, however some facilities expect tags to follow a certain convention, so be sure to check suitable documentation.

Returns:
  False if the given tag is already registered; if obj is null; or if the registry is in the process of being cleared.

Remarks:
  The reference count of obj will be incremented at registration time.
  A particular tag can only be registered once. If you need to re-use a tag, first unregister the object to which it is associated.

Implemented in csObjectRegistry.

virtual void iObjectRegistry::Unregister | ( | iBase * | obj,
|  | char const * | tag = `0`
| ) |  | `[pure virtual]`

Unregister an object with this registry.

Parameters:

  obj | Object to removed from the registry.
  tag | Optional tag.

Remarks:
  If tag is not provided, * then it will unregister all occurrences of obj * in the registry (i.e. for all tags). If tag is provided, then only * the particular registration of obj associated with tag will be unregistered.
  The reference count of obj will be decremented at removal time.

Implemented in csObjectRegistry.

The documentation for this struct was generated from the following file:

- iutil/objreg.h