Main Page Namespace List Class Hierarchy Alphabetical List Compound List File List Namespace Members Compound Members File Members Related Pages

# TAO_Singleton_Manager Class Reference

Manager for TAO library services and singleton cleanup. More...

`#include <TAO_Singleton_Manager.h>`

Inheritance diagram for TAO_Singleton_Manager:

[legend]
Collaboration diagram for TAO_Singleton_Manager:

[legend]
List of all members.

## Public Types
enum | Preallocated_Object { TAO_EMPTY_PREALLOCATED_OBJECT, TAO_PREALLOCATED_OBJECTS }
| Unique identifiers for preallocated Objects. More...
## Public Methods
virtual int | init (void)
| Explicitly initialize. More...
int | init (int register_with_object_manager)
virtual int | fini (void)
| Explicitly destroy. More...
void | _set_unexpected (TAO_unexpected_handler u)
| Set a new unexpected exception handler. More...
## Static Public Methods
int | starting_up (void)
int | shutting_down (void)
| Returns 1 after the TAO_Singleton_Manager has been destroyed. See ACE_Object_Manager::shutting_down for more information. More...
sigset_t * | default_mask (void)
| Accesses a default signal set used, for example, in ACE_Sig_Guard methods. More...
ACE_Thread_Hook * | thread_hook (void)
| Returns the current thread hook for the process. More...
ACE_Thread_Hook * | thread_hook (ACE_Thread_Hook *new_thread_hook)
| Returns the existing thread hook and assign a new_thread_hook. More...
TAO_Singleton_Manager * | instance (void)
| Accessor to singleton instance. More...
int | at_exit (ACE_Cleanup *object, void *param=0)
| Register an ACE_Cleanup object for cleanup at process termination. More...
int | at_exit (void *object, ACE_CLEANUP_FUNC cleanup_hook, void *param)
| Register an object (or array) for cleanup at process termination. More...
## Private Methods
int | at_exit_i (void *object, ACE_CLEANUP_FUNC cleanup_hook, void *param)
| Register an object or array for deletion at program termination. See description of static version above for return values. More...
| TAO_Singleton_Manager (void)
| ~TAO_Singleton_Manager (void)
| TAO_Singleton_Manager (const TAO_Singleton_Manager &)
TAO_Singleton_Manager & | operator= (const TAO_Singleton_Manager &)
## Private Attributes
sigset_t * | default_mask_
| Default signal set used, for example, in ACE_Sig_Guard. More...
ACE_Thread_Hook * | thread_hook_
| Thread hook that's used by this process. More...
ACE_OS_Exit_Info | exit_info_
| For at_exit support. More...
int | registered_with_object_manager_
| Indicates if TAO_Singleton_Manager is registered with the ACE_Object_Manager. More...
TAO_unexpected_handler | old_unexpected_
| The old unexpected exception handler. More...
## Static Private Attributes
TAO_Singleton_Manager * | instance_ = 0
| Singleton instance pointer. More...
void * | preallocated_object [TAO_PREALLOCATED_OBJECTS] = { 0 }
| Table of preallocated objects. More...
## Friends
void | TAO_Singleton_Manager_cleanup_destroyer (void *, void *)
| Adapter for cleanup, used to register cleanup function with the ACE_Object_Manager. More...

## Detailed Description

Manager for TAO library services and singleton cleanup.

The TAO_Singleton_Manager is basically simplified version of the ACE_Object_Manager. It is designed specifically to manage singletons created by TAO. For example, singleton instances created by TAO will be automatically registered with the singleton instance of this Singleton Manager.

This class is necessary to ensure that TAO-specific singletons are isolated to TAO itself, not ACE, for example. The idea is that destruction of the instance of the TAO_Singleton_Manager triggers destruction of all objects/services registered with it.

## Member Enumeration Documentation

enum TAO_Singleton_Manager::Preallocated_Object

  | Unique identifiers for preallocated Objects. Enumeration values:
  TAO_EMPTY_PREALLOCATED_OBJECT | Without ACE_MT_SAFE, There are no preallocated objects. Make sure that the preallocated_array size is at least one by declaring this dummy ...
  TAO_PREALLOCATED_OBJECTS | This enum value must be last!

## Constructor & Destructor Documentation

TAO_Singleton_Manager::TAO_Singleton_Manager | ( | void |  | ) | `[private]`

TAO_Singleton_Manager::~TAO_Singleton_Manager | ( | void |  | ) | `[private]`

TAO_Singleton_Manager::TAO_Singleton_Manager | ( | const TAO_Singleton_Manager & |  | ) | `[private]`

## Member Function Documentation

void TAO_Singleton_Manager::_set_unexpected | ( | TAO_unexpected_handler | u | ) |

| Set a new unexpected exception handler. The old one will be stored for restoration later on. Note: Calling this method multiple times will cause the stored old unexpected exception handler pointer to be lost.

