org.biomage.tools.generate_cpp
Class CreateCPPFile

java.lang.Object
  extended by org.biomage.tools.generate_cpp.CreateCPPFile

public class CreateCPPFile
extends java.lang.Object


Nested Class Summary
 class CreateCPPFile.AssignmentWriter
          Description: Writes the Assignment operator to the CPP file.
 class CreateCPPFile.ClassDeclWriter
          Description: Writes the class declaration out to the file.
 class CreateCPPFile.ConstructorBodyWriter
          Description: Writes the copy constructor body needed into the CPP file.
 class CreateCPPFile.ConstructorWriter
          Description: Writes the copy constructor header needed into the CPP file.
 class CreateCPPFile.DataMemberWriter
          Description: Writes out the data members of the Class in the Header File.
 class CreateCPPFile.EquivalenceWriter
          Description: Writes the =='s operator to the CPP file.
 class CreateCPPFile.GetAndSetWriter
          Description: Writes the attribute set and get methods to the C++ header file.
 class CreateCPPFile.ImportWriter
          Description: Writes the correct includes needed in the header files.
 class CreateCPPFile.IncludeWriter
          Description: Writes the includes that we need into the CPP file.
 class CreateCPPFile.RemoveFromWriter
          Description: Writes the RemoveFrom function to the CPP file.
 class CreateCPPFile.specificWriter
          Description: An abstract class used to in conjuction with the LoopNames function that reads through all the attributes and assocations.
 class CreateCPPFile.TemplateWriter
          Description: Writes the correct template needed in the header files.
 
Field Summary
protected static java.lang.String bodyIndent
           
protected static java.lang.String NEWLINE
          Description: The environment specific new line.
protected static java.lang.String oneIndent
          Description: Size of indentation.
 
Constructor Summary
CreateCPPFile()
           
 
Method Summary
 java.lang.String conref(java.lang.String arg)
           
 java.lang.String conrefVectorize(java.lang.String arg, boolean packscope)
           
 java.lang.String context()
           
 java.lang.String dAgg(CreateFile.AssociationAttrInformation attr)
           
 java.lang.String fixDataType(CreateFile.AttrInformation attr)
           
 java.lang.String GetMeth(java.lang.String arg)
           
 java.lang.String indent(int num)
           
 java.lang.String initialCap(java.lang.String string)
           
 void LoopNames(CreateFile creator, CreateCPPFile.specificWriter swriter)
          Description: Loops through the Attributes and Associations so that we can write based on context.
 java.lang.String packageName()
           
 java.lang.String param(java.lang.String arg)
           
 void printCPPClassFile(CreateFile creator, java.lang.String fullOutputDir, java.lang.String packagePath, java.io.File header, java.lang.String mainHeadersName, java.lang.String guardName)
          Description: From the parsed information creates the file itself.
 void printCPPClassImpl(CreateFile creator, java.lang.String fullOutputDir, java.lang.String packagePath, java.io.File header, java.lang.String mainHeadersName)
          Description: This Method creates the CPP implementation file.
 java.lang.String quote(java.lang.String arg)
           
 java.lang.String ref(java.lang.String arg)
           
 java.lang.String Scope(java.lang.String arg)
           
 java.lang.String SetMeth(java.lang.String arg)
           
 java.lang.String smartPointer(CreateFile.AssociationAttrInformation attr, boolean packagescope)
           
 java.lang.String varit(java.lang.String arg)
           
 java.lang.String vectorize(java.lang.String arg, boolean packagescope)
           
protected static java.util.Vector wrapString(java.lang.String string, int lineLength, int firstLineOffset)
          Description: Takes the input string and breaks it into appropriate sized pieces.
 void writeBigHeaders(java.lang.String fullOutputDir, java.lang.String packageName, java.io.File header, java.util.Vector classes, java.lang.String headerName, java.lang.String guardName)
          Description: Writes all the header files into a standard include so that we can access them in mass.
protected  void writeCPPClassDecl(CreateFile creator, java.io.FileWriter writer)
          Description: Writes the CPP class declaration out to the Header file.
 void writeCPPComment(CreateFile creator, java.io.FileWriter writer, java.lang.String comment, int indentLevel, java.lang.String keyWord, boolean startComment, boolean endComment)
          Description: Takes the comment, formats it for C++ and outputs it.
 void writeCPPCommon(CreateFile creator, java.io.FileWriter writer)
          Description: Writes the common methods, common to all the CPP class Header files.
 void writeExceptionClass(java.lang.String fullOutputDir, java.lang.String packageName, java.io.File header, java.io.File mageException, java.lang.String guardName)
          Description: Writes the exception class template out to a file.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

NEWLINE

protected static final java.lang.String NEWLINE
Description: The environment specific new line.


oneIndent

protected static java.lang.String oneIndent
Description: Size of indentation.


bodyIndent

protected static java.lang.String bodyIndent
Constructor Detail

CreateCPPFile

public CreateCPPFile()
Method Detail

LoopNames

public void LoopNames(CreateFile creator,
                      CreateCPPFile.specificWriter swriter)
               throws java.lang.Exception
Description: Loops through the Attributes and Associations so that we can write based on context.

Parameters:
creator: - The CreateFile object returned from the list.
swriter: - The specific context to do the write.

Throws:
java.lang.Exception

writeBigHeaders

public void writeBigHeaders(java.lang.String fullOutputDir,
                            java.lang.String packageName,
                            java.io.File header,
                            java.util.Vector classes,
                            java.lang.String headerName,
                            java.lang.String guardName)
                     throws java.lang.Exception
Description: Writes all the header files into a standard include so that we can access them in mass.

