PLCnext API Documentation
22.9.0.33
|
This class represents a single application domain for each process and is implemented as singleton. More...
#include <AppDomain.hpp>
Public Member Functions | |
IApplication & | GetApplication (void) |
Gets the application instance of the current process. More... | |
template<class TSingleton > | |
void | AddSingleton (TSingleton *pSingleton) |
Adds a singleton instance to this AppDomain. More... | |
template<class TSingleton > | |
TSingleton & | GetSingleton (void) |
Gets the singleton instance of the specified type. More... | |
template<class TSingleton > | |
TSingleton * | GetSingletonPtr (void) |
Gets the singleton pointer of the specified type. More... | |
template<class TSingleton > | |
bool | RemoveSingleton (void) |
Removes the singleton pointer of the specified type from this AppDomain. More... | |
Static Public Member Functions | |
static bool | IsCreated (void) |
Determines if the appdomain was created yet. More... | |
static AppDomain & | GetCurrent (void) |
Gets the current AppDomain instance. More... | |
template<class TApp > | |
static TApp & | Create (void) |
Creates the current AppDomain and application instances. More... | |
template<class TApp > | |
static TApp & | Create (const String &appName) |
Creates the current AppDomain and application instances. More... | |
template<class TApp > | |
static void | Dispose (void) |
Disposes the current AppDomain and destructs the application. More... | |
static void | Assign (AppDomain &other) |
Assgins the current AppdDomain singleton from the as argument passed other. More... | |
Friends | |
class | Singleton< AppDomain > |
This class represents a single application domain for each process and is implemented as singleton.
The main purpose of this class is to extend the scope of simple singletons from just inside a library to the whole application. The singleton pattern just wraps a global variable in an OOP manner. Because dynamic shared libraries (DSL) always gets its own set of static variables, it is difficult to provide and use singletons from within generic static libraries which compile into each DSL and generate a copy of the singleton variables. As far as a DSL is a regular Acf library and loaded via Acf configuration, the AppDomainSingleton will work correclty and all AppDomainSingleton(s) are accessible through the whole process from any DSL.
The second purpose of this class is to provide the application instance.
|
inline |
Adds a singleton instance to this AppDomain.
pSingleton | The pointer to the singleton to add. |
TSingleton | The type of the singleton to add. |
|
inlinestatic |
|
inlinestatic |
|
inlinestatic |
|
inlinestatic |
Disposes the current AppDomain and destructs the application.
TApp | The application type of the application to create |
|
inline |
Gets the application instance of the current process.
|
inlinestatic |
|
inline |
Gets the singleton instance of the specified type.
TSingleton | The type of the singleton to get. |
|
inline |
Gets the singleton pointer of the specified type.
TSingleton | The type of the singleton to get. |
|
inlinestatic |
Determines if the appdomain was created yet.
true
if the appdomain was created yet, otherwise false
.
|
inline |
Removes the singleton pointer of the specified type from this AppDomain.
TSingleton | The type of the singleton to remove. |
true
if the singleton exists and could be removed, otherwise false
.