public interface CodeGenerator extends ContextAware
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(java.util.Set)
method that generates code for a set of
Symbol
objects.Modifier and Type | Method and Description |
---|---|
void |
generateCode(java.util.Set symbols)
Generate IOR code for each symbol identifier in the set argument.
|
java.util.Set |
getLanguages()
Return the set of language names that this generator supports.
|
java.lang.String |
getName()
Return the canonical name of this generator.
|
java.lang.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(java.lang.String name)
Set the name of the generator.
|
setContext
void generateCode(java.util.Set symbols) throws CodeGenerationException
resolveAllReferences
on the symbol table prior to invoking
this routine.symbols
- a set of Symbol
instances. The generator is expetected to write code for each symbol.CodeGenerationException
- this indicates that something failed during the code generation.
It could be anything from an I/O error to a illegal data type.boolean getUserSymbolsOnly()
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.java.util.Set getLanguages()
java.lang.String getType()
void setName(java.lang.String name) throws CodeGenerationException
getName()
is called.name
- this should be the name that the end user designated for
the generator.An
- exception is thrown if the name doesn't match one of the
allowable names in getLanguages()
.CodeGenerationException
java.lang.String getName()
setName(String)
should be called at least once before this method is called.getLanguages()
. It may not be equal to the name given in
setName(String)
.