Jump to content

Lookup name: Difference between revisions

From EDM2
Ak120 (talk | contribs)
mNo edit summary
 
Line 1: Line 1:
This method locates an object by name within a specified Container object of the Interface Repository, or within objects contained in the Container object.  
This method locates an object by name within a specified Container object of the Interface Repository, or within objects contained in the Container object.


==Syntax==
==Syntax==
<pre>  
<pre>
Container              receiver;
Container              receiver;
Environment          *env;
Environment          *env;
Line 12: Line 12:


rc = lookup_name(receiver, env, search_name, levels_to_search, limit_type, exclude_inherited);
rc = lookup_name(receiver, env, search_name, levels_to_search, limit_type, exclude_inherited);
</pre>  
</pre>


==Parameters==
==Parameters==
;receiver (Container)  
;receiver (Container):A pointer to a Container object in which to locate the object.
:A pointer to a Container object in which to locate the object.  
;env (Environment *):A pointer to the Environment structure for the caller.
 
;search_name (Identifier):The name of the object to be located.
;env (Environment *)  
;levels_to_search (long):A long having the value 1 or -1.
: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 object to search for.
 
;exclude_inherited (boolean):A boolean value: TRUE to exclude an object when it is inherited, or FALSE to return the object from wherever it is found.
;search_name (Identifier)  
:The name of the object to be located.  
 
;levels_to_search (long)  
:A long having the value 1 or -1.  
 
;limit_type (InterfaceName)  
:The name of one interface type (see the valid list above) or "all", to specify what type of object to search for.  
 
;exclude_inherited (boolean)  
:A boolean value: TRUE to exclude an object when it is inherited, or FALSE to return the object from wherever it is found.  


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


==Remarks==
==Remarks==
The lookup_name method locates an object by name within a specified Container object, or within objects contained in the Container object. The "search_name" specifies the name of the object to be found. Each object represents a component of an IDL interface (class) definition maintained within the Interface Repository.  
The lookup_name method locates an object by name within a specified Container object, or within objects contained in the Container object. The "search_name" specifies the name of the object to be found. Each object represents a component of an IDL interface (class) definition maintained within the Interface Repository.


The "levels_to_search" argument controls whether the lookup is constrained to the specified Container object or whether objects contained within the Container object are also searched. The "levels_to_search" value should be -1 to search the Container and all contained objects; it should be 1 to search only the Container itself.  
The "levels_to_search" argument controls whether the lookup is constrained to the specified Container object or whether objects contained within the Container object are also searched. The "levels_to_search" value should be -1 to search the Container and all contained objects; it should be 1 to search only the Container itself.


If "limit_type" is set to "all", the lookup locates an object of the specified name with any interface type; otherwise, the search locates the object only if it has the designated interface type. Valid values for InterfaceName are limited to the following set:  
If "limit_type" is set to "all", the lookup locates an object of the specified name with any interface type; otherwise, the search locates the object only if it has the designated interface type. Valid values for InterfaceName are limited to the following set:  
Line 47: Line 35:
"OperationDef", "TypeDef", "all"}
"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 58: Line 46:
     SOMFree (seq._buffer);              /* Release the buffer  */
     SOMFree (seq._buffer);              /* Release the buffer  */
     }
     }
</pre>  
</pre>


==Original Class==
==Original Class==
Container  
Container


==Example Code==
==Example Code==
<pre>  
<pre>
#include <containr.h>
#include <containr.h>
#include <containd.h>
#include <containd.h>
Line 90: Line 78:
if (sc._length)
if (sc._length)
     SOMFree (sc._buffer);
     SOMFree (sc._buffer);
</pre>


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

Latest revision as of 02:23, 8 November 2021

This method locates an object by name within a specified Container object of the Interface Repository, or within objects contained in the Container object.

Syntax

Container              receiver;
Environment           *env;
Identifier             search_name;
long                   levels_to_search;
InterfaceName          limit_type;
boolean                exclude_inherited;
sequence<Contained>    rc;

rc = lookup_name(receiver, env, search_name, levels_to_search, limit_type, exclude_inherited);

Parameters

receiver (Container)
A pointer to a Container object in which to locate the object.
env (Environment *)
A pointer to the Environment structure for the caller.
search_name (Identifier)
The name of the object to be located.
levels_to_search (long)
A long having the value 1 or -1.
limit_type (InterfaceName)
The name of one interface type (see the valid list above) or "all", to specify what type of object to search for.
exclude_inherited (boolean)
A boolean value: TRUE to exclude an object when it is inherited, or FALSE to return the object from wherever it is found.

Returns

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

Remarks

The lookup_name method locates an object by name within a specified Container object, or within objects contained in the Container object. The "search_name" specifies the name of the object to be found. Each object represents a component of an IDL interface (class) definition maintained within the Interface Repository.

The "levels_to_search" argument controls whether the lookup is constrained to the specified Container object or whether objects contained within the Container object are also searched. The "levels_to_search" value should be -1 to search the Container and all contained objects; it should be 1 to search only the Container itself.

If "limit_type" is set to "all", the lookup locates an object of the specified name with any interface type; otherwise, the search locates the object only if it has the designated interface type. 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>
#include <containd.h>
#include <repostry.h>

...

Container repo;
Environment *ev;
sequence(Contained) sc;
long i;
Identifier nameToFind;

...

repo = (Container) RepositoryNew ();
sc = Container_lookup_name (repo, ev, nameToFind, -1, "all", TRUE);
printf ("%d object%s found:\n",
          sc._length, sc._length == 1 ? "" : "s");
for (i=0; i <seq._length;i++) {
    printf ("\t%s\n",
        Contained__get_id (sc._buffer[i], ev));
    SOMObject_somFree (sc._buffer[i]);
}
if (sc._length)
    SOMFree (sc._buffer);

Related Methods