Appendix B - Predefined Template Variables

variable name

project

simul.

msgfile

inifile

nedfile

wizard

export

addProjectReference

X

author

X

X

X

X

X

X

X

date

X

X

X

X

X

X

X

licenseCode

X

X

X

X

X

X

X

licenseText

X

X

X

X

X

X

X

makemakeOptions

X

namespaceName

X

X

X

nedPackageName

X

X

X

X

nedSourceFolders

X

newWizardName

X

newWizardProject

X

projectName

X

X

X

X

X

X

PROJECTNAME

X

X

X

X

X

X

projectname

X

X

X

X

X

X

rawProjectName

X

X

X

X

X

X

requiresCPlusPlus

X

simulationFolderName

X

simulationName

X

sourceFolders

X

targetFileName

X

X

X

targetFolder

X

X

X

X

X

X

targetMainFile

X

X

X

X

X

targetTypeName

X

X

X

X

X

templateCategory

X

X

X

X

X

X

X

templateDescription

X

X

X

X

X

X

X

templateFolderName

X

X

X

X

X

X

X

templateFolderPath

X

X

X

X

X

X

X

templateName

X

X

X

X

X

X

X

templateProject

X

X

X

X

X

X

X

templateURL

X

X

X

X

X

X

X

withCplusplusSupport

X

wizardType

X

X

X

X

X

X

X

year

X

X

X

X

X

X

X

General

In the following sections, we describe the individual wizard types and their supported template variables. Variables will be marked with one or more letters to show in which wizard types they are supported as shown in the previous table.

  • A: supported in all wizards
  • P: project
  • S: simulation
  • M: messagefile
  • I: inifile
  • N: nedfile, simplemodule, compoundmodule, network
  • W: wizard

Variables marked as (*) are set by the wizard automatically and generally it does not make sense to change their values.

date (A)
current date in yyyy-mm-dd format
year (A)
year in yyyy format
author (A)
user name ("user.name" Java system property)
licenseCode (A)
license identifier for the @license NED property
licenseText (A)
copyright notice for the given license
bannerComment (A)
banner comment for source files; includes license text

Template information

wizardType (A,*)
the wizard type the template is invoked as. One of the following: project, simulation, nedfile, inifile, msgfile, simplemodule, compoundmodule, network, wizard, or export
templateName (A,*)
name of the template
templateDescription (A,*)
template description
templateCategory (A,*)
template category, used to visually group the templates in the wizards
templateURL (A,*)
the URL, the template was loaded from (only for built-in and other URL-based wizards)

The following variables are only defined if the template was loaded from the workspace (i.e. a project’s templates/ subdirectory):

templateFolderName (A,*)
name of the folder (without path) in which the template files are located
templateFolderPath (A,*)
full workspace path of the folder in which the template files are located
templateProject (A,*)
name of the project that defines the template

File name related variables

targetFolder (A,*)
the project or folder path in which the project will generate files. For project wizards, this holds the name of the project being created; for file wizards, it holds the name of the folder in which the file will be created; and for simulation wizards, it holds the name of the folder where files will be created.
targetFileName (N,I,M,*)
the name of the new file to be created. The file can be specified on the first wizard page.
targetTypeName (P,S,N,I,M)
a typename that can be used as the main type for the resulting code (for projects, it is the ${projectName}; for simulations, it is the specified ${simulationName}; and for the rest of wizards, it is calculated from the ${targetFileName}).
targetMainFile (P,S,N,I,M)
a file name that can be used as the main output file for the template (for projects and simulations it is ${targetTypeName}.ned, while for ned, msg and ini files, it is ${targetFileName}).

Project name related variables

rawProjectName (A)
the project name, "as is"
projectName (A)
sanitized project name with the first letter capitalized
projectname (A)
sanitized project name; all in lowercase
PROJECTNAME (A)
sanitized project name; all in uppercase

Sanitization means making the name suitable as a NED or C/C⁠+⁠+ identifier (spaces, punctuation and other inappropriate characters are replaced with underscore, etc.).

C⁠+⁠+ project control

addProjectReference (P)
If true, the wizard will make the result project dependent on the project containing the wizard itself.
withCplusplusSupport (P,*)
Whether the project supports C⁠+⁠+ code compilation. This is the state of the "C⁠+⁠+ support" checkbox on the first page of the project wizard. Setting this variable does not have any effect on the created project.
sourceFolders (P)
Source folders to be created and configured automatically
makemakeOptions (P)
makemake options, as "folder1:options1, folder2:options2,…". The wizard will automatically configure the C⁠+⁠+ project with the given options.
requiresCPlusPlus (P)
If true, the wizard requires the "support C⁠+⁠+ option" during the project creation. If any of the sourceFolders and makemakeOptions are present or withCplusplusSupport=true, the template will be displayed only if the "support C⁠+⁠+ option" option was set on the first page of the project wizard.
namespaceName (S,N,M)
The namespace where C⁠+⁠+ classes should be placed. This is determined automatically by looking up the value of the @namespace property in NED files in the NED source folder.

NED files and message files

nedSourceFolders (P)
NED source folders to be created and configured automatically.
nedPackageName (P,S,N,I)
The NED package name. For projects, it is ${projectname}. For simulations, NED and INI files, it is automatically calculated from the folder hierarchy where the file is generated.

Variables specific to New Simulation wizards

simulationFolderName (S,*)
the folder where the simulation will be created
simulationName (S,*)
The name of the simulation. It is the capitalized and sanitized name derived from the simulationFolderName .

Variables for New Wizard generation

newWizardName (W,*)
The name of the new wizard to be created. It is the name of the folder under the templates directory where all the template files will be stored.
newWizardProject (W)
The project where the new wizard will be created.

Miscellaneous

The variables below are for advanced use only. They can be used to access directly all known NED and message types, static classes for utility functions and the whole context used during template processing.

creationContext (A)
The template evaluation context. Provided for low level access.
classes (A)
Access to class static models. It is possible to access class static methods via this variable. See http://freemarker.org/docs/pgui_misc_beanwrapper.html#autoid_54 for further details.
nedResources (A)
Provides direct access to the in-memory model of the parsed NED files. It is possible to query, check and iterate over the available NED types.
msgResources (A)
Provides access to the in-memory model of the parsed NED files.

Note

In addition to the above variables, all keys found in the template.properties file are added automatically to the context as a template variable.