Click or drag to resize

InternalElementTypeAddRoleClassReference(RoleFamilyType, Boolean, Boolean, Boolean) Method

Adds a RoleClass reference to this InternalElement object using the provided RoleClass object. The RoleClass reference is added as a RoleRequirementsType object. For CAEX documents which are based on CAEX version 2.15, only one RoleRequirement is allowed for an InternalElement. Additional RoleClass references are automatically added as SupportedRoleClass objects.

Namespace: Aml.Engine.CAEX
Assembly: Aml.Engine (in Aml.Engine.dll) Version: 3.2
Syntax
public IObjectWithRoleReference AddRoleClassReference(
	RoleFamilyType roleClass,
	bool addSupportedRoleClass = false,
	bool addUnique = true,
	bool addInstance = false
)

Parameters

roleClass  RoleFamilyType
The RoleClass to be assigned to the InternalElement.
addSupportedRoleClass  Boolean  (Optional)
if set to true [add supported role class].
addUnique  Boolean  (Optional)
if set to true, the RoleClass reference is not added, if a reference to the provided RoleClass already exists.
addInstance  Boolean  (Optional)
if set to true, the reference is created as am instance of the RoleClass, containing all ExternalInterfaces and Attributes of the RoleClass.

Return Value

IObjectWithRoleReference
The new added RoleClass reference, which is either a RoleRequirement or a SupportedRoleClass.
Exceptions
ExceptionCondition
ArgumentNullExceptionroleClass
Remarks
The default behaviour is, that only a reference to the role class is added and no instance of the class containing all Attributes and ExternalInterface objects. If an instance is required, set the optional parameter 'addInstance' to true or use the CreateClassInstance and the Insert(CAEXWrapper, Boolean) methods.
Example
This sample shows how to call the AddRoleClassReference(RoleFamilyType, Boolean, Boolean, Boolean) method using a standard base RoleClass from the RoleClassLib(CAEXDocument)
C#
var amlBaseRoleClassLib = AutomationMLBaseRoleClassLibType.RoleClassLib (myDocument);
var myIH = myDocument.CAEXFile.InstanceHierarchy.Append ("myIH");
var myIE = myIH.InternalElement.Append("myIH");
myIE.AddRoleClassReference (amlBaseRoleClassLib.AutomationMLBaseRole);
See Also