1-92 SOMobjects Base Toolkit: Programmer’s Reference Manual
somGetName Method
Purpose
Returns the name of a class. Not generally overridden.
IDL Syntax
string somGetName ( );
Note: For backward compatibility, this method does not take an Environment parameter.
Description
The somGetName method returns the address of a zero-terminated string that gives the
name of the receiving class. This name may be used as a RepositoryId in the
Repository_lookup_id method (described in the SOM Interface Repository Framework
section) to obtain the IDL interface definition that corresponds to the receiving class.
The returned name is not necessarily the same as the statically known class name used by
a programmer to gain access to the class object (for example, via the method
somFindClass). This is because the method somSubstituteClass may have been used
to “shadow” the class having the static name used by the programmer.
Also, when the interface to a class’s instances is defined within an IDL module, the returned
name will not directly correspond to the names of the procedures and macros made
available by the SOMobjects C and C++ usage bindings for accessing class objects (for
example, the <className>NewClass procedure, or the _<className> macro). This is
because the <className> token used in constructing the names of these procedures and
macros uses an underscore character to separate the module name from the interface
name, while the actual name of the corresponding class uses two colon characters instead
of an underscore for this purpose.
The somGetName method is not generally overridden. The returned address is valid until
the class object is unregistered or freed.
Parameters
receiver The class whose name is desired.
Return Value
The somGetName method returns a pointer to the name of the class.
C++ Example
#include <animal.xh> /* assume Animal defined in the Zoo module
*/
#include <string.h>
main()
{
string className = Zoo_AnimalNewClass(0,0)–>somGetName();
SOM_Test(!strcmp(className, ”Zoo::Animal”));
}
Original Class
SOMClass
Related Information
Methods: Repository_lookup_id, somSubstituteClass, somFindClass
Comentários a estes Manuais