casacore
Public Member Functions | Private Member Functions | Private Attributes | Static Private Attributes | List of all members

More...

#include <Template.h>

Public Member Functions

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

Private Member Functions

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

Private Attributes

Block< Stringoutput_p
 Each element is a template entry on a single line. More...
 
uInt count_p
 Count the lines. More...
 
uInt tcount_p
 Count the templates. More...
 
Block< Stringcomout_p
 Record comment lines. More...
 
Block< Intcomptr_p
 And where they originated. More...
 
uInt ccount_p
 And count the comment lines. More...
 
Bool isSplit_p
 Indicate data split. More...
 
uInt dcount_p
 Count the duplicates. More...
 
Block< Stringnstring_p
 Data split of number string (or empty/spaces) More...
 
Block< Stringallstring_p
 Data split all text. More...
 
Block< Stringnamstring_p
 Data split name string (first include file) More...
 
Block< uIntnval_p
 Data split numeric number. More...
 
Block< Stringtdflist_p
 List of files used. More...
 
uInt tdcount_p
 Number of template definitions extracted from input. More...
 
Block< Stringtdlist_p
 List of template definitions. More...
 
Block< uInttdfile_p
 Pointers to in which file in list. More...
 
Block< uInttdline_p
 Line number in file at which template found. More...
 
Block< Stringtdname_p
 List of comparison names. More...
 

Static Private Attributes

static const Regex spaces
 Patterns to analyse an input line. More...
 
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. More...
 
static const Regex PATcanon [Ncanon]
 
static const String REPcanon [Ncanon]
 
static const uInt Ncanon2
 For canonical change: replacement of pattern with pattern. More...
 
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. More...
 
static const Regex PATnmin [Nnmin]
 
static const String REPnmin [Nnmin]
 
static const uInt Nnmax
 Make canonical numbers of 4 digits maximum. More...
 
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. More...
 
static const Regex splitnam
 
static const Regex sifRE
 Patterns to check the template line. More...
 
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. More...
 
static const String PATinif [Ninif]
 
static const String REPinif [Ninif]
 
static const Regex classprelude
 Tests for finding real templates for duplicate tests. More...
 
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. More...
 
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. More...
 
static const Regex PATtypedef0 [Ntypedef]
 
static const Regex PATtypedef1 [Ntypedef]
 
static String REPtypedef [Ntypedef]
 
static const String reposName
 Name of repository files. More...
 

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

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

Definition at line 73 of file Template.h.

Constructor & Destructor Documentation

◆ Template() [1/4]

casacore::Template::Template ( )

Default constructor.

Need to read data into it

◆ 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)

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

◆ getCount()

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

Get the number of template entries.

Definition at line 100 of file Template.h.

References count_p.

◆ getDCount()

uInt casacore::Template::getDCount ( )
inline

Get the number of duplicates found.

Definition at line 106 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 104 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 102 of file Template.h.

References tdcount_p.

◆ getTDfile()

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

Definition at line 112 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 110 of file Template.h.

References tdflist_p.

◆ getTDline()

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

Definition at line 113 of file Template.h.

References tdline_p.

◆ getTDlist()

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

Definition at line 111 of file Template.h.

References tdlist_p.

◆ getTDname()

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

Definition at line 114 of file Template.h.

References tdname_p.

◆ operator=()

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

Assignment (not implemented)

◆ operator[]()

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

Operators.

Definition at line 88 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.

◆ 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.

◆ 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.

◆ 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.

Member Data Documentation

◆ allstring_p

Block<String> casacore::Template::allstring_p
private

Data split all text.

Definition at line 153 of file Template.h.

◆ auxtemplRE

const Regex casacore::Template::auxtemplRE
staticprivate

Definition at line 195 of file Template.h.

◆ ccount_p

uInt casacore::Template::ccount_p
private

And count the comment lines.

Definition at line 145 of file Template.h.

◆ classprelude

const Regex casacore::Template::classprelude
staticprivate

