The following table contains information on the ISCModelObjectCollection interface:
|
Signature |
Description |
Valid Arguments |
|---|---|---|
|
ISCModelObjectCollection * Collect(VARIANT Root, VARIANT ClassId [optional], VARIANT Depth [optional], VARIANT MustBeOn [optional], VARIANT MustBeOff [optional]) |
Creates a Model Objects collection, which represents a subcollection of itself. The method creates a valid collection even though the collection may be empty. |
Root:
ClassId:
|
|
|
|
Depth:
MustBeOn:
MustBeOff:
|
Note: For information about valid object class names and identifiers, see the HTML document ERwin Metamodel Reference, in the Metamodel Reference Bookshelf located in the CA ERwin Data Modeler installation folder. More information about SC_ModelObjectFlags is located in the appendix API Interfaces Reference.
The following sections show the code examples for the different filters.
Example 10
The following example illustrates the Object Type filter using C++. The example uses the Session object from Example 6 and creates a collection of objects of csType type, owned by the rootObj object:
void FilterObjects(ISCSessionPtr scSessionPtr, ISCModelObjectPtr & rootObj,
CString & csType)
{
ISCModelObjectCollectionPtr scModelObjectsPtr;
scModelObjectsPtr = scSessionPtr->GetModelObjects()->Collect(rootObj->GetObjectId(), COleVariant(csType));
// …
}
The following example illustrates the Object Type filter using Visual Basic .NET. The example uses the Session object from Example 6 and creates a collection of objects of csType type, owned by the rootObj object:
Public Sub FilterObjects(ByRef scSession As SCAPI.Session, _
ByRef rootObj As SCAPI.ModelObject, ByRef objType as String)
Dim scModelObjects As SCAPI.ModelObjects
scModelObjects = scSession.ModelObject.Collect(rootObj, objType)
' scModelObjects will contain only objects of type objType
End Sub
Example 11
The following example illustrates the Depth filter using C++:
void FilterObjects(ISCSessionPtr scSessionPtr, ISCModelObjectPtr & rootObj,
CString & csType, long depth)
{
ISCModelObjectCollectionPtr scModelObjectsPtr;
scModelObjectsPtr = scSessionPtr->GetModelObject()->
Collect(rootObj->GetObjectId(), COleVariant(csType),depth);
// …
}
The following example illustrates the Depth filter using Visual Basic .NET:
Public Sub FilterObjects(ByRef scSession As SCAPI.Session, _
ByRef rootObj As SCAPI.ModelObject, ByRef classID As String, depth As Integer)
Dim scModelObjects As SCAPI.ModelObjects
scModelObjects = scSession.ModelObjects.Collect(rootObj, classID, depth)
End Sub
Example 12
The following example illustrates the MustBeOn/MustBeOff filter using C++. The example uses the Session object from Example 6:
void FilterObjects(ISCSessionPtr scSessionPtr, ISCModelObjectPtr & rootObj, long depth)
{
ISCModelObjectCollectionPtr scModelObjectsPtr;
scModelObjectsPtr = scSessionPtr->GetModelObjects()->
Collect(rootObj->GetObjectId(), vtMissing, depth, SCD_MOF_USER_DEFINED);
// …
}
The following example illustrates the MustBeOn/MustBeOff filter using Visual Basic .NET. The example uses the Session object from Example 6:
Public Sub FilterObjects(ByRef scSession As SCAPI.Session, _
ByRef rootObj As SCAPI.ModelObject, depth As Integer)
Dim scModelObjects As SCAPI.ModelObjects
scModelObjects = scSession.ModelObjects.Collect(rootObj, , depth, SCD_MOF_USER_DEFINED)
End Sub
|
Copyright © 2013 CA.
All rights reserved.
|
|