Loading...
Searching...
No Matches
casacore::Template Class Reference
casa package (libcasa_casa) » Utilities_module » Utilities_module_internal_classes

More...

`#include <Template.h>`

## Public Member Functions

| Template ()
| Default constructor.
| Template (const Vector< String > &files)
| Create from the file names given.
| Template (const String &filename)
| Create from the file name given.
| ~Template ()
| Destructor.
const String & | operator[] (uInt n)
| Operators.
void | reset ()
| Clear the object for a re-use.
void | read (const Vector< String > &files)
| Read the templates file or files into the class.
void | read (const String &filename)
uInt | getCount () const
| Get the number of template entries.
uInt | getTDCount () const
| Get the number of template definition lines found.
uInt | getTCount () const
| Get the number of templates found after all processing.
uInt | getDCount ()
| Get the number of duplicates found.
const String & | getTDFlist (uInt n)
| Get the various template definition information fields.
const String & | getTDlist (uInt n)
const uInt & | getTDfile (uInt n)
const uInt & | getTDline (uInt n)
const String & | getTDname (uInt n)
void | canonical (const Bool tmplonly=False)
| Canonicalise the template entries in the object.
void | splitName ()
| Split the entries in number, name id, rest.
void | sortName (const Bool renumber=False)
| Sort the data on name and number and fill in missing number.
void | writeOut (ostream &os, const Bool warn=False)
| Write the data formatted to the specified file.
void | writeDup (ostream &os, const String &userFile, Bool isSys=False)
| Write the duplicate list; the userFile gets ***; isSys gives the system switch.

## Private Member Functions

| Template (const Template &other)
| Copy constructor (not implemented).
Template & | operator= (const Template &other)
| Assignment (not implemented).
void | setComment (const String &txt, const Bool atstart=False)
| Save comment.
void | setOutput (const String &txt)
| Save a line.

## Private Attributes

Block< String > | output_p
| Each element is a template entry on a single line.
uInt | count_p
| Count the lines.
uInt | tcount_p
| Count the templates.
Block< String > | comout_p
| Record comment lines.
Block< Int > | comptr_p
| And where they originated.
uInt | ccount_p
| And count the comment lines.
Bool | isSplit_p
| Indicate data split.
uInt | dcount_p
| Count the duplicates.
Block< String > | nstring_p
| Data split of number string (or empty/spaces).
Block< String > | allstring_p
| Data split all text.
Block< String > | namstring_p
| Data split name string (first include file).
Block< uInt > | nval_p
| Data split numeric number.
Block< String > | tdflist_p
| List of files used.
uInt | tdcount_p
| Number of template definitions extracted from input.
Block< String > | tdlist_p
| List of template definitions.
Block< uInt > | tdfile_p
| Pointers to in which file in list.
Block< uInt > | tdline_p
| Line number in file at which template found.
Block< String > | tdname_p
| List of comparison names.

## Static Private Attributes

