GetDeclarationResult GetDeclarationBlock(OdId tObject, GetDeclarationBlockArg tArg)
tObject. Unit or assembly moniker.
tArg. Operation execution parameters.
The GetDeclarationBlock operation is used to navigate through code.
The operation gets information about global members or types implemented in the code, and also about local members implemented inside namespaces, classes and interfaces. To execute the operation, in the tObject parameter specify moniker of the repository object that is unit or assembly. The object moniker can be obtained on executing the GetObjects operation. In the tArg.path parameter specify name of the type, for which one should get information about local members. If tArg.path is not set, information about global members and types is obtained.
Below is the example of using the GetDeclarationBlock operation to get information about members of the specified class. The request contains moniker of unit in the repository and class name. The response contains information about class members. The C# example uses the FindObjectById function, which code is given in the Getting Object Description by Its Identifier example.
{
"GetDeclarationBlock" :
{
"tObject" :
{
"id" : "S1!M!172002"
},
"tArg" :
{
"path" : "TestObject"
}
}
}
{
"GetDeclarationBlockResult" :
{
"result" :
{
"it" :
[
{
"type" : "Var",
"moduleName" : "M_ADDITIONAL",
"name" : "_arr",
"typeName" : "Array",
"access" : "Private",
"beginPoint" :
{
"col" : "5",
"row" : "2"
},
"endPoint" :
{
"col" : "19",
"row" : "2"
},
"isShared" : "0"
},
{
"type" : "Sub",
"moduleName" : "M_ADDITIONAL",
"name" : "Create",
"access" : "Public",
"beginPoint" :
{
"col" : "12",
"row" : "4"
},
"endPoint" :
{
"col" : "27",
"row" : "7"
},
"isShared" : "0"
},
{
"type" : "Sub",
"moduleName" : "M_ADDITIONAL",
"name" : "CreateWithParams",
"access" : "Public",
"beginPoint" :
{
"col" : "12",
"row" : "9"
},
"endPoint" :
{
"col" : "37",
"row" : "15"
},
"blocks" :
{
"it" :
[
{
"type" : "Var",
"name" : "DefaultValue",
"typeName" : "Double",
"access" : "Public",
"beginPoint" :
{
"col" : "12",
"row" : "9"
},
"endPoint" :
{
"col" : "37",
"row" : "15"
}
},
{
"type" : "Var",
"name" : "Size",
"typeName" : "Integer",
"access" : "Public",
"beginPoint" :
{
"col" : "12",
"row" : "9"
},
"endPoint" :
{
"col" : "37",
"row" : "15"
}
}
]
},
"isShared" : "0"
},
{
"type" : "Sub",
"moduleName" : "M_ADDITIONAL",
"name" : "Run",
"access" : "Public",
"beginPoint" :
{
"col" : "12",
"row" : "17"
},
"endPoint" :
{
"col" : "16",
"row" : "20"
},
"isShared" : "0"
}
]
}
}
}
public static GetDeclarationResult GetDeclarationBlock(MbId mb, string objId)
{
var somClient = new SomPortTypeClient(); //Proxy object for operation execution
//Operation execution parameters
var tGet = new GetDeclarationBlock()
{
tArg = new GetDeclarationBlockArg()
{
path = "TestObject"
},
//Create object moniker
tObject = new OdId() { id = mb.id + "!" + FindObjectById(mb, objId).k }
};
//Get information about class child members
var result = somClient.GetDeclarationBlock(tGet);
return result;
}
See also: