C++ iterator does not preserve the order that is defined in the repository for MInstance Class Attributes and MOperation Parameters

C++ iterator does not preserve the order that is defined in the repository for MInstance Class Attributes and MOperation Parameters

book

Article ID: KB0085243

calendar_today

Updated On:

Products Versions
TIBCO Adapter SDK -
Not Applicable -

Description

Resolution:
The reason why the order of MInstance Class Attributes and MOperation Parameters defined in the repository is not preserved by C++ iterator is because the internal structure for storing the MInstance Attributes/Operation parameters are designed to gain the optimal efficiency in serialization and deserialization.

But there are workarounds in Adapter SDK to iterate Minstance Class Attributes and MOperation Parameters in the order that is defined in the repository.

Below code snippet describes how to iterate MInstance Class Attributes in the order that is defined in the repository:
>>>>>>>>>&gtBegin of Code Snippet>>>>>>>>>>>>
         for( i = 0; i < MModeledClassDescription::getAttributeCount(); i++)
               MModeledClassDescription::getAttribute(i);
<<<<<<<<<&ltEnd of Code Snippet<<<<<<<<<<<<<

Below code snippet describes how to Iterate MOperation Parameters in the order that is defined in the repository:

>>>>>>>>>&gtBegin of Code Snippet>>>>>>>>>>>>

class MyOpDesc : public MOperationDescription {
  public:

    virtual const MList&ltMOperationParameterDescription* >&  getOrderedParameters() const
                          { return MOperationDescription::getOrderedParameters();}
    protected:

     MyOpDesc(const MString& rsClassName, MClassRegistry* pClassRegistry,
                             MMetaDescription* pOwner, const MString& rsOperationName,
                             Mboolean bIsOneway,const MString& rsReturnClassName) throw (MException)
                            : MOperationDescription(rsClassName, pClassRegistry, pOwner, rsOperationName, bIsOneway,rsReturnClassName) { }

};

const MOperationDescription* opDesc = inRequest.getOperationDescription();
const MyOpDesc* myOpDesc = (const MyOpDesc*)opDesc;
const MList&ltMOperationParameterDescription* >& params = myOpDesc-&gtgetOrderedParameters();

<<<<<<<<<&ltEnd of Code Snippet<<<<<<<<<<<<<

Issue/Introduction

C++ iterator does not preserve the order that is defined in the repository for MInstance Class Attributes and MOperation Parameters