BlockIt
blockit::Fortran::blocks::Template Class Reference
Inheritance diagram for blockit::Fortran::blocks::Template:
Collaboration diagram for blockit::Fortran::blocks::Template:

List of all members.

Public Member Functions

def factory
def __init__
def isTemplated
def sentinel
def template
def isTemplated
def addObjects
def show
def hash
def name
def instantiate

Static Public Attributes

string BLOCKTYPE = 'Template'
tuple KEYWORD = pp.Suppress(pp.CaselessKeyword(BLOCKTYPE))
tuple TEMPLATE_PARAM_TYPE = pp.CaselessKeyword('class')
tuple DEFAULT_ASSIGNMENT = pp.Suppress('=')
tuple TEMPLATE_DECL_COMB = pp.Combine(TEMPLATE_DECL, adjacent=False)
tuple VALIDNAME_WITH_PAREN_COMB = pp.Combine(VALIDNAME_WITH_PAREN, adjacent=False)
 TEMPLATE_ITEM = \
 GRAMMAR = \
 SENTINEL = \

Private Member Functions

def _createTemplatePairs

Private Attributes

 _template
 _name_length
 _hash

Detailed Description

Definition at line 856 of file blocks.py.


Constructor & Destructor Documentation

def blockit::Fortran::blocks::Template::__init__ (   self,
  parameters,
  name = None 
)
A Template block.  Template blocks begin with the line:

template < ... >

where ... is a list of template parameters starting with the keyword
class.  For example,

template <class A, class B>
.
.
.
end template

is the start of a template block with two internal template paramters
A and B.

Input
-----
parameters : the groups from the factory static method
name : optional name to give the template

Definition at line 898 of file blocks.py.


Member Function Documentation

def blockit::Fortran::blocks::Template::_createTemplatePairs (   self,
  tokens 
) [private]
Create template pairs from the pyparsed tokens list.

Arguments:
- `self`:
- `tokens`: nested tokens list from pyparsing

Definition at line 934 of file blocks.py.

def blockit::Fortran::blocks::Template::addObjects (   self,
  obj 
)
Added a specification set for the template, e.g. if the template
specification is <class Object, class Element>, then if you want
Object to be 'integer' and Element to be 'real' obj would be in the
argument list would be ('integer', 'real').

obj : specification of a template, e.g. ('integer', 'real') for the
      template string <class Object, class Element>.

Reimplemented from blockit::Fortran::blocks::FortranBlock.

Definition at line 977 of file blocks.py.

def blockit::Fortran::blocks::Template::factory (   s,
  lineNo,
  tokens 
)
Factory method called by the BlockParser to produce an
instance of the class.

Definition at line 889 of file blocks.py.

def blockit::Fortran::blocks::Template::hash (   self)
Overloaded hash method for this block if it does not already have a
_hash internal value.  Uses the mangled version for the hash.  The
hash value is:

<the text hash>/<template parameters>

Reimplemented from blockit::blocks::Block.

Definition at line 999 of file blocks.py.

def blockit::Fortran::blocks::Template::instantiate (   self,
  objects,
  cache 
)
This method only exists for realizations of templated blocks.  The
setState() method is called internally with the provide list of
template specifications which sets the template parameter states.
Then this method creates a realization of a template block using those
parameters and returns it.

objects : a template parameter list, e.g ('*','integer','*')
  for a three parameter template with default values used for
  the first and last value or ('integer', 'real') for a two
  parameter list.  The wildcards are resolved internally.

cache : and instance of FortranCacheManager to check for instantiated
templates

Definition at line 1022 of file blocks.py.

def blockit::Fortran::blocks::Template::isTemplated (   self)
Return True if the code block is templated or within a templated
code block.

Reimplemented from blockit::Fortran::blocks::FortranBlock.

Definition at line 946 of file blocks.py.

def blockit::Fortran::blocks::Template::isTemplated (   self)
Returns True if template block is templated, i.e. it has a template
specification.  Instantiated template blocks are template blocks that
do not have template specs so they will return false.

Reimplemented from blockit::Fortran::blocks::FortranBlock.

Definition at line 968 of file blocks.py.

def blockit::Fortran::blocks::Template::name (   self)
Name of templates does not adhere to 31 character limit

Reimplemented from blockit::blocks::Block.

Definition at line 1016 of file blocks.py.

def blockit::Fortran::blocks::Template::sentinel (   self,
  line 
)
Overrided sentinel method to strip first and last lines from code
block.

Reimplemented from blockit::Fortran::blocks::FortranBlock.

Definition at line 953 of file blocks.py.

def blockit::Fortran::blocks::Template::show (   self,
  mangle = False,
  force = False 
)
Overloaded show method for templates.  Only show template if it is
a realized template, i.e. the _template attribute is None.  This can
be overridden with the force parameter to show it anyway.

Definition at line 989 of file blocks.py.

def blockit::Fortran::blocks::Template::template (   self)
Return the template specification string of the template.

Reimplemented from blockit::Fortran::blocks::FortranBlock.

Definition at line 962 of file blocks.py.


Member Data Documentation

Reimplemented from blockit::blocks::Block.

Definition at line 1005 of file blocks.py.

Reimplemented from blockit::Fortran::blocks::FortranBlock.

Definition at line 860 of file blocks.py.

tuple blockit::Fortran::blocks::Template::DEFAULT_ASSIGNMENT = pp.Suppress('=') [static]

Definition at line 863 of file blocks.py.

Reimplemented from blockit::blocks::Block.

Definition at line 876 of file blocks.py.

tuple blockit::Fortran::blocks::Template::KEYWORD = pp.Suppress(pp.CaselessKeyword(BLOCKTYPE)) [static]

Definition at line 861 of file blocks.py.

Reimplemented from blockit::Fortran::blocks::FortranBlock.

Definition at line 882 of file blocks.py.

tuple blockit::Fortran::blocks::Template::TEMPLATE_DECL_COMB = pp.Combine(TEMPLATE_DECL, adjacent=False) [static]

Definition at line 864 of file blocks.py.

Definition at line 866 of file blocks.py.

tuple blockit::Fortran::blocks::Template::TEMPLATE_PARAM_TYPE = pp.CaselessKeyword('class') [static]

Definition at line 862 of file blocks.py.

tuple blockit::Fortran::blocks::Template::VALIDNAME_WITH_PAREN_COMB = pp.Combine(VALIDNAME_WITH_PAREN, adjacent=False) [static]

Definition at line 865 of file blocks.py.


The documentation for this class was generated from the following file:
 All Classes Namespaces Files Functions Variables Properties