static const Regex | spaces
| Patterns to analyse an input line.
static const Regex | comment
static const Regex | ifRE
static const Regex | endifRE
static const Regex | elseRE
static const Regex | templateRE
static const Regex | contRE
static const Regex | fileRE
static const Regex | typedefRE
static const Regex | auxtemplRE
static const Regex | namespaceRE
static const uInt | Ncanon
| Simple pattern and replacements to make canonical templates files.
static const Regex | PATcanon [Ncanon]
static const String | REPcanon [Ncanon]
static const uInt | Ncanon2
| For canonical change: replacement of pattern with pattern.
static const Regex | PATcanon20 [Ncanon2]
static const Regex | PATcanon21 [Ncanon2]
static const String | REPcanon2 [Ncanon2]
static const uInt | Nnmin
| Make canonical numbers of 4 digits minimum.
static const Regex | PATnmin [Nnmin]
static const String | REPnmin [Nnmin]
static const uInt | Nnmax
| Make canonical numbers of 4 digits maximum.
static const Regex | PATnmax [Nnmax]
static const Regex | REPnmax [Nnmax]
static const Regex | splitnum
| Patterns to split off number and name Patterns to split off number and name.
static const Regex | splitnam
static const Regex | sifRE
| Patterns to check the template line.
static const Regex | stemRE
static const Regex | sconstRE
static const Regex | sretRE1
static const Regex | sretRE2
static const Regex | sretRE3
static const Regex | sretRE4
static const Regex | stypedefRE
static const Regex | sauxtemplRE
static const Regex | snamespaceRE
static const uInt | Ninif
| Replacement patterns for ifs in saved line.
static const String | PATinif [Ninif]
static const String | REPinif [Ninif]
static const Regex | classprelude
| Tests for finding real templates for duplicate tests.
static const Regex | functionprelude
static const Regex | forwardprelude
static const Regex | funcnameprelude
static const Regex | mylistprelude
static const Regex | leadsp
| Data to remove spaces at begin, end, make single, count/remove const.
static const Regex | endsp
static const Regex | mulsp
static const Regex | constsp
static const String | nullsp
static const String | singlesp
static const uInt | Ntypedef
| Patterns to make all typedefs comparisons for duplicates possible Note that the first three should be in that position for run-time change on some systems.
static const Regex | PATtypedef0 [Ntypedef]
static const Regex | PATtypedef1 [Ntypedef]
static String | REPtypedef [Ntypedef]
static const String | reposName
| Name of repository files.

## Detailed Description

Canonicalise, format and other actions on Casacore template definitions

### Intended use:

Internal

### Review Status

Reviewed By:
  UNKNOWN
Date Reviewed:
  before2004/08/25
Test programs:
  tSpectralFit

### Prerequisite

- Knowledge about the Casacore DYO template system

### Synopsis

