System CATCommand

Usage: you can derive this class.


public class CATCommand

Base class for all objects that need to collaborate through notifications.
Role: To provide the basic command behavior, that is, to send notifications, that usually depicts a user interaction, to other commands and to receive notifications sent by other commands. This behavior is known as the send/receive communication protocol.

All the existing commands are organized as a tree structure. Each command has a parent command and possibly children. The parent is passed as a parameter of the command constructor.

When the end-user interacts with the application, system events are produced that CNext turns into notifications, and sends them to either the command that is involved, such as the push button pushed by the end user, or to the command that is the nearest to the user interaction, such as the manipulator set onto a document object's representation selected by the end user in a graphics viewer.

The notification is sent from command to command along the tree structure until it can be processed. If no command able to process the notification is found, it is sent to the command selector that resends it to the active command. This can decide to process the notification, or otherwise to do something else, possibly nothing.

See also:
, ,


Constructor and Destructor Index


o CATCommand(CATCommand*,CATString&)
Constructs a command with a given parent and identifier.
o CATCommand(CATCommand*,CATString* const)
Constructs a command with a given parent and identifier.
o ~CATCommand()

Method Index


o Activate(CATCommand*,CATNotification*)
Activates a command.
o AddAnalyseNotificationCB(CATCommand*,char*,CATCommandMethod,CATCommandClientData)
Adds a callback for a given notification published by a given command.
o AddAnalyseNotificationCB(CATCommand*,CATNotification*,CATCommandMethod,CATCommandClientData)
Adds a callback for a given notification published by a given command.
o AnalyseNotification(CATCommand*,CATNotification*)
Analyzes a notification sent by another command.
o Cancel(CATCommand*,CATNotification*)
Cancels a command.
o Desactivate(CATCommand*,CATNotification*)
Deactivates a command.
o GetFather()
Returns the command parent.
o GetName()
Returns the command identifier.
o GetStartMode()
Returns the command start mode.
o RemoveAnalyseNotificationCB(CATCallback)
Removes a callback.
o RemoveAnalyseNotificationCB(CATCommand*,char*)
Removes a callback for a given notification published by a given command.
o RemoveAnalyseNotificationCB(CATCommand*,CATNotification*)
Removes a callback for a given notification published by a given command.
o RemoveAnalyseNotificationCB(CATCommand*,char*,CATCommandClientData)
Removes a callback for a given notification published by a given command.
o RemoveAnalyseNotificationCB(CATCommand*,CATNotification*,CATCommandClientData)
Removes a callback for a given notification published by a given command.
o RequestDelayedDestruction()
Requests the command delayed destruction.
o RequestStatusChange(CATCommandMsg,CATCommand*)
Requests a command status change.
o SendCommandSpecificObject(char*,CATNotification*)
Requests an object to be retrieved.
o SendNotification(CATCommand*,CATNotification*)
Sends a notification to another command.
o SendObject(char*,CATNotification*)
Requests an object to be retrieved.
o SetFather(CATCommand*)
Sets the command parent.

Constructor and Destructor


o CATCommand
public CATCommand( iParent,
const iIdentifier)
Constructs a command with a given parent and identifier.
Role: The command is constructed using its parent command in the command tree structure, that is the command to which the notifications that the constructed command cannot process are sent, and using its identifier.
Parameters:
iParent
The command's parent
iIdentifier
The command's identifier, as a constant CATString
o CATCommand
public CATCommand( iParent=NULL,
iIdentifier=NULL)
Constructs a command with a given parent and identifier.
Role: The command is constructed using its parent command in the command tree structure, that is the command to which the notifications that the constructed command cannot process are sent, and using its identifier.
Parameters:
iParent
The command's parent
iIdentifier
The command's identifier, as a pointer to a constant pointer to CATString
o ~CATCommand
public virtual ~CATCommand()

Methods


