All Frameworks Class Hierarchy This Framework Next Indexes
System Class CATApplication
System.IUnknown
|
+---System.IDispatch
|
+---System.CATBaseUnknown
|
+---System.CATEventSubscriber
|
+---System.CATCommand
|
+---CATApplication
Usage: you can derive this class.
public class CATApplication
Base class for applications.
Role:
An application is the main object in a process and includes
related objects, such as windows, as data members.
Constructor and Destructor Index
- o
CATApplication(CATCommand*,void*)
- Constructs an application.
- o
~CATApplication()
-
Method Index
- o
AddFileDescriptor(int,CATCommand*,void*,void(*)())
- Adds a file descriptor subscription to a command.
- o
AddTimeOut(int,CATCommand*,void*,void(*)())
- Adds a timeout subscription to a command.
- o
BeginApplication()
- Begins the application.
- o
BuildApplicationEnvironment(int,char**,char**)
- Builds the application environment.
- o
EndApplication()
- Ends the application.
- o
MainApplication()
- Returns a pointer to the application data member.
- o
RemoveFileDescriptor(int,CATCommand*)
- Removes a file descriptor subscription from a command.
- o
RemoveSubscribe(int,CATCommand*)
- Removes a transaction/idle subscription from a command.
- o
RemoveTimeOut(int,CATCommand*)
- Removes a timeout subscription from a command.
- o
RunApplication()
- Accommodates the event loop.
- o
Subscribe(int,CATCommand*,void*,void(*)())
- Adds a transaction/idle subscription to a command.
Constructor and Destructor
o CATApplication
public CATApplication( | CATCommand* | iParent, |
| void* | iMode | =0) |
-
Constructs an application.
- Parameters:
-
- iParent
- The parent command of the created application.
Legal values:
Set it to NULL, except if you have several application instances in
the same process.
- iMode
- A flag to indicate whether the application constructor supplies the main function
Legal values:
(iMode=0) or if the application is instantiated from an
existing main function.
o ~CATApplication
public virtual ~CATApplication( | ) |
-
Methods
o AddFileDescriptor
public int AddFileDescriptor( | int | iFileDescriptor, |
| CATCommand* | iToClient, |
| void* | iClientData, |
| void(*)() | UserStaticMethod) |
-
Adds a file descriptor subscription to a command.
Role:
This recalls the command on a given static method when the given file
descriptor is modified. This applies generally to any entity homogeneous
to a file, such as an input flow, a pipe, a socket, but not to disk files.
The term file descriptor applies to UNIX and corresponds to file handle
with Windows.
- Parameters:
-
- iFileDescriptor
- The file descriptor whose modification requests to call the method
UserStaticMethod
- iToClient
- The command to call with its UserStaticMethod
- iClientData
- Data useful to UserStaticMethod
- UserStaticMethod
- The method to call when iFileDescriptor is modified.
- Returns:
- 0 if the file descriptor subscription is successfully added and 0 otherwise.
o AddTimeOut
public int AddTimeOut( | int | iTime, |
| CATCommand* | iToClient, |
| void* | iClientData, |
| void(*)() | UserStaticMethod) |
-
Adds a timeout subscription to a command.
Role:
Recalls the command on a given static method when the given time is elapsed.
- Parameters:
-
- iTime
- The time, expressed in milliseconds, to leave elaspe from the moment AddTimeOut
is called, to the moment UserStaticMethod is called
- iToCLient
- The command to call using its UserStaticMethod method
- iClientData
- Data to pass to UserStaticMethod
- UserStaticMethod
- The method to call when iTime is elapsed
- Returns:
- 0 if the timeout subscription is successfully added and 1 otherwise.
o BeginApplication
public virtual void BeginApplication( | ) |
-
Begins the application.
Role:
This method must be redefined to contain the main objects instantiation.
It should contain the whole application code.
o BuildApplicationEnvironment
public virtual void BuildApplicationEnvironment( | int | argc, |
| char** | argv, |
| char** | env) |
-
Builds the application environment.
Role:
This environment can be, for example, the different windows used by the
application.
- Parameters:
-
- argc
- The argc command line argument containing the number
of arguments passed to the main function (argument count).
- argv
- The argv command line argument, pointer to a character
string table containing the arguments (argument vector).
- env
- The pointer to the environment list.
o EndApplication
public virtual int EndApplication( | ) |
-
Ends the application.
Role:
This method should be redefined to include end application tasks,
such as closing files.
- Returns:
- The application return code.
o MainApplication
-
Returns a pointer to the application data member.
- Returns:
- The application data member pointer, or the first application created if several application instances exist.
Do never release this returned pointer.
o RemoveFileDescriptor
public int RemoveFileDescriptor( | int | iFileDescriptor, |
| CATCommand* | iToClient) |
-
Removes a file descriptor subscription from a command.
- Parameters:
-
- iFileDescriptor
- The file descriptor.
- iToClient
- The command for which the subscription is to be removed.
- Returns:
- 0 if the file descriptor subscription is successfully removed and 0 otherwise.
- See also:
- AddFileDescriptor
o RemoveSubscribe
public int RemoveSubscribe( | int | iSubscribedType, |
| CATCommand* | iToClient) |
-
Removes a transaction/idle subscription from a command.
- Parameters:
-
- iSubscribedType
- The subscribed type.
Legal values: Can be set to CATSubscribeEndTransaction
(=1) or to CATSubscribeIdle (=2)
- iToClient
- The command for which the subscription is to be removed.
- Returns:
- 0 if the transaction/idle subscription is successfully removed and 0 otherwise.
- See also:
- Subscribe
o RemoveTimeOut
public int RemoveTimeOut( | int | iTime, |
| CATCommand* | iToClient) |
-
Removes a timeout subscription from a command.
Role:
To remove the subscription for a given command instance and a given time.
- Parameters:
-
- iTime
- The elapsed time
- iToClient
- The command for which the subscription is to be removed
- Returns:
- 0 if the timeout subscription is successfully removed and 1 otherwise.
- See also:
- AddTimeOut
o RunApplication
public virtual void RunApplication( | ) |
-
Accommodates the event loop.
Warning: It cannot be used with Windows, since the event loop is
managed only by the operating system.
o Subscribe
public int Subscribe( | int | iSubscribingType, |
| CATCommand* | iToClient, |
| void* | iClientData, |
| void(*)() | UserStaticMethod) |
-
Adds a transaction/idle subscription to a command.
- Parameters:
-
- iSubscribingType
- The subscribing type.
Legal values: Can be set to CATSubscribeEndTransaction
(=1) or to CATSubscribeIdle (=2)
- iToClient
- The command to call with its UserStaticMethod
- iClientData
- Data useful to UserStaticMethod
- UserStaticMethod
- The method to call when the state defined by
iSubscribingType is reached.
- Returns:
- 0 if the transaction/idle subscription is successfully added and 0 otherwise.
This object is included in the file: CATApplication.h
If needed, your Imakefile.mk should include the module: JS0FM