gov.llnl.babel.backend
Class IOR

java.lang.Object
  extended bygov.llnl.babel.backend.IOR

public class IOR
extends java.lang.Object

Class IOR contains common sidl to IOR translation routines shared by the backend code generators. This class simply collects many common IOR language bindings into one place.


Field Summary
static int CAST
          The index of the builtin method for casting.
static int CLASS_BUILTIN_METHODS
          The number of builtin methods that a class has.
static int CONSTRUCTOR
          The index of the builtin method for constructing a class.
static int DELETE
          The index of the builtin method for deleting an object.
static int DESTRUCTOR
          The index of the builtin method for destructing a class.
static int INTERFACE_BUILTIN_METHODS
          The number of builtin methods that an interface has.
static int MAJOR_VERSION
           
static int MINOR_VERSION
           
 
Constructor Summary
IOR()
           
 
Method Summary
static java.lang.String getArgumentString(Argument arg)
          Generate an IOR argument string for the specified sidl argument.
static java.lang.String getArgumentWithFormal(Argument arg)
          Generate an IOR argument string with the formal argument name.
static java.lang.String getArrayName(SymbolID id)
          Convert a sidl symbol into its array representation, which is "struct " followed by the symbol name followed by "__array".
static Method getBuiltinMethod(int index, SymbolID id)
          Return the method description of a particular builtin method.
static java.lang.String getBuiltinName(int index)
          Return the name of a builtin method.
static java.lang.String getCast(Method method, java.lang.String self)
          Generate a cast string for the specified method.
static java.lang.String getClassType()
          Return the name of the type of the implicit base class type.
static java.lang.String getEnumName(SymbolID id)
          Convert a sidl enumerated type into its symbol name, which is "enum " followed by the symbol name followed by "__enum".
static java.lang.String getEPVName(SymbolID id)
          Convert a sidl symbol into its method entry point vector (EPV) name, which is "struct " followed by the symbol name followed by "__epv".
static java.lang.String getExceptionFundamentalType()
          Return the name of the type of the implicit exception argument; namely, sidl_BaseInterface_object.
static java.lang.String getExternalFunc(SymbolID id)
          Get the name of the function that returns the structure of external entry points.
static java.lang.String getExternalName(SymbolID id)
          Get struct name for extern entry point structure.
static java.lang.String getFiniName(SymbolID id)
          Convert a sidl symbol into the name of its associated fini method, which is the symbol name appended with "__fini".
static java.lang.String getHeaderFile(SymbolID id)
          Generate the header filename associated with a symbol identifier.
static java.lang.String getInitName(SymbolID id)
          Convert a sidl symbol into the name of its associated init method, which is the symbol name appended with "__init".
static java.lang.String getInterfaceType()
          Return the name of the type of the base interface type.
static java.lang.String getNewName(SymbolID id)
          Convert a sidl symbol into the name of its associated constructor, which is the symbol name appended with "__new".
static java.lang.String getObjectName(SymbolID id)
          Convert a sidl interface or class into its symbol name, which is "struct " followed by the symbol name followed by "__object".
static java.lang.String getRemoteName(SymbolID id)
          Convert a sidl symbol into the name of its associated remote constructor, which is the symbol name appended with "__remote".
static java.lang.String getReturnString(Type type)
          Generate an IOR return string for the specified sidl type.
static java.lang.String getSEPVName(SymbolID id)
          Convert a sidl symbol into its static entry point vector (SEPV) name, which is "struct " followed by the symbol name followed by "__sepv".
static java.lang.String getSetEPVName(SymbolID id)
          Convert a sidl symbol into the name of its associated set EPV method, which is the symbol name appended with "__set_epv".
static java.lang.String getSetSEPVName(SymbolID id)
          Convert a sidl symbol into the name of its associated set static EPV method, which is the symbol name appended with "__set_sepv".
static java.lang.String getSourceFile(SymbolID id)
          Generate the source filename associated with a symbol identifier.
static java.lang.String getStaticsName(SymbolID id)
          Convert a sidl symbol into the name of its associated statics method, which is the symbol name appended with "__statics".
static java.lang.String getSymbolName(SymbolID id)
          Convert a symbol name into an IOR identifier.
