Jump to content

Contents: Difference between revisions

From EDM2
No edit summary
Ak120 (talk | contribs)
mNo edit summary
 
Line 1: Line 1:
This method returns a sequence indicating the objects contained within a specified Container object of the Interface Repository.  
This method returns a sequence indicating the objects contained within a specified Container object of the Interface Repository.


==Syntax==
==Syntax==
Line 10: Line 10:


rc = contents(receiver, env, limit_type, exclude_inherited);
rc = contents(receiver, env, limit_type, exclude_inherited);
</pre>  
</pre>  


==Parameters==
==Parameters==
;receiver (Container)  
;receiver (Container):A pointer to a Container object whose contained objects are needed.
:A pointer to a Container object whose contained objects are needed.  
;env (Environment *):A pointer to the Environment structure for the caller.
 
;limit_type (InterfaceName):The name of one interface type (see the valid list above) or "all", to specify what type of objects the contents method should search for.
;env (Environment *)  
;exclude_inherited (boolean):A boolean value: TRUE to exclude any inherited objects, or FALSE to include all objects.
:A pointer to the Environment structure for the caller.  
 
;limit_type (InterfaceName)  
:The name of one interface type (see the valid list above) or "all", to specify what type of objects the contents method should search for.  
 
;exclude_inherited (boolean)  
:A boolean value: TRUE to exclude any inherited objects, or FALSE to include all objects.  


==Returns==
==Returns==
;rc (sequence<Contained>)  
;rc (sequence<Contained>):Returns a sequence of pointers to objects contained within the specified Container object.
:Returns a sequence of pointers to objects contained within the specified Container object.  


==Remarks==
==Remarks==
The contents method returns a list of objects contained by the specified Container object. Each object represents a component of an IDL interface (class) definition maintained within the Interface Repository.  
The contents method returns a list of objects contained by the specified Container object. Each object represents a component of an IDL interface (class) definition maintained within the Interface Repository.


The contents method is used to navigate through the hierarchy of objects within the Interface Repository. Starting with the Repository object, this method can list all of the objects in the Repository, then all of the objects within the ModuleDef objects, then all within the InterfaceDef objects, and so on.  
The contents method is used to navigate through the hierarchy of objects within the Interface Repository. Starting with the Repository object, this method can list all of the objects in the Repository, then all of the objects within the ModuleDef objects, then all within the InterfaceDef objects, and so on.


If the "limit_type" is set to "all", objects of all interface types are returned; otherwise, only objects of the requested interface type are returned. Valid values for InterfaceName are limited to the following set:  
If the "limit_type" is set to "all", objects of all interface types are returned; otherwise, only objects of the requested interface type are returned. Valid values for InterfaceName are limited to the following set:
{"AttributeDef", "ConstantDef", "ExceptionDef", "InterfaceDef",
{"AttributeDef", "ConstantDef", "ExceptionDef", "InterfaceDef",
"ModuleDef", "ParameterDef", "OperationDef", "TypeDef", "all"}
"ModuleDef", "ParameterDef", "OperationDef", "TypeDef", "all"}


If "exclude_inherited" is set to TRUE, any inherited objects will not be returned.  
If "exclude_inherited" is set to TRUE, any inherited objects will not be returned.


When finished using the sequence returned by this method, the client code is responsible for releasing each of the objects in the sequence and freeing the sequence buffer. In C, this can be accomplished as follows:  
When finished using the sequence returned by this method, the client code is responsible for releasing each of the objects in the sequence and freeing the sequence buffer. In C, this can be accomplished as follows:
<pre>  
<pre>
if (seq._length) {
if (seq._length) {
     long i;
     long i;
Line 81: Line 72:
else
else
     printf ("\t[none]\n");
     printf ("\t[none]\n");
</pre>


</pre>
==Related Methods==
==Related Methods==
* [[lookup_name]]
* [[lookup_name]]
* [[describe_contents]]
* [[describe_contents]]
[[Category:SOM IRF]]
[[Category:SOM IRF]]

Latest revision as of 22:10, 7 November 2021

This method returns a sequence indicating the objects contained within a specified Container object of the Interface Repository.

Syntax

  
Container              receiver;
Environment           *env;
InterfaceName          limit_type;
boolean                exclude_inherited;
sequence<Contained>    rc;

rc = contents(receiver, env, limit_type, exclude_inherited);

Parameters

receiver (Container)
A pointer to a Container object whose contained objects are needed.
env (Environment *)
A pointer to the Environment structure for the caller.
limit_type (InterfaceName)
The name of one interface type (see the valid list above) or "all", to specify what type of objects the contents method should search for.
exclude_inherited (boolean)
A boolean value: TRUE to exclude any inherited objects, or FALSE to include all objects.

Returns

rc (sequence<Contained>)
Returns a sequence of pointers to objects contained within the specified Container object.

Remarks

The contents method returns a list of objects contained by the specified Container object. Each object represents a component of an IDL interface (class) definition maintained within the Interface Repository.

The contents method is used to navigate through the hierarchy of objects within the Interface Repository. Starting with the Repository object, this method can list all of the objects in the Repository, then all of the objects within the ModuleDef objects, then all within the InterfaceDef objects, and so on.

If the "limit_type" is set to "all", objects of all interface types are returned; otherwise, only objects of the requested interface type are returned. Valid values for InterfaceName are limited to the following set: {"AttributeDef", "ConstantDef", "ExceptionDef", "InterfaceDef", "ModuleDef", "ParameterDef", "OperationDef", "TypeDef", "all"}

If "exclude_inherited" is set to TRUE, any inherited objects will not be returned.

When finished using the sequence returned by this method, the client code is responsible for releasing each of the objects in the sequence and freeing the sequence buffer. In C, this can be accomplished as follows:

if (seq._length) {
    long i;
    for (i=0; i <seq._length;i++)
       SOMObject_somFree (seq._buffer[i]); /* Release each object */
    SOMFree (seq._buffer);                 /* Release the buffer  */
}

Original Class

Container

Example Code

 
#include <containr.h>

...

Container anObj;
Environment *ev;
sequence(Contained) sc;
long i;

...

sc = Container_contents (anObj, ev, "all", TRUE);
printf ("%s contains the following objects:\n",
    SOMObject_somIsA (anObj, _Contained) ?
        Contained__get_name ((Contained) anObj, ev) :
        "The Interface Repository");
for (i=0; i <seq._length;i++) {
    printf ("\t%s\n",
        Contained__get_name (sc._buffer[i], ev));
    SOMObject_somFree (sc._buffer[i]);
}
if (sc._length)
    SOMFree (sc._buffer);
else
    printf ("\t[none]\n");

Related Methods