TIBCO Adapter SDK C++ Reference
MAssocList::set
MAssocList
Assign the specified value to the specified attribute. The new value overwrites any existing value.

The method replaces the value of the attribute at the specified position if the attribute is present, else it appends the attribute with the specified name and value to the list.

Example
Assume you have a class MyClass with the following attributes:

a = Value
b = Value
c = Value
c = Value
d = Value

To replace the second c attribute, you have two choices:

  • Use set() and set position to 4

  • Use setAt() and set index to 1. Index always starts at 0, so the second c attribute has the index 1.
Remarks
The set() method always makes a copy of the MData passed (or any of its subclasses). Note, however, that the content of MInstance, MSequence, and MAssocList is reference counted. Therefore, the copy of an MInstance, Msequence, or MAssocList will still reference the same contents (use MInstance::deepCopy() for a completely independent copy).
Parameters
Parameters Description
const MString& rsName Name of the attribute to which you want to assign a new value.
MData* pValue New value for the attribute.
unsigned long ulPosition = 0 Position of the attribute in the association list. This is particularly useful when there are two or more attributes with the same name exist in the association list.
Declaration
virtual Mboolean set(const MString& rsName, MData* pValue, unsigned long ulPosition = 0);
Links
Copyright (c) 2010 TIBCO Software Inc. All rights reserved.