vcActionContainer
vcActionContainer is a container of vcAction objects used for storing, buffering, sending and receiving actions between resource clients, providers and brokers.
Inherits: vcBehaviour
Properties
Name | Type | Access | Description |
ActionCount | Integer | R | Gets the total number of actions in container. |
Actions | List of vcAction | R | Gets a list of all actions in container. |
Brokers | List of vcActionContainer | RW | Defines a list of connected brokers. |
Clients | List of vcActionContainer | RW | Defines a list of connected clients. |
PendingActionCount | Integer | R | Gets the number of actions in the PendingActions property list. |
NextFreeTime | Real | RW | Defines the next available time this container is able to process actions during a simulation. |
PendingActions | List of vcAction | R | Gets a list of pending action stored in the container. That is, actions that are received from other action containers and buffered for action processing. |
Processing | Boolean | RW | Defines if this container is executing actions. |
Providers | List of vcActionContainer | RW | Defines a list of connected providers. |
Reserved | vcActionContainer | RW | Defines if this container is reserved by other action container. |
Methods
Name | Return Type | Parameters | Description |
clear | None | None | Deletes all actions in container. |
clearPending | None | None | Deletes all pending actions in container. |
createAction | vcAction | String action_name | Creates a new vcAction in container, and then returns the new action. |
createPendingAction | vcAction | String name | Creates a new pending action in the container. |
deleteAction | Boolean | vcAction action
or Integer index |
Deletes a given action or one at a given index from container.
If deletion is successful, returns True; otherwise returns False. |
deletePendingAction | Boolean | vcAction action | Deletes a given action from the PendingActions property list. |
do | Boolean | String action_type, [arg...],[name=arg...] | Executes an action using the container.
If action can be performed, returns True; otherwise returns False. Each action type has its own set of arguments which are described in Action Constants. Action arguments can be added in the order how they are described in the action parameter table. An alternative approach is to use Python keywords, which allows only using specific keyword arguments. See list of possible action types and their arguments. |
getAction | vcAction | Integer index | Returns an action found at the given index in container. |
getPendingAction | vcAction | Integer index | Returns a pending action found at a given index in container. |
getResources | List of vcActionContainer | None | Returns a list of immediate resources connected to container. |
moveAction | Boolean | vcAction action, Integer index | Moves a given action to a given index in Actions property list.
If moving is successful, returns True; otherwise returns False. |
movePendingAction | Boolean | vcAction action, Integer index | Moves a given action to a new position in the PendingActions property list.
If moving is successful, returns True, otherwise False is returned. |
popPending | vcAction | [Integer index] | Removes the last action from the PendingActions property list, and then returns that action; otherwise returns None.
If an index argument is given, the action found at that position in the PendingActions property list will be removed and returned by the method; otherwise, returns None. |
release | Boolean | None | Releases the container from the action container defined in the Resource property. If the release is successful, returns True; otherwise returns False. |
removePendingAction | Boolean | vcAction action | Removes a given action from the PendingActions property list. |
reserve | vcActionContainer | String resource_filter, [String action_type], [Timeout=real] | Reserves a resource provider matching resource_filter, and then returns the reserved resource.
If resource is not available immediately, the method will wait until resource is available. If no matching resource is available, the method returns None. An optional action_type argument can be given to reserve the resource for a specific action. See list of possible action types. An optional Timeout argument can be given to define how long the method will wait (in seconds) in order to reserve a resource. If the resource cannot be reserved before Timeout expires, the method returns None. |
start | Boolean | String action_type, [arg...], [name_arg...] | Executes an action using container regardless if an other action is still running.
If action can be performed, returns True; otherwise returns False. Generally, start() is used with the wait() method in order to catch when an action executed with start() has been completed. Each action type has its own set of arguments which are described in Action Constants. Action arguments can be added in the order how they are described in the action parameter table. An alternative approach is to use Python keywords, which allows only using specific keyword arguments. See list of possible action types. |
use | Boolean | String resource_filter, String action_type, [arg...],[name=arg...], [Real timeout] | Executes an action using a specific resource.
If no resource is found based on resource_filter and the action is available immediately (not in queue), the method will wait until the specified resource is available. If resource can be used to perform action, returns True; otherwise returns False. Optional timeout keyword argument defines how long the method will wait (in seconds) for the reserved resource to become available. If resource cannot be reserved before timeout expires, return False. Each action type has its own set of arguments which are described in Action Constants. Action arguments can be added in the order how they are described in the action parameter table. An alternative approach is to use Python keywords, which allows only using specific keyword arguments. See list of possible action types. |
wait | Boolean | [Real timeout] | Waits until action called in start() method is completed, and then returns True.
If an optional timeout argument is used, the method will return False if an action is not completed within the allocated time period (in seconds). |