Table of Contents

TTMSMCPResources.AddResource Method

Validates an entry and appends a copy of it to the collection.

API unit family: TMS.MCP.Resources Declaring type: TTMSMCPResources

Syntax

function AddResource(const AResource: TTMSMCPResource): Integer;

Remarks

Addresses are not checked for duplicates, so registering the same address twice leaves the earlier entry as the one that is found.

Parameters

Name Description
AResource Entry to copy. It is not adopted: the caller keeps it and remains responsible for freeing it.

Returns

Index of the new entry in the collection.

Exceptions

Exception Description
EJsonRpcException Raised with invalid-parameters, error code -32602, when the name is empty, when neither a fixed address nor a template address is set, or when no handler is assigned.