ACE_INLINE int TAO_Singleton_Manager::at_exit | ( | void * | object,
|  | ACE_CLEANUP_FUNC | cleanup_hook,
|  | void * | param
| ) | `[static]`

| Register an object (or array) for cleanup at process termination. cleanup_hook points to a (global, or static member) function that is called for the object or array when it to be destroyed. It may perform any necessary cleanup specific for that object or its class. param is passed as the second parameter to the cleanup_hook function; the first parameter is the object (or array) to be destroyed. cleanup_hook, for example, may delete the object (or array). For OS's that do not have processes, this function is the same as <at_thread_exit>. Returns 0 on success. On failure, returns -1 and sets errno to: EAGAIN if shutting down, ENOMEM if insufficient virtual memory, or EEXIST if the object (or array) had already been registered.

ACE_INLINE int TAO_Singleton_Manager::at_exit | ( | ACE_Cleanup * | object,
|  | void * | param = 0
| ) | `[static]`

| Register an ACE_Cleanup object for cleanup at process termination. The object is deleted via the ace_cleanup_destroyer. If you need more flexiblity, see the other at_exit method below. For OS's that do not have processes, cleanup takes place at the end of main. Returns 0 on success. On failure, returns -1 and sets errno to: EAGAIN if shutting down, ENOMEM if insufficient virtual memory, or EEXIST if the object (or array) had already been registered.

int TAO_Singleton_Manager::at_exit_i | ( | void * | object,
|  | ACE_CLEANUP_FUNC | cleanup_hook,
|  | void * | param
| ) | `[private]`

| Register an object or array for deletion at program termination. See description of static version above for return values.

sigset_t * TAO_Singleton_Manager::default_mask | ( | void |  | ) | `[static]`

| Accesses a default signal set used, for example, in ACE_Sig_Guard methods.

int TAO_Singleton_Manager::fini | ( | void |  | ) | `[virtual]`

| Explicitly destroy. Reimplemented from ACE_Object_Manager_Base.

int TAO_Singleton_Manager::init | ( | int | register_with_object_manager | ) |

| Explicitly initialize the TAO_Singleton_Manager, in addition to explicitly registering (or not registering) with the ACE_Object_Manager.

int TAO_Singleton_Manager::init | ( | void |  | ) | `[virtual]`

| Explicitly initialize. Reimplemented from ACE_Object_Manager_Base.

TAO_Singleton_Manager * TAO_Singleton_Manager::instance | ( | void |  | ) | `[static]`

| Accessor to singleton instance.

TAO_Singleton_Manager& TAO_Singleton_Manager::operator= | ( | const TAO_Singleton_Manager & |  | ) | `[private]`

int TAO_Singleton_Manager::shutting_down | ( | void |  | ) | `[static]`

| Returns 1 after the TAO_Singleton_Manager has been destroyed. See ACE_Object_Manager::shutting_down for more information.

int TAO_Singleton_Manager::starting_up | ( | void |  | ) | `[static]`

| Returns 1 before the TAO_Singleton_Manager has been constructed. See ACE_Object_Manager::starting_up for more information.

ACE_Thread_Hook * TAO_Singleton_Manager::thread_hook | ( | ACE_Thread_Hook * | new_thread_hook | ) | `[static]`

| Returns the existing thread hook and assign a new_thread_hook.

ACE_Thread_Hook * TAO_Singleton_Manager::thread_hook | ( | void |  | ) | `[static]`

| Returns the current thread hook for the process.

## Friends And Related Function Documentation

void TAO_Singleton_Manager_cleanup_destroyer | ( | void * | ,
|  | void * |
| ) | `[friend]`

| Adapter for cleanup, used to register cleanup function with the ACE_Object_Manager.

## Member Data Documentation

sigset_t* TAO_Singleton_Manager::default_mask_`[private]`

| Default signal set used, for example, in ACE_Sig_Guard.

ACE_OS_Exit_Info TAO_Singleton_Manager::exit_info_`[private]`

| For at_exit support.

TAO_Singleton_Manager * TAO_Singleton_Manager::instance_ = 0`[static, private]`

| Singleton instance pointer.

TAO_unexpected_handler TAO_Singleton_Manager::old_unexpected_`[private]`

| The old unexpected exception handler. A pointer to the old unexpected exception handler is stored so that it can be restored when TAO is unloaded, for example. Otherwise, any unexpected exceptions will result in a call to TAO's unexpected exception handler which may no longer exist if TAO was unloaded.

void * TAO_Singleton_Manager::preallocated_object = { 0 }`[static, private]`

| Table of preallocated objects.

int TAO_Singleton_Manager::registered_with_object_manager_`[private]`

| Indicates if TAO_Singleton_Manager is registered with the ACE_Object_Manager.

ACE_Thread_Hook* TAO_Singleton_Manager::thread_hook_`[private]`

| Thread hook that's used by this process.

The documentation for this class was generated from the following files:

- TAO_Singleton_Manager.h
- TAO_Singleton_Manager.cpp
- TAO_Singleton_Manager.inl