Jump to content

Describe: Difference between revisions

From EDM2
No edit summary
Ak120 (talk | contribs)
mNo edit summary
 
Line 1: Line 1:
This method returns a structure containing information defined in the IDL specification that corresponds to a specified Contained object in the Interface Repository.  
This method returns a structure containing information defined in the IDL specification that corresponds to a specified Contained object in the Interface Repository.


==Syntax==
==Syntax==
Line 7: Line 7:
   
   
  rc = describe(receiver, env);
  rc = describe(receiver, env);


==Parameters==
==Parameters==
;receiver (Contained)  
;receiver (Contained):A pointer to the Contained object in the Interface Repository for which a Description is needed.
: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.
 
;env (Environment *)  
:A pointer to the Environment structure for the caller.  
 


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


==Remarks==
==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.  
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:


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)
  if (desc.value._value)
       SOMFree (desc.value._value);
       SOMFree (desc.value._value);


;CAUTION:
;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 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:  
The "name" field of the Description is the name of the type of description. The "name" values are from the following set:  
Line 38: Line 29:
"ConstantDescription", "ExceptionDescription"}
"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.  
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==
==Original Class==
Contained  
Contained


==Example Code==
==Example Code==
<pre>  
<pre>
#include <containd.h>
#include <containd.h>
#include <attribdf.h>
#include <attribdf.h>
Line 70: Line 61:
==Related Methods==
==Related Methods==
* [[within]]
* [[within]]
[[Category:SOM IRF]]
[[Category:SOM IRF]]

Latest revision as of 22:11, 7 November 2021

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