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

List of all members.

Public Member Functions

def factory
def __init__
def setState
def addLine
def show
def sentinel
def __getstate__
def serialize

Static Public Attributes

string BLOCKTYPE = 'Specialization'
tuple KEYWORD = pp.Suppress(pp.CaselessKeyword(BLOCKTYPE))
tuple GRAMMAR = KEYWORD+pp.LineEnd()
 SENTINEL = \
 SPECIAL = \

Private Member Functions

def _addSpec

Private Attributes

 _name
 _specLists
 _codeBuff
 _default
 _SPECIAL
 _state
 _code

Detailed Description

Definition at line 2623 of file blocks.py.


Constructor & Destructor Documentation

def blockit::Fortran::blocks::Specialization::__init__ (   self,
  parameters 
)
This is a specialization block which should only appear inside a
template block.  It is used to produce code that appears within it for
certain template parameters.  This is an example:

template <class Object, class Element>

Specialization
template <real, real>
function foo(bar, a,b,c) result(blah)
   type (myType<real, real>) :: bar
   real :: a,b
   integer :: c

   bar%a = bar%a * a
   bar%b = bar%b * b
end function foo

template <>
function foo(bar, a,b,c) result(blah)
   type (myType<Object, Element>) :: bar
   real :: a,b
   integer :: c
   print *, 'This is the default'
end function foo
end Specialization

end template

The above Specialization block will only show the first function if Object is
real and Element is real, but shows the second function default
(i.e. Using <>) otherwise.

Input
-----
parameters : the groups from the factory static method

Definition at line 2644 of file blocks.py.


Member Function Documentation

def blockit::Fortran::blocks::Specialization::__getstate__ (   self)
Builds a dictionary tree of the block.

Definition at line 2751 of file blocks.py.

def blockit::Fortran::blocks::Specialization::_addSpec (   self,
  s,
  l,
  tokens 
) [private]
Create specialization list where each entry is a tuple of template
parameters tuple and corresponding code.

Definition at line 2691 of file blocks.py.

def blockit::Fortran::blocks::Specialization::addLine (   self,
  line,
  n = None 
)
Overloaded addLine to add to code buffer and parse later in
sentinel method.

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

Definition at line 2728 of file blocks.py.

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

Definition at line 2637 of file blocks.py.

def blockit::Fortran::blocks::Specialization::sentinel (   self,
  line 
)
Overloaded sentinel method to grab all the specialization blocks.

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

Definition at line 2742 of file blocks.py.

def blockit::Fortran::blocks::Specialization::serialize (   self)

Definition at line 2759 of file blocks.py.

def blockit::Fortran::blocks::Specialization::setState (   self,
  state 
)
Overloaded to select which code block to use.  After the fist call,
a code block is selected.  Subsequent calls can be used to switch to
others.

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

Definition at line 2706 of file blocks.py.

def blockit::Fortran::blocks::Specialization::show (   self,
  mangle = False 
)
Overloaded show to break _codeBuff into code lines.

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

Definition at line 2735 of file blocks.py.


Member Data Documentation

Reimplemented from blockit::blocks::Block.

Definition at line 2712 of file blocks.py.

Definition at line 2680 of file blocks.py.

Reimplemented from blockit::blocks::Block.

Definition at line 2680 of file blocks.py.

Definition at line 2680 of file blocks.py.

Reimplemented from blockit::blocks::Block.

Definition at line 2626 of file blocks.py.

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

Definition at line 2625 of file blocks.py.

Definition at line 2630 of file blocks.py.


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