gov.llnl.babel.backend.c
public class ImplSource extends java.lang.Object
Class ImplSource
generates a C implementation source 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.
The implementation source contains definitions of the non-abstract
methods. Unlike most files generated by babel
, this file
is intended to be edited by the developer. The developer needs to insert
the implementation of the class in this file or insert calls to something
that implements the class.
The code splicer is used to maintain code the developer has written when overwriting an implementation source file. The splicer stores code fragments from the previous file that can be insert into the new file.
Constructor and Description |
---|
ImplSource(LanguageWriterForC writer,
CodeSplicer splicer,
Context context)
Create a
ImplSource object that will write symbol
information to the provided output language writer stream. |
Modifier and Type | Method and Description |
---|---|
void |
generateCode(Class cls)
Write C implementation source 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
source information into the provided language writer output stream.
|
public ImplSource(LanguageWriterForC writer, CodeSplicer splicer, Context context)
ImplSource
object that will write symbol
information to the provided output language writer stream. The
code splicer object may be used to save state between the old
source file and the new source file. If the code splicer object
is null, then no state is transferred to the new source file.writer
- the output writer for the new implementation source
file. This writer will not be closed by this method.splicer
- If not null
, this splicer contains
code fragments from a implementation source file
that is being overwritten. The new implementation
will try to incorporate those fragments into the
new file.public static void generateCode(Class cls, LanguageWriterForC writer, CodeSplicer splicer, Context context) throws CodeGenerationException
cls
- the class whose implementation source is to be created.writer
- the output writer with which the new file is created.splicer
- If not null
, the splicer contains
code fragments from a previous implementation source
file that is being overwritten. The new implementation
will incorporate those fragments into the new file.CodeGenerationException
- this is a catch all exception. It can be caused by I/O trouble or
violations of the data type invariants.public void generateCode(Class cls) throws CodeGenerationException
cls
- the class whose implementation source is to be created.CodeGenerationException
- this is a catch all exception. It can be caused by I/O trouble or
violations of the data type invariants.