Cisco Cisco Computer Telephony Integration Option 9.0 Developer's Guide

Page of 508
   
12-2
CTI OS Developer’s Guide for Cisco Unified ICM/Contact Center Enterprise & Hosted
Release 8.0(1)
Chapter 12      Helper Classes
Arg Class
Arg Class
The Arg is a generic class used in parameters or return values in CIL methods. Information sent by CTI 
OS server to the CIL in an event is packed in an Arguments object where each element of the array is an 
object of type Arg. An Arg object’s absolute data type is determined by the type of data it stores. The 
basic types an object can store are identified by the enumerated constants in 
.
Arg class methods will do conversion between types whenever possible. For example, you can do a 
SetValue(25) and then do a GetValueString() which will return the string “25”.   You can also do a 
SetValue(“25”) and then do a GetValueIntObj which will return an Integer object containing the numeric 
value 25. However, if you call SetValue “abc” and try to retrieve it as an int, it will fail.
 lists the available Arg class methods.
In many scenarios, programmers will stick to Arguments (see the preceding section), which wraps many 
Arg methods and encapsulates a collection of Arg objects.
AddRef
The AddRef method increments the reference count for the data item. It is necessary to call this if you 
are storing a pointer to the item for some time (for example, if you plan to store and use Arguments 
received in an event handler after the event thread has returned to the calling code). When you are finished 
with the item, you must call the Release method or a memory leak will result.
Syntax
C++:
 
unsigned long AddRef()
COM:
HRESULT AddRef()
VB, Java, .NET: 
Not used
Table 12-1
Arg Class Methods
Method
Description
AddRef
Increments the reference count for the data item.
Clone
Creates an exact copy of the Arg object.
CreateInstance
Creates an Arg object.
DumpArg
Builds a string containing the value stored in the Arg.
GetType
Returns the type of the data stored in the argument (one 
of the values in 
GetValueInt 
GetValueUInt 
GetValueUInt 
GetValueUShort 
GetValueShort 
GetValueBool 
GetValueString
Returns the value stored in the argument.
SetValue
Sets the data in the Arg object.