public class Python
extends java.lang.Object
This class defines some of the fundamental mapping rules for translating a symbol in the sidl file into Python. These fundamental mapping rules are used repeatedly in the generation of client and server side bindings, so they are seperated into a class that can be shared by all Python code generators.
Some of the particular features include:
Constructor and Description |
---|
Python()
Build a Python support object.
|
Modifier and Type | Method and Description |
---|---|
static Method |
connectRemoteMethod(Extendable ext,
Context context) |
static LanguageWriterForC |
createCHeader(Symbol symbol,
java.lang.String modifier,
java.lang.String description,
Context context) |
static LanguageWriterForC |
createLaunch(Symbol symbol,
java.lang.String description,
Context context)
Generate an IO stream to receive the C skeleton file for the Python
implementations.
|
static LanguageWriterForPython |
createPyWriter(Symbol symbol,
java.lang.String file,
java.lang.String description,
Context context)
Create a Python
LanguageWriterForPython with a banner
comment a documentation string in the FileManager group
PYTHON. |
static Method |
createRemoteMethod(Extendable ext,
Context context) |
static LanguageWriterForC |
createSkel(Symbol symbol,
java.lang.String description,
Context context)
Generate an IO stream to receive the C skeleton file for the Python
implementations.
|
static LanguageWriterForC |
createStub(Symbol symbol,
java.lang.String description,
Context context)
Generate an IO stream to receive the C stub file for the Python clients.
|
static void |
generateRMIExternStruct(Class cls,
LanguageWriterForC lw,
Context context)
This method generates the rmi struct that allows connect and rmicast
to be called through the pSkel.
|
static java.lang.String |
getAPIVarName(Symbol symbol) |
static java.lang.String |
getBorrowArrayFromPython(Type arrayType) |
static java.lang.String |
getBorrowArrayFromSIDL(Type arrayType) |
static java.lang.String |
getCHeaderPath(Symbol symbol,
java.lang.String modifier) |
static java.lang.String |
getCopyArrayFromPython(Type arrayType) |
static java.lang.String |
getCopyArrayFromSIDL(Type arrayType) |
static java.lang.String |
getDestroyArray(Type arrayType) |
static java.lang.String |
getExceptionType(Symbol symbol) |
static java.lang.String |
getExtendableAddRef(Symbol symbol) |
static java.lang.String |
getExtendableBorrow(Symbol symbol) |
static java.lang.String |
getExtendableConnect(Symbol symbol) |
static java.lang.String |
getExtendableConverter(Symbol symbol) |
static java.lang.String |
getExtendableDeref(Symbol symbol) |
static java.lang.String |
getExtendableImport(Symbol symbol) |
static java.lang.String |
getExtendableNewRef(Symbol symbol) |
static java.lang.String |
getExtendableType(Symbol symbol) |
static java.lang.String |
getExtendableWrapper(Symbol symbol) |
static java.lang.String |
getImport(java.lang.String className) |
static java.lang.String |
getIncludeGuard(Symbol symbol,
java.lang.String modifier)
Generate an include file for a symbol.
|
static java.lang.String |
getInternalGuard(Symbol symbol) |
static java.lang.String |
getPSkelFCastName(SymbolID sourceid,
SymbolID targetid)
Convert a SIDL symbol into the name of its associated remote
connector.
|
static java.lang.String |
getPSkelFConnectName(SymbolID sourceid,
SymbolID targetid)
Convert a SIDL symbol into the name of its associated remote
connector.
|
static java.lang.String |
getPSkelSerializeName(SymbolID sourceid,
SymbolID targetid,
boolean serialize,
boolean inLaunch)
Convert a SIDL symbol into the name of its associated remote
(de)serialize method.
|
static CodeSplicer |
getPySplicer(Symbol symbol,
java.lang.String filename,
Context context)
If
filename already exists, extract the code splicer
blocks from it and store the contents in the returned code splicer;
otherwise, return an empty code splicer. |
static java.lang.String |
getPyStructType(Symbol symbol) |
static java.lang.String |
getRMIExternName(SymbolID id)
Convert a sidl symbol into the name of its associated get RMI
Externals method, which is the symbol name appended with
"__impl_rmi_externals".
|
static java.lang.String |
getSetEPVName(SymbolID id)
Convert a sidl symbol into the name of its associated set EPV
method, which is the symbol name appended with "__set_epv".
|
static java.lang.String |
getSetSEPVName(SymbolID id)
Convert a sidl symbol into the name of its associated set static
EPV method, which is the symbol name appended with "__set_sepv".
|
static java.lang.String |
getSkelMethod(SymbolID id,
Method m)
Return the name of the function that should be used for the
skeleton.
|
static java.lang.String |
getStructBorrow(Symbol symbol) |
static java.lang.String |
getStructCopy(Symbol symbol) |
static java.lang.String |
getStructDeserialize(Symbol symbol) |
static java.lang.String |
getStructDestroy(Symbol symbol) |
static java.lang.String |
getStructInit(Symbol symbol) |
static java.lang.String |
getStructSerialize(Symbol symbol) |
static java.lang.String |
getStubMethod(SymbolID id,
Method m)
Return the name of the function that should be used for the
Python stub code.
|
static java.lang.String |
headerFilename(Symbol symbol,
java.lang.String modifier) |
static java.lang.String |
implFilename(Symbol symbol) |
static void |
leavePython(LanguageWriter lw) |
static int |
maxNameLength(java.util.Collection items) |
static void |
resumePython(LanguageWriter lw) |
static java.lang.String |
skelFilename(Symbol symbol,
java.lang.String modifier) |
static java.lang.String |
sourceFilename(Symbol symbol,
java.lang.String modifier) |
public static java.lang.String getIncludeGuard(Symbol symbol, java.lang.String modifier)
public static java.lang.String headerFilename(Symbol symbol, java.lang.String modifier)
public static java.lang.String sourceFilename(Symbol symbol, java.lang.String modifier)
public static java.lang.String skelFilename(Symbol symbol, java.lang.String modifier)
public static java.lang.String implFilename(Symbol symbol)
public static java.lang.String getAPIVarName(Symbol symbol)
public static java.lang.String getInternalGuard(Symbol symbol)
public static java.lang.String getCHeaderPath(Symbol symbol, java.lang.String modifier)
public static LanguageWriterForC createCHeader(Symbol symbol, java.lang.String modifier, java.lang.String description, Context context) throws CodeGenerationException
CodeGenerationException
public static LanguageWriterForC createStub(Symbol symbol, java.lang.String description, Context context) throws CodeGenerationException
CodeGenerationException
- this is a catch all exception for problems during the code
generation phase.public static LanguageWriterForC createSkel(Symbol symbol, java.lang.String description, Context context) throws CodeGenerationException
CodeGenerationException
- this is a catch all exception for problems during the code
generation phase.public static LanguageWriterForC createLaunch(Symbol symbol, java.lang.String description, Context context) throws CodeGenerationException
CodeGenerationException
- this is a catch all exception for problems during the code
generation phase.public static java.lang.String getSkelMethod(SymbolID id, Method m)
id
- the symbol who owns the method.m
- the methodpublic static java.lang.String getStubMethod(SymbolID id, Method m)
id
- the symbol who owns the method.m
- the methodpublic static CodeSplicer getPySplicer(Symbol symbol, java.lang.String filename, Context context) throws java.io.IOException
filename
already exists, extract the code splicer
blocks from it and store the contents in the returned code splicer;
otherwise, return an empty code splicer.symbol
- the symbol whose splicer is to be returned.filename
- the name of the fileCodeSplicer
java.io.IOException
- where there is IO, there is the possibility for an
IOException
.public static LanguageWriterForPython createPyWriter(Symbol symbol, java.lang.String file, java.lang.String description, Context context) throws CodeGenerationException
LanguageWriterForPython
with a banner
comment a documentation string in the FileManager
group
PYTHON.symbol
- the symbol for which the
LanguageWriter
is being created.file
- the name of the file to be created. This contains
no directory references.description
- a brief statement of the purpose of the file.
This string should have no newlines.gov.llnl.backend.CodeGenerationException
- something went wrong while trying to create the file.CodeGenerationException
public static java.lang.String getSetEPVName(SymbolID id)
public static java.lang.String getRMIExternName(SymbolID id)
public static java.lang.String getSetSEPVName(SymbolID id)
public static java.lang.String getImport(java.lang.String className)
public static java.lang.String getExtendableImport(Symbol symbol)
public static java.lang.String getExtendableWrapper(Symbol symbol)
public static java.lang.String getExtendableBorrow(Symbol symbol)
public static java.lang.String getExceptionType(Symbol symbol)
public static int maxNameLength(java.util.Collection items)
public static java.lang.String getExtendableConverter(Symbol symbol)
public static java.lang.String getExtendableNewRef(Symbol symbol)
public static java.lang.String getExtendableType(Symbol symbol)
public static java.lang.String getPyStructType(Symbol symbol)
public static java.lang.String getStructInit(Symbol symbol)
public static java.lang.String getStructCopy(Symbol symbol)
public static java.lang.String getStructBorrow(Symbol symbol)
public static java.lang.String getStructDestroy(Symbol symbol)
public static java.lang.String getStructSerialize(Symbol symbol)
public static java.lang.String getStructDeserialize(Symbol symbol)
public static java.lang.String getExtendableAddRef(Symbol symbol)
public static java.lang.String getExtendableConnect(Symbol symbol)
public static java.lang.String getExtendableDeref(Symbol symbol)
public static java.lang.String getBorrowArrayFromPython(Type arrayType)
public static java.lang.String getBorrowArrayFromSIDL(Type arrayType)
public static java.lang.String getCopyArrayFromPython(Type arrayType)
public static java.lang.String getCopyArrayFromSIDL(Type arrayType)
public static void leavePython(LanguageWriter lw)
public static void resumePython(LanguageWriter lw)
public static java.lang.String getDestroyArray(Type arrayType)
public static java.lang.String getPSkelFConnectName(SymbolID sourceid, SymbolID targetid)
public static java.lang.String getPSkelSerializeName(SymbolID sourceid, SymbolID targetid, boolean serialize, boolean inLaunch)
public static java.lang.String getPSkelFCastName(SymbolID sourceid, SymbolID targetid)
public static Method createRemoteMethod(Extendable ext, Context context)
public static Method connectRemoteMethod(Extendable ext, Context context)
public static void generateRMIExternStruct(Class cls, LanguageWriterForC lw, Context context) throws CodeGenerationException
CodeGenerationException