Class DD_factory: Class to handle create and delete of DDs.
Public Methods
-
DD_factory()
- (only) ctor
-
~DD_factory()
- dtor, calls cleanup
-
DD* create_dd( const char* dd_name = DD::pccDefaultDDName, const char* mode = "r", const char* config_file = NULL )
- Creates a DD system.
-
DD* get_dd( const char* dd_name ) const
- Given the name of the DD system, return pointer to it.
-
int delete_dd( const char* dd_name )
- Deletes the DD system.
-
int remove_dd( const char* dd_name )
- Removes the DD system.
-
static void cleanup()
- static cleanup member function.
Documentation
Class DD_factory: Class to handle create and delete of DDs.
Its main purpose is to keep track which DDs have been
created or to which DDs the process has been attached.
This is done using static variables nDDs and theDDs.
Atexit we call the cleanup routine that makes sure
that we detached from all DDs (and deletes them if
necesary).
Comments:
- Is not really necessary to call these
routines but one can equally well just call the DD
member functions. However one then looses the automatic
cleanup upon exit, so this is the preferred way.
- There is a sublety in static member functions between
DD_factory and DD. The DD_factory member functions are
only used for handling the creation and deletion of the
DD systems for that particular process.
The class DD has in addition the following static
member functions:
1. bool DD::exists( char *name ):
returns true if the DD systems (i.e.
the IPC resources exist)
2. DD* DD::create_dd: the static member function that
decides which DD to create how
Modifications:
DD_factory()
- (only) ctor
~DD_factory()
- dtor, calls cleanup
DD* create_dd( const char* dd_name = DD::pccDefaultDDName, const char* mode = "r", const char* config_file = NULL )
- Creates a DD system.
Using this memberfunction garantees that the DD system will be properly
detached/deleted when the process exits. The arguments are:
- Parameters:
- dd_name - : name of the DD system
mode - : "w" to create the DD if it doesn't exits, "r" (=default):
attaches to the DD
config_file - : (optional) configuration file of the DD
@ return Pointer to the DD system or NULL
DD* get_dd( const char* dd_name ) const
- Given the name of the DD system, return pointer to it.
- Returns:
- Pointer *DD or NULL if we never attached the to the system
int delete_dd( const char* dd_name )
- Deletes the DD system.
Note: delete_dd does only detach the current process from the DD system
if there are still other processes attached to it.
Removes the IPC resources if we are the last process.
- Returns:
- ddcSuccess if ok, ddcFailure if we never attached/created the DD system
int remove_dd( const char* dd_name )
- Removes the DD system.
In contrast to delete_dd we now enforce the removal (cleanup) of all
IPC resources
- Returns:
- ddcSuccess if ok, ddcFailure if we never attached/created the DD system
static void cleanup()
- static cleanup member function.
This member function is called at exit and makes sure that all connections
to existing DD systems are closed
- This class has no child classes.
- Author:
- C.Witzig
Date: Mar 17, 98
- Version:
- Last update: Mar 17, 98
Alphabetic index HTML hierarchy of classes or Java
This page was generated with the help of DOC++.