Tests for finding real templates for duplicate tests.

Definition at line 241 of file Template.h.

◆ comment

const Regex casacore::Template::comment
staticprivate

Definition at line 187 of file Template.h.

◆ comout_p

Block<String> casacore::Template::comout_p
private

Record comment lines.

Definition at line 141 of file Template.h.

◆ comptr_p

Block<Int> casacore::Template::comptr_p
private

And where they originated.

Definition at line 143 of file Template.h.

◆ constsp

const Regex casacore::Template::constsp
staticprivate

Definition at line 251 of file Template.h.

◆ contRE

const Regex casacore::Template::contRE
staticprivate

Definition at line 192 of file Template.h.

◆ count_p

uInt casacore::Template::count_p
private

Count the lines.

Definition at line 137 of file Template.h.

Referenced by getCount().

◆ dcount_p

uInt casacore::Template::dcount_p
private

Count the duplicates.

Definition at line 149 of file Template.h.

Referenced by getDCount().

◆ elseRE

const Regex casacore::Template::elseRE
staticprivate

Definition at line 190 of file Template.h.

◆ endifRE

const Regex casacore::Template::endifRE
staticprivate

Definition at line 189 of file Template.h.

◆ endsp

const Regex casacore::Template::endsp
staticprivate

Definition at line 249 of file Template.h.

◆ fileRE

const Regex casacore::Template::fileRE
staticprivate

Definition at line 193 of file Template.h.

◆ forwardprelude

const Regex casacore::Template::forwardprelude
staticprivate

Definition at line 243 of file Template.h.

◆ funcnameprelude

const Regex casacore::Template::funcnameprelude
staticprivate

Definition at line 244 of file Template.h.

◆ functionprelude

const Regex casacore::Template::functionprelude
staticprivate

Definition at line 242 of file Template.h.

◆ ifRE

const Regex casacore::Template::ifRE
staticprivate

Definition at line 188 of file Template.h.

◆ isSplit_p

Bool casacore::Template::isSplit_p
private

Indicate data split.

Definition at line 147 of file Template.h.

◆ leadsp

const Regex casacore::Template::leadsp
staticprivate

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

Definition at line 248 of file Template.h.

◆ mulsp

const Regex casacore::Template::mulsp
staticprivate

Definition at line 250 of file Template.h.

◆ mylistprelude

const Regex casacore::Template::mylistprelude
staticprivate

Definition at line 245 of file Template.h.

◆ namespaceRE

const Regex casacore::Template::namespaceRE
staticprivate

Definition at line 196 of file Template.h.

◆ namstring_p

Block<String> casacore::Template::namstring_p
private

Data split name string (first include file)

Definition at line 155 of file Template.h.

◆ Ncanon

const uInt casacore::Template::Ncanon
staticprivate

Simple pattern and replacements to make canonical templates files.

Definition at line 199 of file Template.h.

◆ Ncanon2

const uInt casacore::Template::Ncanon2
staticprivate

For canonical change: replacement of pattern with pattern.

Definition at line 204 of file Template.h.

◆ Ninif

const uInt casacore::Template::Ninif
staticprivate

Replacement patterns for ifs in saved line.

Definition at line 236 of file Template.h.

◆ Nnmax

const uInt casacore::Template::Nnmax
staticprivate

Make canonical numbers of 4 digits maximum.

Definition at line 214 of file Template.h.

◆ Nnmin

const uInt casacore::Template::Nnmin
staticprivate

Make canonical numbers of 4 digits minimum.

Definition at line 210 of file Template.h.

◆ nstring_p

Block<String> casacore::Template::nstring_p
private

Data split of number string (or empty/spaces)

Definition at line 151 of file Template.h.

◆ Ntypedef

const uInt casacore::Template::Ntypedef
staticprivate

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 258 of file Template.h.

◆ nullsp

const String casacore::Template::nullsp
staticprivate

Definition at line 252 of file Template.h.

◆ nval_p

Block<uInt> casacore::Template::nval_p
private