o Activate
public virtual Activate( iFromClient,
iNotification)
Activates a command.
Role: Called by the command selector to give the focus to the command.
Parameters:
iFromClient
The command that requests to activate the current one
iNotification
The notification sent
Returns:
The command status.
o AddAnalyseNotificationCB
protected AddAnalyseNotificationCB( iPublishingCommand,
const iNotificationClassName,
iMethodToExecute,
iUsefulData)
Adds a callback for a given notification published by a given command.
Parameters:
iPublishingCommand
The command that publishes the notification
iNotificationClassName
The class name of the notification sent by iPublishingCATCommand.
Legal values: Use the ClassName static method of the notification class.
Example: MyNotification::ClassName(), where MyNotification is the notification class from which an instance is expected
iMethodToExecute
The method to execute whenever iPublishingCATCommand publishes iNotificationClassName
iUsefulData
Data to pass to iMethodToExecute and that can be useful to this method
Returns:
The added callback
o AddAnalyseNotificationCB
protected AddAnalyseNotificationCB( iPublishingCommand,
iPublishedNotification,
iMethodToExecute,
iUsefulData)
Adds a callback for a given notification published by a given command.
Parameters:
iPublishingCommand
The command that publishes the notification.
iPublishedNotification
The notification published by iPublishingCATCommand
iMethodToExecute
The method to execute whenever iPublishingCATCommand publishes iPublishedNotification
iUsefulData
Data to pass to iMethodToExecute and that can be useful to this method
Returns:
The added callback
o AnalyseNotification
public virtual AnalyseNotification( iFromClient,
iNotification)
Analyzes a notification sent by another command.
Parameters:
FromClient
The command that sends the notification to be analyzed
iNotification
The notification to analyze
Returns:
The notification propagation mode
o Cancel
public virtual Cancel( iFromClient,
iNotification)
Cancels a command.
Role: Called by the command selector to definitely withdraw the focus from the command. The command should then request its destruction.
Parameters:
iFromClient
The command that requests to cancel the current one
iNotification
The notification sent
Returns:
The command status.
o Desactivate
public virtual Desactivate( iFromClient,
iNotification)
Deactivates a command.
Role: Called by the command selector to temporarily withdraw the focus from the command.
Parameters:
iFromClient
The command that requests to deactivate the current one
iNotification
The notification sent
Returns:
The command status.
o GetFather
public GetFather()
Returns the command parent.
Role: The command parent is usually set by the constructor. The notifications sent to the command are resent to its parent if the command cannot process them.
o GetName
public virtual GetName()
Returns the command identifier.
o GetStartMode
public GetStartMode()
Returns the command start mode.
o RemoveAnalyseNotificationCB
protected RemoveAnalyseNotificationCB( iCallbackToRemove)
Removes a callback.
Parameters:
iCallbackToRemove
The callback to remove
o RemoveAnalyseNotificationCB
protected RemoveAnalyseNotificationCB( iPublishingCommand,
const iNotificationClassName)
Removes a callback for a given notification published by a given command.
Parameters:
iPublishingCommand
The command that publishes the notification
iNotificationClassName
The class name of the notification sent by iPublishingCATCommand.
Legal values: Use the ClassName static method of the notification class.
Example: MyNotification::ClassName(), where MyNotification is the notification class from which an instance is expected
o RemoveAnalyseNotificationCB
protected RemoveAnalyseNotificationCB( iPublishingCommand,
iPublishedNotification)
Removes a callback for a given notification published by a given command.
Parameters:
iPublishingCommand
The command that publishes the notification
iPublishedNotification
The notification published by iPublishingCATCommand
o RemoveAnalyseNotificationCB
protected RemoveAnalyseNotificationCB( iPublishingCommand,
const iNotificationClassName,
iUsefulData)
Removes a callback for a given notification published by a given command.
Parameters:
iPublishingCommand
The command that publishes the notification
iNotificationClassName
The class name of the notification sent by iPublishingCATCommand.
Legal values: Use the ClassName static method of the notification class.
Example: MyNotification::ClassName(), where MyNotification is the notification class from which an instance is expected
iUsefulData
Data to pass to iMethodToExecute and that can be useful to this method
o RemoveAnalyseNotificationCB
protected RemoveAnalyseNotificationCB( iPublishingCommand,
iPublishedNotification,
iUsefulData)
Removes a callback for a given notification published by a given command.
Parameters:
iPublishingCommand
The command that publishes the notification
iPublishedNotification
The notification published by iPublishingCATCommand
iUsefulData
Data to pass to iMethodToExecute and that can be useful to this method
o RequestDelayedDestruction
public virtual RequestDelayedDestruction()
Requests the command delayed destruction.
Role: The command will ve destroyed as soon as this will be possible.
o RequestStatusChange
public RequestStatusChange( iMessageType,
iCommandSelector= NULL)
Requests a command status change.
Parameters:
iMessageType
The message type to send to the command selector
iCommandSelector
The command selector
Returns:
0 if the command status changes successfully
o SendCommandSpecificObject
public virtual SendCommandSpecificObject( const iObjectClassNeeded,
iNotification)
Requests an object to be retrieved.
Role: This method should be redefined by derived classes.
Parameters:
iObjectClassNeeded
The class of which the requested object should be an instance
iNotification
The notification received before the request
Returns:
A pointer to the retrieved object
o SendNotification
public SendNotification( iToClient,
iNotification)
Sends a notification to another command.
Role: This is a key method in the Send/receive communication protocol which can be used to send to the parent command either a notification received as is, or another notification that replaces and enriches the received notification. A command different than the parent command can be chosen if required.
Parameters:
iToClient
The command to which the notification is to be sent
iNotification
The notification to send
o SendObject
public SendObject( const iObjectClassNeeded,
iNotification)
Requests an object to be retrieved.
Parameters:
iObjectClassNeeded
The class of which the requested object should be an instance.
iNotification
The notification received before the request.
Returns:
A pointer to the retrieved object
o SetFather
public SetFather( iParent)
Sets the command parent.
Role: The command parent is usually set by the constructor. The notifications sent to the command are resent to its parent if the command cannot process them.
Parameters:
iParent
The command to set as the parent of the current command in the command tree structure

This object is included in the file: CATCommand.h
If needed, your Imakefile.mk should include the module: JS0FM

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