static java.lang.String getSymbolType(Symbol sym)
           
static java.lang.String getVectorEntry(java.lang.String methodName)
          Generate the name of an entry in the entry point vector or the static entry point vector.
static java.lang.String getVersionName(SymbolID id)
          Convert a sidl symbol into the name of its associated fini method, which is the symbol name appended with "__fini".
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

MAJOR_VERSION

public static final int MAJOR_VERSION
See Also:
Constant Field Values

MINOR_VERSION

public static final int MINOR_VERSION
See Also:
Constant Field Values

INTERFACE_BUILTIN_METHODS

public static final int INTERFACE_BUILTIN_METHODS
The number of builtin methods that an interface has. Builtin methods are implicitly defined methods that are required for the inner workings of the IOR or to support the language bindings. The names of the builtins are numbers 0...INTERFACE_BUILTIN_METHODS-1 and are available from the method getBuiltinMethod.

See Also:
getBuiltinMethod(int, gov.llnl.babel.symbols.SymbolID), Constant Field Values

CLASS_BUILTIN_METHODS

public static final int CLASS_BUILTIN_METHODS
The number of builtin methods that a class has. Builtin methods are implicitly defined methods that are required for the inner workings of the IOR or to support the language bindings. The names of the builtins are numbers 0...CLASS_BUILTIN_METHODS-1 and are available from the method getBuiltinMethod.

See Also:
Constant Field Values

CAST

public static final int CAST
The index of the builtin method for casting.

See Also:
Constant Field Values

DELETE

public static final int DELETE
The index of the builtin method for deleting an object.

See Also:
Constant Field Values

CONSTRUCTOR

public static final int CONSTRUCTOR
The index of the builtin method for constructing a class.

See Also:
Constant Field Values

DESTRUCTOR

public static final int DESTRUCTOR
The index of the builtin method for destructing a class.

See Also:
Constant Field Values
Constructor Detail

IOR

public IOR()
Method Detail

getBuiltinMethod

public static Method getBuiltinMethod(int index,
                                      SymbolID id)
Return the method description of a particular builtin method. This will raise an ArrayIndexOutOfBoundsException if index is less than zero or greater than or equal to the number of builtin methods.

Parameters:
index - the index of the builtin method that is desired. Generally, one of CAST, DELETE, CONSTRUCTOR, or DESTRUCTOR.
id - the name of the symbol
Returns:
a description the method.
Throws:
java.lang.ArrayIndexOutOfBoundsException - this runtime exception is thrown if index is out of bounds.
See Also:
CAST, DELETE, CONSTRUCTOR, DESTRUCTOR

getBuiltinName

public static java.lang.String getBuiltinName(int index)
Return the name of a builtin method.

Parameters:
index - the index of the builtin method that is desired. Generally, one of CAST, DELETE, CONSTRUCTOR, or DESTRUCTOR.
Throws:
java.lang.ArrayIndexOutOfBoundsException - this runtime exception is thrown if index is out of bounds.
See Also:
CAST, DELETE, CONSTRUCTOR, DESTRUCTOR

getVectorEntry

public static java.lang.String getVectorEntry(java.lang.String methodName)
Generate the name of an entry in the entry point vector or the static entry point vector.

Parameters:
methodName - the name of the method that is an element in the entry point vector.

getHeaderFile

public static java.lang.String getHeaderFile(SymbolID id)
Generate the header filename associated with a symbol identifier. Replace the "." scope separators in the symbol by underscores and append the suffix "_IOR.h".


getSourceFile

public static java.lang.String getSourceFile(SymbolID id)
Generate the source filename associated with a symbol identifier. Replace the "." scope separators in the symbol by underscores and append the suffix "_IOR.c".


getSymbolName

public static java.lang.String getSymbolName(SymbolID id)
Convert a symbol name into an IOR identifier. This method replaces the "." scope separators in the symbol by underscores.


getEnumName

public static java.lang.String getEnumName(SymbolID id)
Convert a sidl enumerated type into its symbol name, which is "enum " followed by the symbol name followed by "__enum".


getExternalName

public static java.lang.String getExternalName(SymbolID id)
Get struct name for extern entry point structure.


