gov.llnl.babel.backend

Interface CodeGenerator

All Superinterfaces:
ContextAware
Known Implementing Classes:
GenerateClient, GenerateClientC, GenerateClientJava, GenerateCxxClient, GenerateCxxServer, GenerateDoc, GenerateIORClient, GenerateIORServer, GenerateMatlabClient, GenerateRMIClient, GenerateServer, GenerateServerC, GenerateServerJava, GenerateSidl, GenerateXML, GenPythonClient, GenPythonServer

public interface CodeGenerator
extends ContextAware

Interface CodeGenerator is implemented by the backend code generators. It has several methods to identify what type of generator it is and what language it serves. The real work is done by the generateCode(Set) method that generates code for a set of Symbol objects.

Method Summary

void
generateCode(Set symbols)
Generate IOR code for each symbol identifier in the set argument.
Set
getLanguages()
Return the set of language names that this generator supports.
String
getName()
Return the canonical name of this generator.
String
getType()
Return the type of generator.
boolean
getUserSymbolsOnly()
Return true if and only if this code factory should only operate on symbols outside the sidl namespace (i.e., exclude symbols from the sidl runtime library).
void
setName(String name)
Set the name of the generator.

Methods inherited from interface gov.llnl.babel.backend.ContextAware

setContext

Method Details

generateCode

public void generateCode(Set symbols)
            throws CodeGenerationException
Generate IOR code for each symbol identifier in the set argument. These routines assume that all symbols necessary to generate code are available in the symbol table, which can be guaranteed by calling resolveAllReferences on the symbol table prior to invoking this routine.
Parameters:
symbols - a set of Symbol instances. The generator is expetected to write code for each symbol.
Throws:
CodeGenerationException - this indicates that something failed during the code generation. It could be anything from an I/O error to a illegal data type.

getLanguages

public Set getLanguages()
Return the set of language names that this generator supports. Normally, there is one one name per generator. However, the C++ generator can be referred to as cxx or c++, so it has two in its set. The names should be lower case. Some examples are "c", "ior", "c++", etc.
Returns:
a Set of strings. Each string is a language name that this generator supports.

getName

public String getName()
Returns:
the return value should always be a string in the set returned by getLanguages(). It may not be equal to the name given in setName(String).

getType

public String getType()
Return the type of generator. Currently, there are three types of generator "stub", "skel" and "ior". "xml" might be added someday.

getUserSymbolsOnly

public boolean getUserSymbolsOnly()
Return true if and only if this code factory should only operate on symbols outside the sidl namespace (i.e., exclude symbols from the sidl runtime library). This is typically true for C and Python where the stubs for the sidl runtime library are pregenerated. Generally, this should be true for anything other than a stub. Implementors do not need to worry about the special case of generating the sidl runtime library itself.

setName

public void setName(String name)
            throws CodeGenerationException
Set the name of the generator. This sets the name of the generator as it appeared on the command line. This method should be called at least once before getName() is called.
Parameters:
name - this should be the name that the end user designated for the generator.