gov.llnl.babel.backend.sidl

Class SidlSource


public class SidlSource
extends java.lang.Object

This class provides the ability to write SIDL source file for a SIDL class/interface.

Constructor Summary

SidlSource(LanguageWriterForSidl writer, Context context)
Generate an instance to write the SIDL file.

Method Summary

void
generateCode(Class cls)
Generate the SIDL for the class.
void
generateCode(Enumeration enm)
Generate the SIDL for the enumeration.
void
generateCode(Interface iface)
Generate the SIDL for the interface.
void
generateCode(Package pkg)
Generate the SIDL for a package.
void
generateCode(Struct st)
Generate the SIDL for a struct.
static void
generateCode(Symbol sym, LanguageWriterForSidl writer, Context context)
Generate the SIDL file only for a package.
static boolean
isBaseClassName(String name)
Return indication of whether or not the symbol name is the same as the base class.
static boolean
isBaseInterfaceName(String name)
/** Return indication of whether or not the symbol name is the same as the base interface.
void
printAssertion(LanguageWriter lw, Assertion as)
Print the assertion.
void
printMethods(Extendable ext)
Print the methods associated with the extendable (i.e., class or interface).
void
printParentInterfaces(Extendable ext)
Print the parent interfaces for the extendable (i.e., class or interface).
void
printRequires(Package pkg)
Prints the requires statements based on symbols associated with the specified package.
void
printSignaturePlus(LanguageWriter lw, Extendable ext, Method meth, String parent_pkg)
Print the signature of the method, optionally including the definition modifier, and any associated pre- and post-conditions to the specified LanguageWriter.

Constructor Details

SidlSource

public SidlSource(LanguageWriterForSidl writer,
                  Context context)
Generate an instance to write the SIDL file.
Parameters:
writer - the output device to which the SIDL should be written.

Method Details

generateCode

public void generateCode(Class cls)
            throws CodeGenerationException
Generate the SIDL for the class.
Parameters:
cls - the SIDL class to be written.
Throws:
CodeGenerationException - a catch all exception to indicate problems in the code generation phase.

generateCode

public void generateCode(Enumeration enm)
            throws CodeGenerationException
Generate the SIDL for the enumeration.
Parameters:
enm - the SIDL enumeration to be written.
Throws:
CodeGenerationException - a catch all exception to indicate problems in the code generation phase.

generateCode

public void generateCode(Interface iface)
            throws CodeGenerationException
Generate the SIDL for the interface.
Parameters:
iface - the SIDL interface to be written.
Throws:
CodeGenerationException - a catch all exception to indicate problems in the code generation phase.

generateCode

public void generateCode(Package pkg)
            throws CodeGenerationException
Generate the SIDL for a package.
Parameters:
pkg - the SIDL package whose file is to be written.
Throws:
CodeGenerationException - a catch all exception to indicate problems in the code generation phase.

generateCode

public void generateCode(Struct st)
Generate the SIDL for a struct.
Parameters:

generateCode

public static void generateCode(Symbol sym,
                                LanguageWriterForSidl writer,
                                Context context)
            throws CodeGenerationException
Generate the SIDL file only for a package.
Throws:
CodeGenerationException - a catch all exception to indicate problems in the code generation phase.

isBaseClassName

public static boolean isBaseClassName(String name)
Return indication of whether or not the symbol name is the same as the base class.
Parameters:
name - the symbol name being checked
Returns:
true if the name equals the base class name; else, false

isBaseInterfaceName

public static boolean isBaseInterfaceName(String name)
/** Return indication of whether or not the symbol name is the same as the base interface.
Parameters:
name - the symbol name being checked
Returns:
true if the name equals the base interface name; else, false

printAssertion

public void printAssertion(LanguageWriter lw,
                           Assertion as)
Print the assertion.
Parameters:
lw - the language writer to which the signature is printed

printMethods

public void printMethods(Extendable ext)
            throws CodeGenerationException
Print the methods associated with the extendable (i.e., class or interface). Indentation is handled accordingly.
Parameters:
ext - the SIDL extendable whose methods are to be written
Throws:
CodeGenerationException - a catch all exception to indicate problems in the code generation phase.

printParentInterfaces

public void printParentInterfaces(Extendable ext)
            throws CodeGenerationException
Print the parent interfaces for the extendable (i.e., class or interface). Indentation is handled accordingly.
Parameters:
ext - the SIDL extendable whose parent interfaces are to be written
Throws:
CodeGenerationException - a catch all exception to indicate problems in the code generation phase.

printRequires

public void printRequires(Package pkg)
Prints the requires statements based on symbols associated with the specified package.
Parameters:
pkg - the package whose imports/requires list is being output

printSignaturePlus

public void printSignaturePlus(LanguageWriter lw,
                               Extendable ext,
                               Method meth,
                               String parent_pkg)
Print the signature of the method, optionally including the definition modifier, and any associated pre- and post-conditions to the specified LanguageWriter. Also, optionally abbreviate the type if in specified package.
Parameters:
lw - the language writer to which the signature is printed
ext - The Extendable this method is being generated for
meth - the method whose signature is being printed
parent_pkg - the string containing the parent package. When not null, it is used to strip the package from the return string if it is in the specified package.