getExternalFunc

public static java.lang.String getExternalFunc(SymbolID id)
Get the name of the function that returns the structure of external entry points.


getObjectName

public static java.lang.String getObjectName(SymbolID id)
Convert a sidl interface or class into its symbol name, which is "struct " followed by the symbol name followed by "__object".


getArrayName

public static java.lang.String getArrayName(SymbolID id)
Convert a sidl symbol into its array representation, which is "struct " followed by the symbol name followed by "__array".


getEPVName

public static java.lang.String getEPVName(SymbolID id)
Convert a sidl symbol into its method entry point vector (EPV) name, which is "struct " followed by the symbol name followed by "__epv".


getSEPVName

public static java.lang.String getSEPVName(SymbolID id)
Convert a sidl symbol into its static entry point vector (SEPV) name, which is "struct " followed by the symbol name followed by "__sepv".


getNewName

public static java.lang.String getNewName(SymbolID id)
Convert a sidl symbol into the name of its associated constructor, which is the symbol name appended with "__new".


getRemoteName

public static java.lang.String getRemoteName(SymbolID id)
Convert a sidl symbol into the name of its associated remote constructor, which is the symbol name appended with "__remote".


getSetEPVName

public static java.lang.String getSetEPVName(SymbolID id)
Convert a sidl symbol into the name of its associated set EPV method, which is the symbol name appended with "__set_epv".


getSetSEPVName

public static java.lang.String getSetSEPVName(SymbolID id)
Convert a sidl symbol into the name of its associated set static EPV method, which is the symbol name appended with "__set_sepv".


getStaticsName

public static java.lang.String getStaticsName(SymbolID id)
Convert a sidl symbol into the name of its associated statics method, which is the symbol name appended with "__statics".


getInitName

public static java.lang.String getInitName(SymbolID id)
Convert a sidl symbol into the name of its associated init method, which is the symbol name appended with "__init".


getFiniName

public static java.lang.String getFiniName(SymbolID id)
Convert a sidl symbol into the name of its associated fini method, which is the symbol name appended with "__fini".


getVersionName

public static java.lang.String getVersionName(SymbolID id)
Convert a sidl symbol into the name of its associated fini method, which is the symbol name appended with "__fini".


getExceptionFundamentalType

public static java.lang.String getExceptionFundamentalType()
Return the name of the type of the implicit exception argument; namely, sidl_BaseInterface_object. This is deemed necessary in order to minimize the impact on existing Impl codes due to the memory layout of the epv. That is, it is not necessary for the implementation writer to cast a newly created exception (to the base exception interface) IF the pointer is declared to be the start of the epv structure to begin with.


getClassType

public static java.lang.String getClassType()
Return the name of the type of the implicit base class type. The return value is of the form "struct X_Y_Z *" where X_Y_Z depends on the name of the base class and its mapping to a C struct name.


getInterfaceType

public static java.lang.String getInterfaceType()
Return the name of the type of the base interface type. The return value is of the form "struct X_Y_Z *" where X_Y_Z depends on the name of the base interface and its mapping to a C struct name.


getSymbolType

public static java.lang.String getSymbolType(Symbol sym)

getReturnString

public static java.lang.String getReturnString(Type type)
                                        throws CodeGenerationException
Generate an IOR return string for the specified sidl type. Most of the sidl return strings are listed in the static structures defined at the start of this class. Symbol types and array types require special processing.

Throws:
CodeGenerationException

getArgumentString

public static java.lang.String getArgumentString(Argument arg)
                                          throws CodeGenerationException
Generate an IOR argument string for the specified sidl argument. The formal argument name is not included.

Throws:
CodeGenerationException

getArgumentWithFormal

public static java.lang.String getArgumentWithFormal(Argument arg)
                                              throws CodeGenerationException
Generate an IOR argument string with the formal argument name.

Throws:
CodeGenerationException

getCast

public static java.lang.String getCast(Method method,
                                       java.lang.String self)
                                throws CodeGenerationException
Generate a cast string for the specified method. The string argument self represents the name of the object. A code generation exception is thrown if any of the required symbols do not exist in the symbol table.

Throws:
CodeGenerationException