System 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 AddFileDescriptor(int,CATCommand*,void*,CATSysFileDescCB,int*)
Adds a file descriptor subscription to a command.
o AddTimeOut(int,CATCommand*,void*,void(*)())
Adds a timeout subscription to a command.
o AddTimeOut(int,CATCommand*,void*,CATSysTimeOutCB,int*)
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,int,int)
Removes a file descriptor subscription from a command.
o RemoveFileDescriptor(int,CATCommand*)
Removes a file descriptor subscription from a command.
o RemoveSubscribe(int,int,int)
Removes a transaction/idle subscription from a command.
o RemoveSubscribe(int,CATCommand*)
Removes a transaction/idle subscription from a command.
o RemoveTimeOut(int,int,int)
Removes a timeout 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.
o Subscribe(int,CATCommand*,void*,CATSysSubscribeCB,int*)
Adds a transaction/idle subscription to a command.

Constructor and Destructor


o CATApplication
public CATApplication( iParent,
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 AddFileDescriptor( iFileDescriptor,
iToClient,
iClientData,
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 AddFileDescriptor
public AddFileDescriptor( iFileDescriptor,
iToClient,
iClientData,
iUserStaticMethod,
oFileDescCBId=NULL)
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 iUserStaticMethod
iToClient
The command to call with its iUserStaticMethod
iClientData
Data useful to iUserStaticMethod
iUserStaticMethod
The method to call when iFileDescriptor is modified.
oFileDescCBId
oFileDescCBId must be either NULL or point to the address of valid int variable If oFileDescCBId is not NULL , at the successul completion of the AddFileDescriptor method oFileDescCBId will be set to a non negative value representing the id of the callback.
Returns:
0 if the file descriptor subscription is successfully added and 0 otherwise.
o AddTimeOut
public AddTimeOut( iTime,
iToClient,
iClientData,
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 AddTimeOut
public AddTimeOut( iTime,
iToClient,
iClientData,
iUserStaticMethod,
oTimeOutCBId=NULL)
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 iUserStaticMethod is called
iToCLient
The command to call using its iUserStaticMethod method
iClientData
Data to pass to iUserStaticMethod
iUserStaticMethod
The static method or function to call when iTime is elapsed.
oTimeOutCBId
oTimeOutCBId must be either NULL or point to the address of valid int variable If oTimeOutCBId is not NULL , at the successul completion of the AddTimeOut method if will be set to a non negative value representing the id of the callback.
Returns:
0 if the timeout subscription is successfully added and 1 otherwise.
o BeginApplication
public virtual 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 BuildApplicationEnvironment( argc,
argv,
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 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
public static 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 RemoveFileDescriptor( iFileDescriptor,
iFileDescCBId,
iReserved=0)
Removes a file descriptor subscription from a command.
Parameters:
iFileDescriptor
The file descriptor.
iFileDescCBId
The id of the subscription to be removed ( returned through the parameter oFileDescCBId of the
method)
iReserved
This parameter must me set to zero
Returns:
0 if the file descriptor subscription is successfully removed and 0 o
See also:
o RemoveFileDescriptor
public RemoveFileDescriptor( iFileDescriptor,
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:
o RemoveSubscribe
public RemoveSubscribe( iSubscribedType,
iSubscribeCBId,
iReserved=0 )
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)
iSubscribeCBId
The id of the subscription to be removed ( returned through the parameter oSubscribeCBId of the
method)
iReserved
This parameter must me set to zero
Returns:
0 if the transaction/idle subscription is successfully removed and 0 otherwise.
See also:
o RemoveSubscribe
public RemoveSubscribe( iSubscribedType,
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:
o RemoveTimeOut
public RemoveTimeOut( iTime,
iTimeOutCBId,
iReserved=0)
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
iTimeOutCBId
The id of the subscription to be removed ( returned through the parameter oTimeOutCBId of the
method)
iReserved
This parameter must me set to zero
Returns:
0 if the timeout subscription is successfully removed and 1 otherwise.
See also:
o RemoveTimeOut
public RemoveTimeOut( iTime,
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:
o RunApplication
public virtual 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 Subscribe( iSubscribingType,
iToClient,
iClientData,
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.
o Subscribe
public Subscribe( iSubscribingType,
iToClient,
iClientData,
iUserStaticMethod,
oSubscribeCBId=NULL )
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 iUserStaticMethod
iClientData
Data useful to iUserStaticMethod
iUserStaticMethod
The method to call when the state defined by iSubscribingType is reached.
oSubscribeCBId
oSubscribeCBId must be either NULL or point to the address of valid int variable If oSubscribeCBId is not NULL , at the successul completion of the AddFileDescriptor
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

Copyright © 1999-2015, Dassault Systèmes. All rights reserved.