A set of methods on template repository files and on template definitions to be used in the reident, used, unused and duplicates programs (see Sytem manual for details. <br /br> Methods exist to read templates, to canonicalise them for comparison and search functions and to format them for output.

### Motivation

To make template formatting identical across formatting/testing programs.

### To Do

- nothing I know

Definition at line 71 of file Template.h.

## Constructor & Destructor Documentation

## Template() [1/4]

casacore::Template::Template | ( |  | ) |

Default constructor.

Need to read data into it

Referenced by operator=(), and Template().

## Template() [2/4]

casacore::Template::Template | ( | const Vector< String > & | files | ) |

explicit

Create from the file names given.

## Template() [3/4]

casacore::Template::Template | ( | const String & | filename | ) |

explicit

Create from the file name given.

## ~Template()

casacore::Template::~Template | ( |  | ) |

Destructor.

## Template() [4/4]

casacore::Template::Template | ( | const Template & | other | ) |

private

Copy constructor (not implemented).

References Template().

## Member Function Documentation

## canonical()

void casacore::Template::canonical | ( | const Bool | tmplonly = False | ) |

Canonicalise the template entries in the object.

If switch True, do only the templates entry for duplication

References casacore::False.

## getCount()

uInt casacore::Template::getCount | ( |  | ) | const

inline

Get the number of template entries.

Definition at line 98 of file Template.h.

References count_p.

## getDCount()

uInt casacore::Template::getDCount | ( |  | ) |

inline

Get the number of duplicates found.

Definition at line 104 of file Template.h.

References dcount_p.

## getTCount()

uInt casacore::Template::getTCount | ( |  | ) | const

inline

Get the number of templates found after all processing.

Definition at line 102 of file Template.h.

References tcount_p.

## getTDCount()

uInt casacore::Template::getTDCount | ( |  | ) | const

inline

Get the number of template definition lines found.

Definition at line 100 of file Template.h.

References tdcount_p.

## getTDfile()

const uInt & casacore::Template::getTDfile | ( | uInt | n | ) |

inline

Definition at line 110 of file Template.h.

References tdfile_p.

## getTDFlist()

const String & casacore::Template::getTDFlist | ( | uInt | n | ) |

inline

Get the various template definition information fields.

Meant for testing and special projects only.

Definition at line 108 of file Template.h.

References tdflist_p.

## getTDline()

const uInt & casacore::Template::getTDline | ( | uInt | n | ) |

inline

Definition at line 111 of file Template.h.

References tdline_p.

## getTDlist()

const String & casacore::Template::getTDlist | ( | uInt | n | ) |

inline

Definition at line 109 of file Template.h.

References tdlist_p.

## getTDname()

const String & casacore::Template::getTDname | ( | uInt | n | ) |

inline

Definition at line 112 of file Template.h.

References tdname_p.

## operator=()

Template & casacore::Template::operator= | ( | const Template & | other | ) |

private

Assignment (not implemented).

References Template().

## operator[]()

const String & casacore::Template::operator[] | ( | uInt | n | ) |

inline

Operators.

Definition at line 86 of file Template.h.

References output_p.

## read() [1/2]

void casacore::Template::read | ( | const String & | filename | ) |

## read() [2/2]

void casacore::Template::read | ( | const Vector< String > & | files | ) |

Read the templates file or files into the class.

Multiple reading is additive. Errors are reported to cerr, and commented out in the file.

## reset()

void casacore::Template::reset | ( |  | ) |

Clear the object for a re-use.

## setComment()

void casacore::Template::setComment | ( | const String & | txt,
|  | const Bool | atstart = False )

private

Save comment.

References casacore::False.

## setOutput()

void casacore::Template::setOutput | ( | const String & | txt | ) |

private

Save a line.

## sortName()

void casacore::Template::sortName | ( | const Bool | renumber = False | ) |

Sort the data on name and number and fill in missing number.

If switch is True, renumber all template entries in sequence.

References casacore::False.

## splitName()

void casacore::Template::splitName | ( |  | ) |

Split the entries in number, name id, rest.

## writeDup()

void casacore::Template::writeDup | ( | ostream & | os,
|  | const String & | userFile,
|  | Bool | isSys = False )

Write the duplicate list; the userFile gets ***; isSys gives the system switch.

References casacore::False.

## writeOut()

void casacore::Template::writeOut | ( | ostream & | os,
|  | const Bool | warn = False )

Write the data formatted to the specified file.

Notify errors and warnings by writing to cerr. If warn is False, some warnings will be compressed into a general warning.

References casacore::False.

## Member Data Documentation

## allstring_p

Block<String> casacore::Template::allstring_p

private

Data split all text.

Definition at line 151 of file Template.h.

## auxtemplRE

const Regex casacore::Template::auxtemplRE

static private

Definition at line 193 of file Template.h.

## ccount_p

uInt casacore::Template::ccount_p

private

And count the comment lines.

Definition at line 143 of file Template.h.

## classprelude

const Regex casacore::Template::classprelude

static private

Tests for finding real templates for duplicate tests.

Definition at line 239 of file Template.h.

## comment

const Regex casacore::Template::comment

static private

Definition at line 185 of file Template.h.

## comout_p

Block<String> casacore::Template::comout_p

private

Record comment lines.

Definition at line 139 of file Template.h.

## comptr_p

Block<Int> casacore::Template::comptr_p

private

And where they originated.

Definition at line 141 of file Template.h.

## constsp

const Regex casacore::Template::constsp

static private

Definition at line 249 of file Template.h.

## contRE

const Regex casacore::Template::contRE

static private

Definition at line 190 of file Template.h.

## count_p

uInt casacore::Template::count_p

private

Count the lines.

Definition at line 135 of file Template.h.

Referenced by getCount().

## dcount_p

uInt casacore::Template::dcount_p

private

Count the duplicates.

Definition at line 147 of file Template.h.

Referenced by getDCount().

## elseRE

const Regex casacore::Template::elseRE

static private

Definition at line 188 of file Template.h.

## endifRE

const Regex casacore::Template::endifRE

static private

Definition at line 187 of file Template.h.

## endsp

const Regex casacore::Template::endsp

static private

Definition at line 247 of file Template.h.

## fileRE

const Regex casacore::Template::fileRE

static private

Definition at line 191 of file Template.h.

## forwardprelude

const Regex casacore::Template::forwardprelude

static private

Definition at line 241 of file Template.h.

## funcnameprelude

const Regex casacore::Template::funcnameprelude

static private

Definition at line 242 of file Template.h.

## functionprelude

const Regex casacore::Template::functionprelude

static private

Definition at line 240 of file Template.h.

## ifRE

const Regex casacore::Template::ifRE

static private

Definition at line 186 of file Template.h.

## isSplit_p

Bool casacore::Template::isSplit_p

private

Indicate data split.

Definition at line 145 of file Template.h.

## leadsp

const Regex casacore::Template::leadsp

static private

Data to remove spaces at begin, end, make single, count/remove const.

Definition at line 246 of file Template.h.

## mulsp

const Regex casacore::Template::mulsp

static private

Definition at line 248 of file Template.h.

## mylistprelude

const Regex casacore::Template::mylistprelude

static private

Definition at line 243 of file Template.h.

## namespaceRE

const Regex casacore::Template::namespaceRE

static private

Definition at line 194 of file Template.h.

## namstring_p

Block<String> casacore::Template::namstring_p

private

Data split name string (first include file).

Definition at line 153 of file Template.h.

## Ncanon

const uInt casacore::Template::Ncanon

static private

Simple pattern and replacements to make canonical templates files.

Definition at line 197 of file Template.h.

## Ncanon2

const uInt casacore::Template::Ncanon2

static private

For canonical change: replacement of pattern with pattern.

Definition at line 202 of file Template.h.

## Ninif

const uInt casacore::Template::Ninif

static private

Replacement patterns for ifs in saved line.

Definition at line 234 of file Template.h.

## Nnmax

const uInt casacore::Template::Nnmax

static private

Make canonical numbers of 4 digits maximum.

Definition at line 212 of file Template.h.

## Nnmin

const uInt casacore::Template::Nnmin

static private

Make canonical numbers of 4 digits minimum.

Definition at line 208 of file Template.h.

## nstring_p

Block<String> casacore::Template::nstring_p

private

Data split of number string (or empty/spaces).

Definition at line 149 of file Template.h.

## Ntypedef

const uInt casacore::Template::Ntypedef

static private

Patterns to make all typedefs comparisons for duplicates possible Note that the first three should be in that position for run-time change on some systems.

Definition at line 256 of file Template.h.

## nullsp

const String casacore::Template::nullsp

static private

Definition at line 250 of file Template.h.

## nval_p

Block<uInt> casacore::Template::nval_p

private

Data split numeric number.

Definition at line 155 of file Template.h.

## output_p

Block<String> casacore::Template::output_p

private

Each element is a template entry on a single line.

Definition at line 133 of file Template.h.

Referenced by operator[]().

## PATcanon

const Regex casacore::Template::PATcanon[Ncanon]

static private

Definition at line 198 of file Template.h.

## PATcanon20

const Regex casacore::Template::PATcanon20[Ncanon2]

static private

Definition at line 203 of file Template.h.

## PATcanon21

const Regex casacore::Template::PATcanon21[Ncanon2]

static private

Definition at line 204 of file Template.h.

## PATinif

const String casacore::Template::PATinif[Ninif]

static private

Definition at line 235 of file Template.h.

## PATnmax

const Regex casacore::Template::PATnmax[Nnmax]

static private

Definition at line 213 of file Template.h.

## PATnmin

const Regex casacore::Template::PATnmin[Nnmin]

static private

Definition at line 209 of file Template.h.

## PATtypedef0

const Regex casacore::Template::PATtypedef0[Ntypedef]

static private

Definition at line 257 of file Template.h.

## PATtypedef1

const Regex casacore::Template::PATtypedef1[Ntypedef]

static private

Definition at line 258 of file Template.h.

## REPcanon

const String casacore::Template::REPcanon[Ncanon]

static private

Definition at line 199 of file Template.h.

## REPcanon2

const String casacore::Template::REPcanon2[Ncanon2]

static private

Definition at line 205 of file Template.h.

## REPinif

const String casacore::Template::REPinif[Ninif]

static private

Definition at line 236 of file Template.h.

## REPnmax

const Regex casacore::Template::REPnmax[Nnmax]

static private

Definition at line 214 of file Template.h.

## REPnmin

const String casacore::Template::REPnmin[Nnmin]

static private

Definition at line 210 of file Template.h.

## reposName

const String casacore::Template::reposName

static private

Name of repository files.

Definition at line 262 of file Template.h.

## REPtypedef

String casacore::Template::REPtypedef[Ntypedef]

static private

Definition at line 259 of file Template.h.

## sauxtemplRE

const Regex casacore::Template::sauxtemplRE

static private

Definition at line 230 of file Template.h.

## sconstRE

const Regex casacore::Template::sconstRE

static private

Definition at line 224 of file Template.h.

## sifRE

const Regex casacore::Template::sifRE

static private

Patterns to check the template line.

Definition at line 222 of file Template.h.

## singlesp

const String casacore::Template::singlesp

static private

Definition at line 251 of file Template.h.

## snamespaceRE

const Regex casacore::Template::snamespaceRE

static private

Definition at line 231 of file Template.h.

## spaces

const Regex casacore::Template::spaces

static private

Patterns to analyse an input line.

Definition at line 184 of file Template.h.

## splitnam

const Regex casacore::Template::splitnam

static private

Definition at line 219 of file Template.h.

## splitnum

const Regex casacore::Template::splitnum

static private

Patterns to split off number and name Patterns to split off number and name.

Definition at line 218 of file Template.h.

## sretRE1

const Regex casacore::Template::sretRE1

static private

Definition at line 225 of file Template.h.

## sretRE2

const Regex casacore::Template::sretRE2

static private

Definition at line 226 of file Template.h.

## sretRE3

const Regex casacore::Template::sretRE3

static private

Definition at line 227 of file Template.h.

## sretRE4

const Regex casacore::Template::sretRE4

static private

Definition at line 228 of file Template.h.

## stemRE

const Regex casacore::Template::stemRE

static private

Definition at line 223 of file Template.h.

## stypedefRE

const Regex casacore::Template::stypedefRE

static private

Definition at line 229 of file Template.h.

## tcount_p

uInt casacore::Template::tcount_p

private

Count the templates.

Definition at line 137 of file Template.h.

Referenced by getTCount().

## tdcount_p

uInt casacore::Template::tdcount_p

private

Number of template definitions extracted from input.

Definition at line 160 of file Template.h.

Referenced by getTDCount().

## tdfile_p

Block<uInt> casacore::Template::tdfile_p

private

Pointers to in which file in list.

Definition at line 164 of file Template.h.

Referenced by getTDfile().

## tdflist_p

Block<String> casacore::Template::tdflist_p

private

List of files used.

Definition at line 158 of file Template.h.

Referenced by getTDFlist().

## tdline_p

Block<uInt> casacore::Template::tdline_p

private

Line number in file at which template found.

Definition at line 166 of file Template.h.

Referenced by getTDline().

## tdlist_p

Block<String> casacore::Template::tdlist_p

private

List of template definitions.

Definition at line 162 of file Template.h.

Referenced by getTDlist().

## tdname_p

Block<String> casacore::Template::tdname_p

private

List of comparison names.

Definition at line 168 of file Template.h.

Referenced by getTDname().

## templateRE

const Regex casacore::Template::templateRE

static private

Definition at line 189 of file Template.h.

## typedefRE

const Regex casacore::Template::typedefRE

static private

Definition at line 192 of file Template.h.

The documentation for this class was generated from the following file:

- casa/Utilities/Template.h