Loading...
Searching...
No Matches
TaQLStyle.h
Go to the documentation of this file.
//# TaQLStyle.h: Class with static members defining the TaQL style
//# Copyright (C) 2006
//# Associated Universities, Inc. Washington DC, USA.
//#
//# This library is free software; you can redistribute it and/or modify it
//# under the terms of the GNU Library General Public License as published by
//# the Free Software Foundation; either version 2 of the License, or (at your
//# option) any later version.
//#
//# This library is distributed in the hope that it will be useful, but WITHOUT
//# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
//# FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public
//# License for more details.
//#
//# You should have received a copy of the GNU Library General Public License
//# along with this library; if not, write to the Free Software Foundation,
//# Inc., 675 Massachusetts Ave, Cambridge, MA 02139, USA.
//#
//# Correspondence concerning AIPS++ should be addressed as follows:
//# Internet email: casa-feedback@nrao.edu.
//# Postal address: AIPS++ Project Office
//# National Radio Astronomy Observatory
//# 520 Edgemont Road
//# Charlottesville, VA 22903-2475 USA
#ifndef TABLES_TAQLSTYLE_H
#define TABLES_TAQLSTYLE_H
//# Includes
#include <casacore/casa/aips.h>
#include <casacore/casa/BasicSL/String.h>
#include <casacore/casa/stdmap.h>
namespace casacore { //# NAMESPACE CASACORE - BEGIN
// <summary>
// Class with static members defining the TaQL style.
// </summary>
// <use visibility=local>
// <reviewed reviewer="" date="" tests="">
// </reviewed>
// <synopsis>
// Originally TaQL was developed to use the Glish style of indexing.
// This meant 1-based indices, axes in Fortran order, and end is inclusive
// in start:end.
// On the other hand the Python style is the opposite.
// In order to let the user choose between styles, one can define the
// style in a TaQL command.
// The default style is Glish.
//
// The class is also used to tell the TaQL execution engine if timings
// or tracing of the various parts of the TaQL command need to be done.
//
// Finally it is possible to define synonyms for UDF library names.
// For example, 'derivedmscal' is a lot to type, so a synonym 'mscal'
// (or even 'mc') can be defined for it.
// </synopsis>
class TaQLStyle
{
public:
// Default style is Glish and no timing/tracing.
explicit TaQLStyle (uInt origin=1);
// Reset to the default Glish style and no timing/tracing.
void reset();
// Set the style according to the (case-insensitive) value.
// Possible values are Glish, Python, Base0, Base1, FortranOrder, Corder,
// InclEnd, and ExclEnd.
void set (const String& value);
// Define a UDF library name synonym.
// The synonym name is always converted to lowercase because TaQL always
// uses lowercase to lookup functions. The library name kept as is making
// it possible to use a library containing uppercase characters.
// If the synonym already exists, it is redefined.
void defineSynonym (const String& synonym, const String& udfLibName);
// Set a synonym using a command like 'synonym = udflibname'.
void defineSynonym (const String& command);
// Find the UDF library name belonging to a synonym.
// If undefined, the synonym itself is returned.
String findSynonym (const String& synonym) const;
// Get the various style values.
// <group>
uInt origin() const
{ return itsOrigin; }
Bool isEndExcl() const
{ return itsEndExcl; }
Bool isCOrder() const
{ return itsCOrder; }
// </group>
// Set if timing needs to be done.
void setTiming (Bool doTiming)
{ itsDoTiming = doTiming; }
// Should timing be done?
Bool doTiming() const
{ return itsDoTiming; }
// Set if tracing needs to be done.
void setTracing (Bool doTracing)
{ itsDoTracing = doTracing; }
// Should tracing be done?
Bool doTracing() const
{ return itsDoTracing; }
private:
uInt itsOrigin;
Bool itsEndExcl;
Bool itsCOrder;
Bool itsDoTiming;
Bool itsDoTracing;
std::map<String,String> itsUDFLibNameMap;
};
} //# NAMESPACE CASACORE - END
#endif
casacore::String
String: the storage and methods of handling collections of characters.
Definition String.h:223
casacore::TaQLStyle::doTracing
Bool doTracing() const
Should tracing be done?
Definition TaQLStyle.h:113
casacore::TaQLStyle::itsDoTracing
Bool itsDoTracing
Definition TaQLStyle.h:121
casacore::TaQLStyle::set
void set(const String &value)
Set the style according to the (case-insensitive) value.
casacore::TaQLStyle::itsCOrder
Bool itsCOrder
Definition TaQLStyle.h:119
casacore::TaQLStyle::setTracing
void setTracing(Bool doTracing)
Set if tracing needs to be done.
Definition TaQLStyle.h:109
casacore::TaQLStyle::itsDoTiming
Bool itsDoTiming
Definition TaQLStyle.h:120
casacore::TaQLStyle::defineSynonym
void defineSynonym(const String &command)
Set a synonym using a command like 'synonym = udflibname'.
casacore::TaQLStyle::isEndExcl
Bool isEndExcl() const
Definition TaQLStyle.h:94
casacore::TaQLStyle::setTiming
void setTiming(Bool doTiming)
Set if timing needs to be done.
Definition TaQLStyle.h:101
casacore::TaQLStyle::doTiming
Bool doTiming() const
Should timing be done?
Definition TaQLStyle.h:105
casacore::TaQLStyle::itsOrigin
uInt itsOrigin
Definition TaQLStyle.h:117
casacore::TaQLStyle::defineSynonym
void defineSynonym(const String &synonym, const String &udfLibName)
Define a UDF library name synonym.
casacore::TaQLStyle::itsUDFLibNameMap
std::map< String, String > itsUDFLibNameMap
Definition TaQLStyle.h:122
casacore::TaQLStyle::origin
uInt origin() const
Get the various style values.
Definition TaQLStyle.h:92
casacore::TaQLStyle::isCOrder
Bool isCOrder() const
Definition TaQLStyle.h:96
casacore::TaQLStyle::TaQLStyle
TaQLStyle(uInt origin=1)
Default style is Glish and no timing/tracing.
casacore::TaQLStyle::itsEndExcl
Bool itsEndExcl
Definition TaQLStyle.h:118
casacore::TaQLStyle::reset
void reset()
Reset to the default Glish style and no timing/tracing.
casacore::TaQLStyle::findSynonym
String findSynonym(const String &synonym) const
Find the UDF library name belonging to a synonym.
casacore
this file contains all the compiler specific defines
Definition mainpage.dox:28
casacore::uInt
unsigned int uInt
Definition aipstype.h:49
casacore::Bool
bool Bool
Define the standard types used by Casacore.
Definition aipstype.h:40
casacore::value
NewDelAllocator< T > NewDelAllocator< T >::value
Definition Allocator.h:369