Data split numeric number.

Definition at line 157 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 135 of file Template.h.

Referenced by operator[]().

◆ PATcanon

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

Definition at line 200 of file Template.h.

◆ PATcanon20

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

Definition at line 205 of file Template.h.

◆ PATcanon21

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

Definition at line 206 of file Template.h.

◆ PATinif

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

Definition at line 237 of file Template.h.

◆ PATnmax

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

Definition at line 215 of file Template.h.

◆ PATnmin

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

Definition at line 211 of file Template.h.

◆ PATtypedef0

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

Definition at line 259 of file Template.h.

◆ PATtypedef1

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

Definition at line 260 of file Template.h.

◆ REPcanon

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

Definition at line 201 of file Template.h.

◆ REPcanon2

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

Definition at line 207 of file Template.h.

◆ REPinif

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

Definition at line 238 of file Template.h.

◆ REPnmax

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

Definition at line 216 of file Template.h.

◆ REPnmin

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

Definition at line 212 of file Template.h.

◆ reposName

const String casacore::Template::reposName
staticprivate

Name of repository files.

Definition at line 264 of file Template.h.

◆ REPtypedef

String casacore::Template::REPtypedef[Ntypedef]
staticprivate

Definition at line 261 of file Template.h.

◆ sauxtemplRE

const Regex casacore::Template::sauxtemplRE
staticprivate

Definition at line 232 of file Template.h.

◆ sconstRE

const Regex casacore::Template::sconstRE
staticprivate

Definition at line 226 of file Template.h.

◆ sifRE

const Regex casacore::Template::sifRE
staticprivate

Patterns to check the template line.

Definition at line 224 of file Template.h.

◆ singlesp

const String casacore::Template::singlesp
staticprivate

Definition at line 253 of file Template.h.

◆ snamespaceRE

const Regex casacore::Template::snamespaceRE
staticprivate

Definition at line 233 of file Template.h.

◆ spaces

const Regex casacore::Template::spaces
staticprivate

Patterns to analyse an input line.

Definition at line 186 of file Template.h.

◆ splitnam

const Regex casacore::Template::splitnam
staticprivate

Definition at line 221 of file Template.h.

◆ splitnum

const Regex casacore::Template::splitnum
staticprivate

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

Definition at line 220 of file Template.h.

◆ sretRE1

const Regex casacore::Template::sretRE1
staticprivate

Definition at line 227 of file Template.h.

◆ sretRE2

const Regex casacore::Template::sretRE2
staticprivate

Definition at line 228 of file Template.h.

◆ sretRE3

const Regex casacore::Template::sretRE3
staticprivate

Definition at line 229 of file Template.h.

◆ sretRE4

const Regex casacore::Template::sretRE4
staticprivate

Definition at line 230 of file Template.h.

◆ stemRE

const Regex casacore::Template::stemRE
staticprivate

Definition at line 225 of file Template.h.

◆ stypedefRE

const Regex casacore::Template::stypedefRE
staticprivate

Definition at line 231 of file Template.h.

◆ tcount_p

uInt casacore::Template::tcount_p
private

Count the templates.

Definition at line 139 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 162 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 166 of file Template.h.

Referenced by getTDfile().

◆ tdflist_p

Block<String> casacore::Template::tdflist_p
private

List of files used.

Definition at line 160 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 168 of file Template.h.

Referenced by getTDline().

◆ tdlist_p

Block<String> casacore::Template::tdlist_p
private

List of template definitions.

Definition at line 164 of file Template.h.

Referenced by getTDlist().

◆ tdname_p

Block<String> casacore::Template::tdname_p
private

List of comparison names.

Definition at line 170 of file Template.h.

Referenced by getTDname().

◆ templateRE

const Regex casacore::Template::templateRE
staticprivate

Definition at line 191 of file Template.h.

◆ typedefRE

const Regex casacore::Template::typedefRE
staticprivate

Definition at line 194 of file Template.h.


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