smc_create_view

Description

Creates a view that can contain one or more data items. For information about data items, refer to Chapter 2, “Data Items and Statistical Types”.

You can use the smc_create_view function with both Monitor Server and Historical Server. When used with Historical Server (SMC_SERVER_M_HISTORICAL), it creates a view for the recording or playback session that is being defined.

Syntax

SMC_RETURN_CODE smc_create_view
 (SMC_CONNECT_ID         clientId,
 	SMC_DATAITEM_STRUCTP   dataItemListHandle,
 	SMC_SIZET              dataItemListLength,
 	SMC_CHARP              viewName,
 	SMC_VIEW_IDP           viewIdHandle)

Parameters

clientId

identifies the connection.

dataItemListHandle

pointer to array of SMC_DATAITEM_STRUCTs.

dataItemListLength

number of data items in the array pointed to by the dataItemListHandle.

viewName

null-terminated string containing a descriptive name for this view. This name can include a – z, A – Z, 0 – 9, and underscore (_) characters, or can be NULL.

Used only for a Historical Server connection. For a live connection, the view name is ignored.

viewIdHandle

pointer to a variable, which should be declared as type SMC_VIEW_ID. If the call to smc_create_view succeeds, this variable contains the ID for the view.

Returns

Return value

Indicates

SMC_RET_SUCCESS

Function succeeded.

SMC_RET_FAILURE

Function failed.

SMC_RET_INVALID_CONNECT

Connection does not exist.

Examples

Example 1

This example assumes that you have created a connection and have a clientId.

SMC_DATAITEM_STRUCT  dataItem =
                      { SMC_NAME_PAGE_LOGICAL_READ,
                         SMC_STAT_VALUE_SAMPLE };
 SMC_DATAITEM_STRUCTP dataItemHandle = &dataItem;
 SMC_VIEW_ID viewId;
 SMC_VIEW_IDP viewHandle = &viewId;

if (smc_create_view(clientId,
         dataItemHandle,
         1,   		/* just one dataItem */
         NULL,   /* this is a Monitor Server view */
         viewIdHandle) != SMC_RET_SUCCESS) 
 {
 		printf("smc_create_view failed\n");
 		/* do some cleanup */
 }

Usage


Valid server modes

Mode

Availability

SMC_SERVER_M_LIVE

Yes

SMC_SERVER_M_HISTORICAL

Yes


Errors

Error

Indicates

SMC_RET_INVALID_API_FUNC_SEQUENCE

Invalid calling sequence of Monitor Client Library functions

SMC_RET_INVALID_DINAME

Invalid data item

SMC_RET_INVALID_DI_STATTYPE

Invalid data item statistic type

SMC_RET_INSUFFICIENT_MEMORY

Insufficient memory

See also

smc_create_recording_session, smc_create_playback_session, smc_initiate_recording, smc_initiate_playback, smc_drop_view