casa  $Rev:20696$
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines
Public Member Functions | Private Member Functions | Private Attributes | Static Private Attributes
casa::Template Class Reference

Canonicalise, format and other actions on aips++ template definitions. More...

#include <Template.h>

List of all members.

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 Stringoperator[] (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 StringgetTDFlist (uInt n)
 Get the various template definition information fields.
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.
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)
Templateoperator= (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< Stringoutput_p
 Each element is a template entry on a single line.
uInt count_p
 Count the lines.
uInt tcount_p
 Count the templates.
Block< Stringcomout_p
 Record comment lines.
Block< Intcomptr_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< Stringnstring_p
 Data split of number string (or empty/spaces)
Block< Stringallstring_p
 Data split all text.
Block< Stringnamstring_p
 Data split name string (first include file)
Block< uIntnval_p
 Data split numeric number.
Block< Stringtdflist_p
 List of files used.
uInt tdcount_p
 Number of template definitions extracted from input.
Block< Stringtdlist_p
 List of template definitions.
Block< uInttdfile_p
 Pointers to in which file in list.
Block< uInttdline_p
 Line number in file at which template found.
Block< Stringtdname_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 aips++ 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

Default constructor.

Need to read data into it

casa::Template::Template ( const Vector< String > &  files) [explicit]

Create from the file names given.

casa::Template::Template ( const String filename) [explicit]

Create from the file name given.

Destructor.

casa::Template::Template ( const Template other) [private]

Copy constructor (not implemented)


Member Function Documentation

void casa::Template::canonical ( const Bool  tmplonly = False)

Canonicalise the template entries in the object.

If switch True, do only the templates entry for duplication

uInt casa::Template::getCount ( ) const [inline]

Get the number of template entries.

Definition at line 100 of file Template.h.

References count_p.

Get the number of duplicates found.

Definition at line 106 of file Template.h.

References dcount_p.

uInt casa::Template::getTCount ( ) const [inline]

Get the number of templates found after all processing.

Definition at line 104 of file Template.h.

References tcount_p.

uInt casa::Template::getTDCount ( ) const [inline]

Get the number of template definition lines found.

Definition at line 102 of file Template.h.

References tdcount_p.

const uInt& casa::Template::getTDfile ( uInt  n) [inline]

Definition at line 112 of file Template.h.

References tdfile_p.

const String& casa::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.

const uInt& casa::Template::getTDline ( uInt  n) [inline]

Definition at line 113 of file Template.h.

References tdline_p.

const String& casa::Template::getTDlist ( uInt  n) [inline]

Definition at line 111 of file Template.h.

References tdlist_p.

const String& casa::Template::getTDname ( uInt  n) [inline]

Definition at line 114 of file Template.h.

References tdname_p.

Template& casa::Template::operator= ( const Template other) [private]

Assignment (not implemented)

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

Operators.

Definition at line 88 of file Template.h.

References output_p.

void casa::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.

void casa::Template::read ( const String filename)

Clear the object for a re-use.

void casa::Template::setComment ( const String txt,
const Bool  atstart = False 
) [private]

Save comment.

void casa::Template::setOutput ( const String txt) [private]

Save a line.

void casa::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.

Split the entries in number, name id, rest.

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

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

void casa::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

Data split all text.

Definition at line 153 of file Template.h.

const Regex casa::Template::auxtemplRE [static, private]

Definition at line 195 of file Template.h.

And count the comment lines.

Definition at line 145 of file Template.h.

const Regex casa::Template::classprelude [static, private]

Tests for finding real templates for duplicate tests.

Definition at line 241 of file Template.h.

const Regex casa::Template::comment [static, private]

Definition at line 187 of file Template.h.

Record comment lines.

Definition at line 141 of file Template.h.

And where they originated.

Definition at line 143 of file Template.h.

const Regex casa::Template::constsp [static, private]

Definition at line 251 of file Template.h.

const Regex casa::Template::contRE [static, private]

Definition at line 192 of file Template.h.

Count the lines.

Definition at line 137 of file Template.h.

Referenced by getCount().

Count the duplicates.

Definition at line 149 of file Template.h.

Referenced by getDCount().

const Regex casa::Template::elseRE [static, private]

Definition at line 190 of file Template.h.

const Regex casa::Template::endifRE [static, private]

Definition at line 189 of file Template.h.

const Regex casa::Template::endsp [static, private]

Definition at line 249 of file Template.h.

const Regex casa::Template::fileRE [static, private]

Definition at line 193 of file Template.h.

const Regex casa::Template::forwardprelude [static, private]

Definition at line 243 of file Template.h.

const Regex casa::Template::funcnameprelude [static, private]

Definition at line 244 of file Template.h.

const Regex casa::Template::functionprelude [static, private]

Definition at line 242 of file Template.h.

const Regex casa::Template::ifRE [static, private]

Definition at line 188 of file Template.h.

Indicate data split.

Definition at line 147 of file Template.h.

const Regex casa::Template::leadsp [static, private]

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

Definition at line 248 of file Template.h.

const Regex casa::Template::mulsp [static, private]

Definition at line 250 of file Template.h.

const Regex casa::Template::mylistprelude [static, private]

Definition at line 245 of file Template.h.

const Regex casa::Template::namespaceRE [static, private]

Definition at line 196 of file Template.h.

Data split name string (first include file)

Definition at line 155 of file Template.h.

const uInt casa::Template::Ncanon [static, private]

Simple pattern and replacements to make canonical templates files.

Definition at line 199 of file Template.h.

const uInt casa::Template::Ncanon2 [static, private]

For canonical change: replacement of pattern with pattern.

Definition at line 204 of file Template.h.

const uInt casa::Template::Ninif [static, private]

Replacement patterns for ifs in saved line.

Definition at line 236 of file Template.h.

const uInt casa::Template::Nnmax [static, private]

Make canonical numbers of 4 digits maximum.

Definition at line 214 of file Template.h.

const uInt casa::Template::Nnmin [static, private]

Make canonical numbers of 4 digits minimum.

Definition at line 210 of file Template.h.

Data split of number string (or empty/spaces)

Definition at line 151 of file Template.h.

const uInt casa::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 258 of file Template.h.

const String casa::Template::nullsp [static, private]

Definition at line 252 of file Template.h.

Data split numeric number.

Definition at line 157 of file Template.h.

Each element is a template entry on a single line.

Definition at line 135 of file Template.h.

Referenced by operator[]().

const Regex casa::Template::PATcanon[Ncanon] [static, private]

Definition at line 200 of file Template.h.

const Regex casa::Template::PATcanon20[Ncanon2] [static, private]

Definition at line 205 of file Template.h.

const Regex casa::Template::PATcanon21[Ncanon2] [static, private]

Definition at line 206 of file Template.h.

const String casa::Template::PATinif[Ninif] [static, private]

Definition at line 237 of file Template.h.

const Regex casa::Template::PATnmax[Nnmax] [static, private]

Definition at line 215 of file Template.h.

const Regex casa::Template::PATnmin[Nnmin] [static, private]

Definition at line 211 of file Template.h.

const Regex casa::Template::PATtypedef0[Ntypedef] [static, private]

Definition at line 259 of file Template.h.

const Regex casa::Template::PATtypedef1[Ntypedef] [static, private]

Definition at line 260 of file Template.h.

const String casa::Template::REPcanon[Ncanon] [static, private]

Definition at line 201 of file Template.h.

const String casa::Template::REPcanon2[Ncanon2] [static, private]

Definition at line 207 of file Template.h.

const String casa::Template::REPinif[Ninif] [static, private]

Definition at line 238 of file Template.h.

const Regex casa::Template::REPnmax[Nnmax] [static, private]

Definition at line 216 of file Template.h.

const String casa::Template::REPnmin[Nnmin] [static, private]

Definition at line 212 of file Template.h.

const String casa::Template::reposName [static, private]

Name of repository files.

Definition at line 264 of file Template.h.

Definition at line 261 of file Template.h.

const Regex casa::Template::sauxtemplRE [static, private]

Definition at line 232 of file Template.h.

const Regex casa::Template::sconstRE [static, private]

Definition at line 226 of file Template.h.

const Regex casa::Template::sifRE [static, private]

Patterns to check the template line.

Definition at line 224 of file Template.h.

const String casa::Template::singlesp [static, private]

Definition at line 253 of file Template.h.

const Regex casa::Template::snamespaceRE [static, private]

Definition at line 233 of file Template.h.

const Regex casa::Template::spaces [static, private]

Patterns to analyse an input line.

Definition at line 186 of file Template.h.

const Regex casa::Template::splitnam [static, private]

Definition at line 221 of file Template.h.

const Regex casa::Template::splitnum [static, private]

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

Definition at line 220 of file Template.h.

const Regex casa::Template::sretRE1 [static, private]

Definition at line 227 of file Template.h.

const Regex casa::Template::sretRE2 [static, private]

Definition at line 228 of file Template.h.

const Regex casa::Template::sretRE3 [static, private]

Definition at line 229 of file Template.h.

const Regex casa::Template::sretRE4 [static, private]

Definition at line 230 of file Template.h.

const Regex casa::Template::stemRE [static, private]

Definition at line 225 of file Template.h.

const Regex casa::Template::stypedefRE [static, private]

Definition at line 231 of file Template.h.

Count the templates.

Definition at line 139 of file Template.h.

Referenced by getTCount().

Number of template definitions extracted from input.

Definition at line 162 of file Template.h.

Referenced by getTDCount().

Pointers to in which file in list.

Definition at line 166 of file Template.h.

Referenced by getTDfile().

List of files used.

Definition at line 160 of file Template.h.

Referenced by getTDFlist().

Line number in file at which template found.

Definition at line 168 of file Template.h.

Referenced by getTDline().

List of template definitions.

Definition at line 164 of file Template.h.

Referenced by getTDlist().

List of comparison names.

Definition at line 170 of file Template.h.

Referenced by getTDname().

const Regex casa::Template::templateRE [static, private]

Definition at line 191 of file Template.h.

const Regex casa::Template::typedefRE [static, private]

Definition at line 194 of file Template.h.


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