AfrFoundation CATAfrCommandSequence
Usage: you must use this class as is. You should never derive it.
public class CATAfrCommandSequence
Class representing a command sequence.
Role: A sequence is a list of couples {command header identifier, argument list}.
The sequence execution begins with the execution of the command pointed by the first command header
and it ends with the execution of the command pointed by the last command header.
Kinds of Sequences.
-
Wizard
A task is predefined and consists in a fixed sequence of commands. Each command in the sequence:
- reads its input parameters
- runs
- sets its output parameters
- continues the sequence.
It does not need to access the sequence structure in order to pass its outputs as the inputs of the following command, or to start the following command.
-
Cycle
While running, a command decides to start a command sequence that ends with its re-starting (PLM Update case):
The main command detects a problem and proposes a solution to the user. The main command (C1) does not master this problem solving but knows the command (C2) or command sequence that does. C1 will dynamically build and start the following sequence:
- C1 sets the right information for C2 to start C1 again;
- C1 start C2;
- C2 runs and starts C1 (though C2 does not know C1);
- C1 runs again, evaluates the progression to the solution and takes appropriate actions.
Dynamic sequence
During a sequence, each command may modify the remaining sequence:
- Change any command header id in the sequence.
- Change any parameter of any command in the sequence.
Constructor and Destructor Index
- o
~CATAfrCommandSequence()
-
Method Index
- o
Append(CATAfrCommandHeaderStartInfo&)
- Add a command information to the list.
- o
CATDeclareCBEvent(SEQUENCE_ENDED)
- Event sent when the sequence ends.
- o
Continue()
- Continue the command sequence.
- o
Create()
- Create a command sequence.
- o
GetCommandHeaderStartInfo(int,CATAfrCommandHeaderStartInfo&)
- Access to a command information.
- o
GetSequence(CATAfrCommandSequence*&)
- Access to the command sequence.
- o
GetSize(int&)
- Give the size of the list.
- o
RemovePosition(int)
- Remove a command information.
- o
Start()
- Start the command sequence.
Constructor and Destructor
o ~CATAfrCommandSequence
public virtual ~CATAfrCommandSequence( | ) |
-
Methods
o Append
public Append( | const | iStartInfo) |
-
Add a command information to the list.
Role:Adds a command information object at the end of the list.
There is no way to add in the middle of the list.
- Returns:
- always S_OK.
o CATDeclareCBEvent
public CATDeclareCBEvent( | | ) |
-
Event sent when the sequence ends.
Role:
this event is sent by the sequence when it ends, normally or not.
It may be useful to end the object that started the sequence.
Sample of use:
::AddCallback(this,
pSequence,
CATAfrCommandSequence::SEQUENCE_ENDED(),
(CATSubscriberMethod)&MyClass::MyCBMethod,
NULL);
o Continue
-
Continue the command sequence.
Role:Continue the current sequence by starting the next command in the sequence.
The preceding command is removed from the sequence AND RequestDelayedDestruction is called on it to stop it.
Each command in the sequence must call Continue, even the last one,
else the sequence will never step to the next command of the sequence.
If this service fails (see causes below) the sequence is deleted.
The output and input-output parameters of the preceding command are matched with the input and input-output parameters of the next command:
if identifiers are equal and value types are the same, the value of the output is copied to the input, even if the input already has a value.
- Returns:
- S_OK if continuation succeeds, E_FAIL if no sequence was found or the command header was not found or the command header did not start any command.
o Create
-
Create a command sequence.
Role:Calls the constructor to create the current sequence.
Do not directly call the constructor, the sequence would be unusable.
Only one sequence may be running. Calling this method a second time before the first sequence ends
will not create a sequence and will return an error code.
- Returns:
- S_OK if creation succeeds, E_FAIL if no sequence could be created.
o GetCommandHeaderStartInfo
public GetCommandHeaderStartInfo( | const | iIndex, |
| | oStartInfo) |
-
Access to a command information.
Role:Returns the information about a command of the sequence.
- Parameters:
-
- iIndex
- The number of the object to get in the list.
- oStartInfo
- The command information object.
- Returns:
- S_OK if info was found, E_INVALIDARG if index is out of bounds.
o GetSequence
public static GetSequence( | | oCurrentSequence) |
-
Access to the command sequence.
Role:Returns the running sequence.
The running sequence may be queried from anywhere while it is running.
The returned sequence is modifyable by using other methods of this class.
- Parameters:
-
- oCurrentSequence
- The sequence.
- Returns:
- S_OK if continuation succeeds, E_FAIL if no sequence was found.
o GetSize
-
Give the size of the list.
Role:Returns the number of objects in the list.
- Parameters:
-
- oSize
- The size.
- Returns:
- always S_OK.
o RemovePosition
public RemovePosition( | const | iIndex) |
-
Remove a command information.
Role:Deletes the information about a command of the sequence.
- Parameters:
-
- iIndex
- The number of the object to remove from the list.
- Returns:
- S_OK if remove was done, E_INVALIDARG if index is out of bounds.
o Start
-
Start the command sequence.
Role:Starts the current sequence by starting the first command in the sequence.
If this service fails (see causes below) the sequence is deleted.
- Returns:
- S_OK if start succeeds, E_FAIL if no sequence was found or the command header was not found or the command header did not start any command.
This object is included in the file: CATAfrCommandSequence.h
If needed, your Imakefile.mk should include the module: CATAfrFoundation
Copyright © 1999-2015, Dassault Systèmes. All rights reserved.