Cisco Cisco Computer Telephony Integration OS 8.5 Entwickleranleitung
12-11
CTI OS Developer’s Guide for Cisco Unified ICM/Contact Center Enterprise & Hosted
Release 8.0(1)
Chapter 12 Helper Classes
Arguments Class
When running the application, the call to methodA may behave as if it was passed the modified
Arguments array. This is because many CTI OS methods simply place a pointer to the Arguments array
on a queue of items to be sent to CTI OS server. When the same Arguments array is later modified, as
in the preceding example, the pointer on the queue now points to the modified array and the modified
array is sent to CTI OS server. A problem may occur depending on timing, as there are multiple threads
involved: the thread pulling items off the queue and the thread modifying the Arguments array. If the
queued message is sent to CTI OS before the Arguments array is modified, the problem will not occur.
Arguments array. This is because many CTI OS methods simply place a pointer to the Arguments array
on a queue of items to be sent to CTI OS server. When the same Arguments array is later modified, as
in the preceding example, the pointer on the queue now points to the modified array and the modified
array is sent to CTI OS server. A problem may occur depending on timing, as there are multiple threads
involved: the thread pulling items off the queue and the thread modifying the Arguments array. If the
queued message is sent to CTI OS before the Arguments array is modified, the problem will not occur.
To avoid this problem, call the Clone method on the initial Arguments array and modify the copy rather
than modifying the original. For example, the preceding example would change as follows:
than modifying the original. For example, the preceding example would change as follows:
•
Programmer passes an Arguments array (initialArray) into a CTI OS SDK method (methodA)
•
MethodA returns
•
modifiedArray = initialArray.Clone()
•
Programmer modifies modifiedArray
•
Programmer passes the modifiedArray into another CTI OS SDK method (methodB)
AddItem (C++, COM, VB only)
The AddItem method expects a key-value pair. The key value may be a string or an integer. The value
may be a string, an integer, or an object reference. If there is an entry with the same key, it will be
replaced with this entry, otherwise the new key-value pair will be added to the arguments array. Keys are
not case sensitive. Leading and trailing spaces are always removed from the key.
may be a string, an integer, or an object reference. If there is an entry with the same key, it will be
replaced with this entry, otherwise the new key-value pair will be added to the arguments array. Keys are
not case sensitive. Leading and trailing spaces are always removed from the key.
Syntax
C++:
bool AddItem( std::string& key, int value );
bool AddItem( std::string& key, unsigned int value );
bool AddItem( std::string& key, unsigned short value );
bool AddItem( std::string& key, short value );
bool AddItem( std::string& key, bool value );
bool AddItem( std::string& key, char * pchar );
bool AddItem( std::string& key, std::string& value );
bool AddItem( std::string& key, Arg& value );
bool AddItem( std::string& key, const Arg& value );
bool AddItem( std::string& key, Arguments& value );
bool AddItem( std::string& key, const Arguments& value);
bool AddItem( char * key, int value );
bool AddItem( char * key, unsigned int value );
bool AddItem( char * key, unsigned short value );
bool AddItem( char * key, short value );
bool AddItem( char * key, bool value );
bool AddItem( char * key, char * value );
bool AddItem( char * key, std::string& value );
bool AddItem( char * key, Arg& cArg );
bool AddItem( char * key, const Arg& value );
bool AddItem( char * key, Arguments& value );
bool AddItem( char * key, const Arguments& value );
bool AddItem( enum_Keywords key, int value );
bool AddItem( enum_Keywords key, unsigned int value );
bool AddItem( enum_Keywords key, unsigned short value );
bool AddItem( enum_Keywords key, short value );