Jump to content

Describe: Difference between revisions

From EDM2
Created page with "This method returns a structure containing information defined in the IDL specification that corresponds to a specified Contained object in the Interface Repository. ==Synta..."
 
No edit summary
Line 69: Line 69:


==Related Methods==
==Related Methods==
* within
* [[within]]
[[Category:SOM IRF]]

Revision as of 04:37, 29 November 2020

This method returns a structure containing information defined in the IDL specification that corresponds to a specified Contained object in the Interface Repository.

Syntax

Contained        receiver;
Environment     *env;
Description      rc;

rc = describe(receiver, env);


Parameters

receiver (Contained)
A pointer to the Contained object in the Interface Repository for which a Description is needed.
env (Environment *)
A pointer to the Environment structure for the caller.


Returns

rc (Description)
Returns a structure of type Description containing information defined in the IDL specification of the receiving object.

Remarks

The describe method returns a structure containing information defined in the IDL specification of a Contained object. The specified object represents a component of an IDL interface (class) definition maintained within the Interface Repository.

When finished using the information in the returned Description structure, the client code must release the storage allocated for it. To free the associated storage, use a call similar to this:

if (desc.value._value)
     SOMFree (desc.value._value);
CAUTION

The describe method returns pointers to elements within objects (for example, name). Thus, the somFree method should not be used to release any of these objects while the describe information is still needed.


The "name" field of the Description is the name of the type of description. The "name" values are from the following set: {"ModuleDescription", "InterfaceDescription", "AttributeDescription", "OperationDescription", "ParameterDescription", "TypeDescription", "ConstantDescription", "ExceptionDescription"}

The "value" field is a structure of type any whose "_value" field is a pointer to a structure of the type named by the "name" field of the Description. This structure provides all of the information contained in the IDL specification of the receiver. For example, if the describe method is invoked on an object of type AttributeDef, the "name" field of the returned Description will contain the identifier "AttributeDescription" and the "value" field will contain an any structure whose "_value" field is a pointer to an AttributeDescription structure.

Original Class

Contained

Example Code

 
#include <containd.h>
#include <attribdf.h>
#include <somtc.h>

...
AttributeDef attr; /* An AttributeDef object (also a Contained) */
Description desc; /* .value field will be an AttributeDescription */
AttributeDescription *ad;
Environment *ev;

...
desc = Contained_describe (attr, ev);
ad = (AttributeDescription *) desc.value._value;
printf ("Attribute name: %s, defined in: %s\n",
         ad->name, ad->defined_in);
printf ("Attribute type: ");
TypeCode_print (ad->type, ev);
printf ("Attribute mode: %s\n", ad->mode == AttributeDef_READONLY ?
        "READONLY" : "NORMAL");
SOMFree (desc.value._value); /* Finished with describe output */
SOMObject_somFree (attr);    /* Finished with AttributeDef object */

Related Methods