gov.llnl.babel.backend
Class CodeGenerationFactory

java.lang.Object
  |
  +--gov.llnl.babel.backend.CodeGenerationFactory

public class CodeGenerationFactory
extends java.lang.Object

This class stores and serves up instances CodeGenerator based on the string name of the code that the user wishes to generate. Classes derived from CodeGenerator will register themselves with this class (usually as part of a static initialization block). If a match based on the string name is not available, this class will try to dynamically load an instance based on some simple naming rules.

See Also:
CodeGenerator

Method Summary
 BuildGenerator getBuildGenerator(java.lang.String language)
          Get the build generator appropriate for this language.
 CodeGenerator getCodeGenerator(java.lang.String language, java.lang.String mode)
          Get a registered codeGenerator from the factory.
static CodeGenerationFactory getInstance()
          Return the singleton instance of the class.
 void printRegisteredGenerators(java.io.PrintStream out)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getInstance

public static CodeGenerationFactory getInstance()
Return the singleton instance of the class. If the CodeGenerationFactory has not yet been created, then it will be created by this call.


getBuildGenerator

public BuildGenerator getBuildGenerator(java.lang.String language)
Get the build generator appropriate for this language.


getCodeGenerator

public CodeGenerator getCodeGenerator(java.lang.String language,
                                      java.lang.String mode)
Get a registered codeGenerator from the factory.

Parameters:
language - String name of the language
mode - Usually one of "stub", "skel", "ior", or "text"
Returns:
Live CodeGenerator or null if no match found.

printRegisteredGenerators

public void printRegisteredGenerators(java.io.PrintStream out)