gov.llnl.babel.backend.c
Class ImplHeader

java.lang.Object
  extended by gov.llnl.babel.backend.c.ImplHeader

public class ImplHeader
extends java.lang.Object

Class ImplHeader generates a C implementation header to a language writer output stream. The constructor takes a language writer stream and method generateCode generates the implementation header file for the specified symbol to the output stream. The language writer stream is not closed by this object.


Constructor Summary
ImplHeader(LanguageWriterForC writer, CodeSplicer splicer, Context context)
          Create a ImplHeader object that will write symbol information to the provided output language writer stream.
 
Method Summary
 void generateCode(Class cls)
          Write C implementation header information for the provided class to the language writer output stream provided in the constructor.
static void generateCode(Class cls, LanguageWriterForC writer, CodeSplicer splicer, Context context)
          This is a convenience utility function that writes the symbol header information into the provided language writer output stream.
 java.util.Collection getLocalReferences(Extendable ext)
           
static void writeBuiltinDecls(LanguageWriterForC lw, Class cls, Context context)
          Write external declarations for the Class constructor and destructor.
static void writeMethodDecls(LanguageWriterForC lw, Class cls, boolean isStatic, Context context)
          Write external declarations for all non-abstract methods in the class.
static void writeMethodSignature(LanguageWriterForC lw, Method meth, java.lang.String self, boolean addExtern, boolean isIfc, boolean addType, SymbolID id, Context context)
          Write the method signature with arguments indented one level.
static void writeRMIAccessDecls(LanguageWriterForC lw, Class cls, boolean isStatic)
          Write external declarations for the RMI fconnects methods in the class.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ImplHeader

public ImplHeader(LanguageWriterForC writer,
                  CodeSplicer splicer,
                  Context context)
Create a ImplHeader object that will write symbol information to the provided output language writer stream. Assumption: This code is completed generated so no code splicer capabilities are needed.

Parameters:
writer - the output writer for the new implementation header file. This writer will not be closed by this method.
Method Detail

generateCode

public static void generateCode(Class cls,
                                LanguageWriterForC writer,
                                CodeSplicer splicer,
                                Context context)
                         throws CodeGenerationException
This is a convenience utility function that writes the symbol header information into the provided language writer output stream. The output stream is not closed on exit.

Parameters:
cls - the Class whose implementation header file is to be created.
writer - the output writer with which the new header file is created.
Throws:
CodeGenerationException - this is a catch all exception. It can be caused by I/O trouble or violations of the data type invariants.

writeMethodSignature

public static void writeMethodSignature(LanguageWriterForC lw,
                                        Method meth,
                                        java.lang.String self,
                                        boolean addExtern,
                                        boolean isIfc,
                                        boolean addType,
                                        SymbolID id,
                                        Context context)
                                 throws CodeGenerationException
Write the method signature with arguments indented one level. The caller is expected to decrease the indentation one level after terminating the signature with either a simple println() or a println(";") as needed.

Parameters:
lw - the target language writer
meth - the method
self - the self variable, if appropriate
addExtern - TRUE if the signature is to include the "extern" modifier (as in the header file case).
isIfc - TRUE if the method belongs to an interface
id - the name of the symbol owning the method
Throws:
CodeGenerationException - this is a catch all exception. It can be caused by I/O trouble or violations of the data type invariants.

writeMethodDecls

public static void writeMethodDecls(LanguageWriterForC lw,
                                    Class cls,
                                    boolean isStatic,
                                    Context context)
                             throws CodeGenerationException
Write external declarations for all non-abstract methods in the class.

Parameters:
lw - the language writer to write to.
cls - the Class whose header will be written.
isStatic - true means write only static methods; false means write only non-static methods.
Throws:
CodeGenerationException - this is a catch all exception. It can be caused by I/O trouble or violations of the data type invariants.

writeRMIAccessDecls

public static void writeRMIAccessDecls(LanguageWriterForC lw,
                                       Class cls,
                                       boolean isStatic)
                                throws CodeGenerationException
Write external declarations for the RMI fconnects methods in the class.

Parameters:
lw - the language writer to write to.
cls - the Class whose header will be written.
isStatic - true means write only static methods; false means write only non-static methods.
Throws:
CodeGenerationException - this is a catch all exception. It can be caused by I/O trouble or violations of the data type invariants.

writeBuiltinDecls

public static void writeBuiltinDecls(LanguageWriterForC lw,
                                     Class cls,
                                     Context context)
                              throws CodeGenerationException
Write external declarations for the Class constructor and destructor.

Parameters:
lw - the language writer to write to.
cls - the Class whose header will be written.
Throws:
CodeGenerationException - this is a catch all exception. It can be caused by I/O trouble or violations of the data type invariants.

getLocalReferences

public java.util.Collection getLocalReferences(Extendable ext)
                                        throws CodeGenerationException
Throws:
CodeGenerationException

generateCode

public void generateCode(Class cls)
                  throws CodeGenerationException
Write C implementation header information for the provided class to the language writer output stream provided in the constructor. This method does not close the writer output stream.

Parameters:
cls - the Class whose header will be written.
Throws:
CodeGenerationException - this is a catch all exception. It can be caused by I/O trouble or violations of the data type invariants.