Parameters:
fullOutputDir: - the full path for the project.
packageName: - the name of the package specified from caller
header: - The template file of header that begins every file
classes: - The list of all the classes
headerName: - The name of the file to write.
guardName: - The name of the Guard string that appears at the top of the all the header files.

Throws:
java.lang.Exception

writeExceptionClass

public void writeExceptionClass(java.lang.String fullOutputDir,
                                java.lang.String packageName,
                                java.io.File header,
                                java.io.File mageException,
                                java.lang.String guardName)
                         throws java.lang.Exception
Description: Writes the exception class template out to a file.

Parameters:
fullOutputDir: - the full path for the project.
packageName: - the name of the package specified from caller
header: - The template file of header that begins every file
mageException: - File for the MAGEException class.
gaurdName: - The name of the Guard string that appears at the top of the all the header files.

Throws:
java.lang.Exception

writeCPPComment

public void writeCPPComment(CreateFile creator,
                            java.io.FileWriter writer,
                            java.lang.String comment,
                            int indentLevel,
                            java.lang.String keyWord,
                            boolean startComment,
                            boolean endComment)
                     throws java.lang.Exception
Description: Takes the comment, formats it for C++ and outputs it.

Parameters:
creator: - The classFile used
writer: - used to write the comment to the file.
comment: - main string to write to the document.
indentLevel: - how far to indent.
keyWord: - JavaDoc keyword to prepend to the first line.
startComment: - Add lines to begin the comment.
endComment: - end the commetn.

Throws:
java.lang.Exception

writeCPPClassDecl

protected void writeCPPClassDecl(CreateFile creator,
                                 java.io.FileWriter writer)
                          throws java.lang.Exception
Description: Writes the CPP class declaration out to the Header file.

Parameters:
creator: - The CreateFile class used to extract what to write
writer: - The file to write to.

Throws:
java.lang.Exception

writeCPPCommon

public void writeCPPCommon(CreateFile creator,
                           java.io.FileWriter writer)
                    throws java.lang.Exception
Description: Writes the common methods, common to all the CPP class Header files.

Parameters:
creator: - The CreateFile class used to extract what to write
writer: - The file to write to.

Throws:
java.lang.Exception

printCPPClassFile

public void printCPPClassFile(CreateFile creator,
                              java.lang.String fullOutputDir,
                              java.lang.String packagePath,
                              java.io.File header,
                              java.lang.String mainHeadersName,
                              java.lang.String guardName)
                       throws java.lang.Exception
Description: From the parsed information creates the file itself.

Parameters:
fullOutputDir: - the full path for the project.
packagePath: - the directory from which to start from.
header: - the preamble copyright and creation information.
mainHeadersName: - the name of header file that includes all MAGE headers.
guardName: - The name of the Guard string that appears at the top of the all the header files.

Throws:
java.lang.Exception

printCPPClassImpl

public void printCPPClassImpl(CreateFile creator,
                              java.lang.String fullOutputDir,
                              java.lang.String packagePath,
                              java.io.File header,
                              java.lang.String mainHeadersName)
                       throws java.lang.Exception
Description: This Method creates the CPP implementation file.

Parameters:
creator: - The object the we are writing CPP for.
fullOutputDir: - the full path for the project.
packagePath: - the directory from which to start from.
header: - the preamble copyright and creation information.
mainHeadersName: - the name of the file containing a list of all the MAGE headers ( luckily we don't have to use it).

Throws:
java.lang.Exception

indent

public java.lang.String indent(int num)
                        throws java.lang.Exception
Throws:
java.lang.Exception

initialCap

public java.lang.String initialCap(java.lang.String string)
                            throws java.lang.Exception
Throws:
java.lang.Exception

GetMeth

public java.lang.String GetMeth(java.lang.String arg)
                         throws java.lang.Exception
Throws:
java.lang.Exception

SetMeth

public java.lang.String SetMeth(java.lang.String arg)
                         throws java.lang.Exception
Throws:
java.lang.Exception

Scope

public java.lang.String Scope(java.lang.String arg)

ref

public java.lang.String ref(java.lang.String arg)

varit

public java.lang.String varit(java.lang.String arg)
                       throws java.lang.Exception
Throws:
java.lang.Exception

conref

public java.lang.String conref(java.lang.String arg)
                        throws java.lang.Exception
Throws:
java.lang.Exception

dAgg

public java.lang.String dAgg(CreateFile.AssociationAttrInformation attr)
                      throws java.lang.Exception
Throws:
java.lang.Exception

vectorize

public java.lang.String vectorize(java.lang.String arg,
                                  boolean packagescope)
                           throws java.lang.Exception
Throws:
java.lang.Exception

smartPointer

public java.lang.String smartPointer(CreateFile.AssociationAttrInformation attr,
                                     boolean packagescope)
                              throws java.lang.Exception
Throws:
java.lang.Exception

conrefVectorize

public java.lang.String conrefVectorize(java.lang.String arg,
                                        boolean packscope)
                                 throws java.lang.Exception
Throws:
java.lang.Exception

fixDataType

public java.lang.String fixDataType(CreateFile.AttrInformation attr)
                             throws java.lang.Exception
Throws:
java.lang.Exception

param

public java.lang.String param(java.lang.String arg)

quote

public java.lang.String quote(java.lang.String arg)

context

public java.lang.String context()

packageName

public java.lang.String packageName()

wrapString

protected static java.util.Vector wrapString(java.lang.String string,
                                             int lineLength,
                                             int firstLineOffset)
                                      throws java.lang.Exception
Description: Takes the input string and breaks it into appropriate sized pieces.

Parameters:
string: - the string to wrap.
lineLength: - length to use as basis of wrapping.
firstLineOffset: - how much less room for the first line.

Returns:
a Vector that has the original String broken into appropriate sized pieces.

Throws:
java.lang.Exception