Indy 9 | Content | Index | Reference

TIdCommandHandlers
Hierarchy, Properties, Methods, See Also, Unit: IdTCPServer
Implements a collection for command handler object instances.

    TIdCommandHandlers = class(TOwnedCollection)

Unit
IdTCPServer
Description
TIdCommandHandlers is a TOwnedCollection descendant that implements a collection of TIdCommandHandler items. TIdCommandHandlers publishes the Server property to identify the TIdTCPServer that owns the command handlers collection.

TIdCommandHandlers is used to represent the CommandHandlers property in TIdTCPServer and descendant classes, and is accessed when a peer thread executes and command handlers are enabled.

TIdCommandHandlers overrides methods in the ancestor class that Create the collection and establish the Server that owns the collection, and Add new collection items.

TIdCommandHandlers.Items
TIdCommandHandlers
Provide indexed access to command handlers in the collection.

    property Items [AIndex: Integer]: TIdCommandHandler;

Description
Items is an indexed TIdCommandHandler property and provides access to the command handler instances assigned to the collection using the Ordinal position specified in the Index. Index must be in the range 0 through Count - 1. Items can be used to iterate over the contained object instances in order to locate a specific TIdCommandHandler in the collection.

TIdCommandHandlers.OwnedBy
TIdCommandHandlers
Identies the server that is the owner of the command handler collection.

    property OwnedBy: TPersistent;

Description
OwnedBy is a read-only TPersistent property that identifies the persistent object that acts as the owner of the command handler instances in the collection.

OwnedBy has been introduced in Indy to provide compatibility between VCL versions where Owner was not exposed in the TOwnedCollection ancestor class, and Delphi 6. In Delphi 6, OwnedBy prevents any conflict with the Owner property in TOwnedCollection that is used for memory management, assignment, and streaming.

OwnedBy provides a read access specifier that insures the OwnedBy property is returned as a TPersistent value. This avoids internal errors and potential crashes that may occur in Delphi 5.

TIdCommandHandlers.Server
TIdCommandHandlers, See Also
Identifies the TIdTCPServe that is the owner of the collection.

    property Server: TIdTCPServer;

Description
Server is a TIdTCPServer property that identifies the owner of the collection, and the server implementaion used in executing peer thread connections.

TIdCommandHandlers.Add
TIdCommandHandlers, See Also
Adds a new item to the command handler collection.

    function Add: TIdCommandHandler;

Return Value
TIdCommandHandler - Item added to the collection.
Description
Add is a TIdCommandHandler function used to add new collection items to the owned collection. Add calls the inherited Add method, and casts the return value to an instance of TIdCommandHandler as required by the collection.

TIdCommandHandlers.Create
TIdCommandHandlers, See Also
Constructs the command handler collection.

    constructor Create(AServer: TIdTCPServer); reintroduce;

Parameters
AOwner
Owner of the collection.
Description
Create is the constructor for the object instance. Create calls the inherited Create method using AOwner as the owner of the collection, and TIdCommandHandler as teh ItemCLass for the collection.

Create also sets the Server property to the value specified in AOwner.

Created with Doc-O-Matic 2 donated to Project JEDI. Commercial license available from the Doc-O-Matic site.