Class ApplicationCache

GEOS-SC:  Library shell_lib: Class ApplicationCache


The ApplicationCache class implements the public API for loading and unloading applications. The code that actually implements the application loading and unloading mechanism lies in a separate MCMApplicationCache object, which runs on the MCM thread. However, the public API will be called from other threads, so it consists of static functions that send messages to the MCM thread to call member functions on the MCMApplicationCache.

#include <shell/appcache.h>


Class Data and Methods

public:
static AppCacheError AllowUnloading(void);
static AppCacheError ActiveApplicationClosed(void);
static AppCacheError PreventUnloading(void);
static AppCacheError GetContextString(const TCHAR *ual, TCHAR **buf);
static AppCacheError SetContextString(const TCHAR *ual, const TCHAR *context);
static AppCacheError Goto(const TCHAR *ual, const TCHAR *context);
static AppCacheError SwitchTo(const TCHAR *ual);
protected:

Inherited Data and Methods:

This class does not inherit from any other class.

Back to the top of ApplicationCache


Ancestors

This class does not inherit from any other class.

Back to the top of ApplicationCache


Descendants

Class is not inherited by any others.

Back to the top of ApplicationCache


Descriptions of Class Data and Methods


AppCacheError AllowUnloading(void);

Called to once again allow the current application to be unloaded. If AllowUnloading() is called more times than PreventUnloading(), the call will be ignored.

Return value: ACE_INSUFFICIENT_MEMORY if not enough memory to perform this operation; otherwise ACE_SUCCESS.

See also: PreventUnloading()

Prototype:

    static AppCacheError AllowUnloading(void);

Back to the top of ApplicationCache


AppCacheError ActiveApplicationClosed(void);

Invoked when the active application has exited, to allow the AppCachePolicy a chance to bring another application to the foreground.

Return value: ACE_INSUFFICIENT_MEMORY if not enough memory to perform this operation; otherwise ACE_SUCCESS.

Prototype:

    static AppCacheError ActiveApplicationClosed(void);

Back to the top of ApplicationCache


AppCacheError PreventUnloading(void);

Invoked to ask the ApplicationCache not to unload the current application. Typically, this is done before a lengthy operation is started. A counter is kept, which means that if PreventUnloading is called twice, AllowUnloading() must also be called twice before the system will think that the application is ready to be unloaded.

Note: The policy for when applications are loaded and unloaded is implemented entirely within the ApplicationCache. PreventUnloading() will let the ApplicationCache know what the application's wishes are, but the ApplicationCache is still free to unload the application.

Return value: ACE_INSUFFICIENT_MEMORY if not enough memory to perform this operation; otherwise ACE_SUCCESS.

See also: AllowUnloading()

Prototype:

    static AppCacheError PreventUnloading(void);

Back to the top of ApplicationCache


AppCacheError GetContextString(const TCHAR *ual, TCHAR **buf);

Copies the context string for the application specified by the passed UAL and returns a pointer to the copy.

Parameters:

out buf
Place to store a pointer to the copy of the context string. If there is an error fetching the context string, the buf param is unmodified.
in ual
The UAL corresponding to the application whose state is desired. Must not be NULL.

Return value: AppCacheError; either ACE_SUCCESS if context string returned, ACE_UAL_NOT_FOUND if no context was stored for this UAL, or ACE_INSUFFICIENT_MEMORY if it could not allocate RAM to return the context.

See also: SetContextString(), Goto()

Prototype:

    static AppCacheError GetContextString(const TCHAR *ual, TCHAR **buf);

Back to the top of ApplicationCache


AppCacheError SetContextString(const TCHAR *ual, const TCHAR *context);

Makes a copy of the passed context string and stores it away. It is retrieved by the specified application the next time GetContextString() is invoked (perhaps when the application is next loaded) to restore the application to its previous state.

This is typically invoked on application shutdown by code in the default AppBase::Exit() handler.

Parameters:

in ual
The UAL corresponding to the application whose state is being set. Must not be NULL.
in context
The context string to store for the specified application. If NULL is passed, any existing context is freed, so the next call to GetContextString() for this UAL will return ACE_UAL_NOT_FOUND.

Return value: ACE_INSUFFICIENT_MEMORY if not enough memory to perform this operation; otherwise ACE_SUCCESS.

See also: GetContextString()

Prototype:

    static AppCacheError SetContextString(const TCHAR *ual, const TCHAR *context);

Back to the top of ApplicationCache


AppCacheError Goto(const TCHAR *ual, const TCHAR *context);

Called to deliver a context change to an application. If the application is not loaded, this will load it, but will NOT make it the active application. This is used for dispatching real-time clock events to the application, and may also be used for other simple forms of inter- application communication.

Regardless of whether the application is already loaded, the AppBase object will have AppBase::SetAppContext() invoked, passing the context string that is passed to Goto().

Parameters:

in ual
The string describing which application to launch. Must not be NULL.
in context
The context string to deliver to the application. A copy is made by this routine, so the context string may be immediately freed by the caller.

Return value: AppCacheError enumerated type.

See also: SwitchTo()

Prototype:

    static AppCacheError Goto(const TCHAR *ual, const TCHAR *context);

Back to the top of ApplicationCache


AppCacheError SwitchTo(const TCHAR *ual);

Brings up the passed application. If the application referenced by the passed UAL is already loaded, this makes it the active application. Otherwise, the application is loaded, set to the previously saved context (if one exists), and made the active application.

If a context is passed in, the application will be asked to switch to that context.

Parameters:

in ual
The string describing which application to launch. Must not be NULL.

Return value: AppCacheError enumerated type.

See also: Goto()

Prototype:

    static AppCacheError SwitchTo(const TCHAR *ual);

Back to the top of ApplicationCache


Generated from source by Geoworks on Sat Dec 12 18:30:41 1998 .