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

The method replaces the value of the attribute if it is present, if the index is out of bounds, it throws an exception.

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 Index Position of the attribute in the association list.
Declaration
virtual Mboolean setAt(const MString& rsName, MData* pValue, unsigned long Index) throw(MException);
Links
Copyright (c) 2010 TIBCO Software Inc. All rights reserved.