somGetName

From EDM2
Jump to: navigation, search

This method returns the name of a class. Not generally overridden.

For backward compatibility, this method does not take an Environment parameter.

Original Class 
SOMClass

Syntax

string somGetname (SOMClass receiver)

Parameters

receiver (SOMClass) 
The class whose name is desired.

Return Code

rc (string) 
Returns a pointer to the name of the class.

Remarks

This 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 (e.g., 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 C and C++ usage bindings for accessing class objects (e.g., the <className>NewClass procedure, or the _<className> macro). This is because the 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.

This method is not generally overridden. The returned address is valid until the class object is unregistered or freed.

Example Code

#include <animal.h>   /* assume Animal defined in the Zoo module */
#include <string.h>
main()
{
  string className = Zoo_AnimalNewClass(0,0)->somGetName();
  SOM_Test(!strcmp(  className, "Zoo::Animal"));
}

Related Methods