|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--gov.llnl.babel.backend.cxx.Cxx
Class Cxx
contains common C++ language binding routines
shared by the C++ backend code generators. This class simply collects
many common C+ binding routines into one place.
Field Summary | |
static int |
FILE_ROLE_IMPL
|
static int |
FILE_ROLE_MAX
|
static int |
FILE_ROLE_MIN
|
static int |
FILE_ROLE_NONE
|
static int |
FILE_ROLE_SKEL
|
static int |
FILE_ROLE_STUB
|
static java.lang.String[] |
FILE_ROLE_SUFFIX
|
static int |
FILE_TYPE_C_HEADER
|
static int |
FILE_TYPE_C_SOURCE
|
static int |
FILE_TYPE_CXX_HEADER
|
static int |
FILE_TYPE_CXX_SOURCE
|
static java.lang.String[] |
FILE_TYPE_EXTENSION
|
static int |
FILE_TYPE_MAX
|
static int |
FILE_TYPE_MIN
|
static int |
FILE_TYPE_NONE
|
Constructor Summary | |
Cxx()
|
Method Summary | |
static java.lang.String |
argModeToString(Argument arg)
convert an argument to the mode string |
static void |
beginExternCRegion(LanguageWriterForCxx writer)
begin a region of method calls with C linkage |
static java.lang.String |
constCast(java.lang.String newtype,
java.lang.String arg)
generate a constCast |
static LanguageWriterForCxx |
createHeader(Symbol symbol,
int role,
java.lang.String filegroup)
Create an empty header file and return the language writer to create subsequent content. |
static LanguageWriterForCxx |
createSource(Symbol symbol,
int role,
java.lang.String filegroup)
Create an empty source file and return the language writer to create subsequent content. |
static void |
endExternCRegion(LanguageWriterForCxx writer)
end region of method calls with C linkage |
static void |
generateArgumentList(LanguageWriterForCxx writer,
Method method)
|
static java.util.Set |
generateDependencyIncludes(LanguageWriterForCxx writer,
Extendable ext,
boolean removeSelf)
Generates include directives for all the extendables that this extendable inherits from. |
static java.lang.String |
generateFilename(java.lang.String symbolName,
int role,
int ftype)
Generate the filename associated with a symbol identifier. |
static java.lang.String |
generateFilename(SymbolID id,
int role,
int ftype)
Generate the filename associated with a symbol identifier. |
static void |
generateMethodSignature(LanguageWriterForCxx writer,
Method method,
java.lang.String altcomment,
int role)
|
static java.lang.String |
generateRoleDescription(SymbolID id,
int role)
Generate the role description associated with the symbol identifier and the specified role of the file. |
static void |
generateThrowsList(LanguageWriterForCxx writer,
Method method,
boolean canThrowNullIORException)
|
static java.lang.String |
getArgumentString(Argument arg)
Generate a C++ argument string for the specified SIDL argument. |
static java.lang.String |
getCxxString(Type type)
Convert the type to a Cxx representation in string form |
static java.lang.String |
getEnumName(SymbolID id)
Convert a SIDL enumerated type into its symbol name, which is just the colon separated symbol name |
static java.lang.String |
getFileExtension(int ftype)
Returns the appropriate file extension String based on
the file type, prepended with the period (e.g., ".hh"). |
static java.lang.String |
getFileSuffix(int role)
Returns the appropriate String suffix associated with
the specified role. |
static java.lang.String |
getMethodImplName(SymbolID id,
java.lang.String methodName)
Generate the impl method's name. |
static java.lang.String |
getMethodSkelName(SymbolID id,
java.lang.String methodName)
Generate the skel method's name. |
static java.lang.String |
getMethodStubName(SymbolID id,
java.lang.String methodName)
Generate the stub method's name. |
static java.lang.String |
getObjectName(SymbolID id)
Convert a SIDL symbol name into its object name -- for the purposes of this package that means convert it into its typedef object name. |
static java.lang.String |
getReturnString(Type type)
Generate a Cxx return string for the specified SIDL type. |
static java.lang.String |
getSymbolName(SymbolID id)
|
static java.lang.String |
getSymbolName(SymbolID id,
java.lang.String postfix)
Convert a symbol name into its C++ identifier. |
static java.lang.String |
getSymbolNameWithoutLeadingColons(SymbolID id,
java.lang.String postfix)
|
static void |
nestPackagesInNamespaces(LanguageWriterForCxx writer,
Symbol symbol)
Generate a the namespaces in which the C++ class is nested. |
static java.lang.String |
reinterpretCast(java.lang.String newtype,
java.lang.String arg)
generate a reinterpretCast |
static void |
unnestPackagesInNamespaces(LanguageWriterForCxx writer,
Symbol symbol)
Close the namespaces in which the C++ class is nested. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
public static final int FILE_ROLE_MIN
public static final int FILE_ROLE_MAX
public static final int FILE_ROLE_NONE
public static final int FILE_ROLE_IMPL
public static final int FILE_ROLE_SKEL
public static final int FILE_ROLE_STUB
public static final java.lang.String[] FILE_ROLE_SUFFIX
public static final int FILE_TYPE_MIN
public static final int FILE_TYPE_MAX
public static final int FILE_TYPE_NONE
public static final int FILE_TYPE_CXX_HEADER
public static final int FILE_TYPE_CXX_SOURCE
public static final int FILE_TYPE_C_HEADER
public static final int FILE_TYPE_C_SOURCE
public static final java.lang.String[] FILE_TYPE_EXTENSION
Constructor Detail |
public Cxx()
Method Detail |
public static java.lang.String getFileSuffix(int role)
String
suffix associated with
the specified role.
role
- the int
associated with the role of the
file to differentiate skeletons, stubs, impls, etc.public static java.lang.String getFileExtension(int ftype)
String
based on
the file type, prepended with the period (e.g., ".hh").
ftype
- the int
associated with the type of the
file to differentiate between header and sourcepublic static java.lang.String generateFilename(SymbolID id, int role, int ftype)
id
- the SymbolID
of the Symbol
role
- the int
associated with the role of the
file to differentiate skeletons, stubs, impls, etc.ftype
- the int
associated with the type of the
file to differentiate between header and sourcepublic static java.lang.String generateFilename(java.lang.String symbolName, int role, int ftype)
symbolName
- the stringified name of the Symbol
role
- the int
associated with the role of the
file to differentiate skeletons, stubs, impls, etc.ftype
- the int
associated with the type of the
file to differentiate between header and sourcepublic static java.lang.String generateRoleDescription(SymbolID id, int role)
id
- the SymbolID
of the Symbol
role
- the int
associated with the role of the
file to differentiate skeletons, stubs, impls, etc.public static LanguageWriterForCxx createHeader(Symbol symbol, int role, java.lang.String filegroup) throws CodeGenerationException
role
- the int
identifying the role of the
file to differentiate skeletons, stubs, impls, etc.filegroup
- a String
to associate the file with
for possible makefile generation
CodeGenerationException
public static LanguageWriterForCxx createSource(Symbol symbol, int role, java.lang.String filegroup) throws CodeGenerationException
role
- the int
identifying the role of the
file to differentiate skeletons, stubs, impls, etc.filegroup
- a String
to associate the file with
for possible makefile generation
CodeGenerationException
public static void nestPackagesInNamespaces(LanguageWriterForCxx writer, Symbol symbol)
writer
- the language writer for C++symbol
- the symbol begin written to this file, containing
the heirarchy of packages to which it belongs.unnestPackagesInNamespaces(gov.llnl.babel.backend.writers.LanguageWriterForCxx, gov.llnl.babel.symbols.Symbol)
public static void unnestPackagesInNamespaces(LanguageWriterForCxx writer, Symbol symbol)
writer
- the language writer for C++symbol
- the symbol begin written to this file, containing
the heirarchy of packages to which it belongs.nestPackagesInNamespaces(gov.llnl.babel.backend.writers.LanguageWriterForCxx, gov.llnl.babel.symbols.Symbol)
public static void beginExternCRegion(LanguageWriterForCxx writer)
writer
- languageWriter for the filepublic static void endExternCRegion(LanguageWriterForCxx writer)
writer
- languageWriter for the filepublic static java.lang.String getSymbolName(SymbolID id, java.lang.String postfix)
id
- the SymbolID
of the Symbol
.
& @param postfix an optional postfix for the class itselfpublic static java.lang.String getSymbolName(SymbolID id)
public static java.lang.String getSymbolNameWithoutLeadingColons(SymbolID id, java.lang.String postfix)
getSymbolName(gov.llnl.babel.symbols.SymbolID, java.lang.String)
public static java.lang.String getEnumName(SymbolID id)
id
- the SymbolID
of the Symbol
.public static java.lang.String getObjectName(SymbolID id)
id
- the SymbolID
of the Symbol
.public static java.lang.String argModeToString(Argument arg)
arg
-
public static java.lang.String reinterpretCast(java.lang.String newtype, java.lang.String arg)
newtype
- the new type to cast toarg
- the variable to cast
public static java.lang.String constCast(java.lang.String newtype, java.lang.String arg)
newtype
- the new type to cast toarg
- the variable to cast
public static java.lang.String getCxxString(Type type) throws CodeGenerationException
CodeGenerationException
public static java.lang.String getReturnString(Type type) throws CodeGenerationException
type
- the Type
whose return string is being built.
CodeGenerationException
public static java.lang.String getArgumentString(Argument arg) throws CodeGenerationException
CodeGenerationException
public static java.lang.String getMethodImplName(SymbolID id, java.lang.String methodName)
id
- the SymbolID
of the Symbol
associated with the method.public static java.lang.String getMethodSkelName(SymbolID id, java.lang.String methodName)
id
- the SymbolID
of the Symbol
associated with the method.public static java.lang.String getMethodStubName(SymbolID id, java.lang.String methodName)
id
- the SymbolID
of the Symbol
associated with the method.public static java.util.Set generateDependencyIncludes(LanguageWriterForCxx writer, Extendable ext, boolean removeSelf) throws CodeGenerationException
writer
- Language writer for C++ext
- Extendible (Class or Interface) to generate dependenciesremoveSelf
- True if called from a Stub generator since this
would cause an inclusion loop in Stub.h
False if called from an impl generator since
the impl may need to know about the stub.
CodeGenerationException
public static void generateMethodSignature(LanguageWriterForCxx writer, Method method, java.lang.String altcomment, int role) throws CodeGenerationException
CodeGenerationException
public static void generateArgumentList(LanguageWriterForCxx writer, Method method) throws CodeGenerationException
CodeGenerationException
public static void generateThrowsList(LanguageWriterForCxx writer, Method method, boolean canThrowNullIORException)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |