ptolemy.codegen.c.kernel.type.parameterizedTemplates
Class InstantiateFromTemplate

java.lang.Object
  extended by ptolemy.codegen.c.kernel.type.parameterizedTemplates.InstantiateFromTemplate

public class InstantiateFromTemplate
extends java.lang.Object

A utility class for creating specialized Array types.

Since:
Ptolemy II 8.0
Version:
$Id: InstantiateFromTemplate.java 57044 2010-01-27 22:41:05Z cxh $
Author:
Man-Kit Leung
Accepted Rating:
Red (mankit)
Proposed Rating:
Red (mankit)

Field Summary
private static java.util.HashMap<java.lang.String,java.lang.String> replaceMap
          NOTE: META SUBSTITUTION SYMBOLS $Type: Int, Char, Array, etc.
 
Constructor Summary
InstantiateFromTemplate()
           
 
Method Summary
private static void _replaceAndPrintContent(java.lang.StringBuffer templateCode, java.lang.String filename)
           
static void main(java.lang.String[] args)
          Generate a set of type-specific Array code files from a template by macro substitution.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

replaceMap

private static java.util.HashMap<java.lang.String,java.lang.String> replaceMap
NOTE: META SUBSTITUTION SYMBOLS $Type: Int, Char, Array, etc. $type_q: %d, %s, etc. $type: int, char, etc. $print_size: 12(int), 22(long), 22(double), 6(boolean)

Constructor Detail

InstantiateFromTemplate

public InstantiateFromTemplate()
Method Detail

main

public static void main(java.lang.String[] args)
                 throws java.lang.Exception
Generate a set of type-specific Array code files from a template by macro substitution. A type-specific Array file contains functions for the particular Array type (e.g. IntArray, DoubleArray, and etc.)

Parameters:
args - The first argument is taken to be the file path of the template. The second is the directory path to place the generated files.
Throws:
java.lang.Exception - Thrown if an error occurs when reading or writing the files.

_replaceAndPrintContent

private static void _replaceAndPrintContent(java.lang.StringBuffer templateCode,
                                            java.lang.String filename)
                                     throws java.io.IOException
Throws:
java.io.IOException