casacore
Loading...
Searching...
No Matches
TaQLStyle.h
Go to the documentation of this file.
1//# TaQLStyle.h: Class with static members defining the TaQL style
2//# Copyright (C) 2006
3//# Associated Universities, Inc. Washington DC, USA.
4//#
5//# This library is free software; you can redistribute it and/or modify it
6//# under the terms of the GNU Library General Public License as published by
7//# the Free Software Foundation; either version 2 of the License, or (at your
8//# option) any later version.
9//#
10//# This library is distributed in the hope that it will be useful, but WITHOUT
11//# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
12//# FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public
13//# License for more details.
14//#
15//# You should have received a copy of the GNU Library General Public License
16//# along with this library; if not, write to the Free Software Foundation,
17//# Inc., 675 Massachusetts Ave, Cambridge, MA 02139, USA.
18//#
19//# Correspondence concerning AIPS++ should be addressed as follows:
20//# Internet email: casa-feedback@nrao.edu.
21//# Postal address: AIPS++ Project Office
22//# National Radio Astronomy Observatory
23//# 520 Edgemont Road
24//# Charlottesville, VA 22903-2475 USA
25
26#ifndef TABLES_TAQLSTYLE_H
27#define TABLES_TAQLSTYLE_H
28
29//# Includes
30#include <casacore/casa/aips.h>
31#include <casacore/casa/BasicSL/String.h>
32#include <casacore/casa/stdmap.h>
33
34namespace casacore { //# NAMESPACE CASACORE - BEGIN
35
36// <summary>
37// Class with static members defining the TaQL style.
38// </summary>
39
40// <use visibility=local>
41
42// <reviewed reviewer="" date="" tests="">
43// </reviewed>
44
45// <synopsis>
46// Originally TaQL was developed to use the Glish style of indexing.
47// This meant 1-based indices, axes in Fortran order, and end is inclusive
48// in start:end.
49// On the other hand the Python style is the opposite.
50// In order to let the user choose between styles, one can define the
51// style in a TaQL command.
52// The default style is Glish.
53//
54// The class is also used to tell the TaQL execution engine if timings
55// or tracing of the various parts of the TaQL command need to be done.
56//
57// Finally it is possible to define synonyms for UDF library names.
58// For example, 'derivedmscal' is a lot to type, so a synonym 'mscal'
59// (or even 'mc') can be defined for it.
60// </synopsis>
61
63{
64public:
65 // Default style is Glish and no timing/tracing.
66 explicit TaQLStyle (uInt origin=1);
67
68 // Reset to the default Glish style and no timing/tracing.
69 void reset();
70
71 // Set the style according to the (case-insensitive) value.
72 // Possible values are Glish, Python, Base0, Base1, FortranOrder, Corder,
73 // InclEnd, and ExclEnd.
74 void set (const String& value);
75
76 // Define a UDF library name synonym.
77 // The synonym name is always converted to lowercase because TaQL always
78 // uses lowercase to lookup functions. The library name kept as is making
79 // it possible to use a library containing uppercase characters.
80 // If the synonym already exists, it is redefined.
81 void defineSynonym (const String& synonym, const String& udfLibName);
82
83 // Set a synonym using a command like 'synonym = udflibname'.
84 void defineSynonym (const String& command);
85
86 // Find the UDF library name belonging to a synonym.
87 // If undefined, the synonym itself is returned.
88 String findSynonym (const String& synonym) const;
89
90 // Get the various style values.
91 // <group>
92 uInt origin() const
93 { return itsOrigin; }
95 { return itsEndExcl; }
96 Bool isCOrder() const
97 { return itsCOrder; }
98 // </group>
99
100 // Set if timing needs to be done.
103
104 // Should timing be done?
106 { return itsDoTiming; }
107
108 // Set if tracing needs to be done.
111
112 // Should tracing be done?
114 { return itsDoTracing; }
115
116private:
122 std::map<String,String> itsUDFLibNameMap;
123};
124
125
126} //# NAMESPACE CASACORE - END
127
128#endif
String: the storage and methods of handling collections of characters.
Definition String.h:223
Bool doTracing() const
Should tracing be done?
Definition TaQLStyle.h:113
void set(const String &value)
Set the style according to the (case-insensitive) value.
void setTracing(Bool doTracing)
Set if tracing needs to be done.
Definition TaQLStyle.h:109
void defineSynonym(const String &command)
Set a synonym using a command like 'synonym = udflibname'.
Bool isEndExcl() const
Definition TaQLStyle.h:94
void setTiming(Bool doTiming)
Set if timing needs to be done.
Definition TaQLStyle.h:101
Bool doTiming() const
Should timing be done?
Definition TaQLStyle.h:105
void defineSynonym(const String &synonym, const String &udfLibName)
Define a UDF library name synonym.
std::map< String, String > itsUDFLibNameMap
Definition TaQLStyle.h:122
uInt origin() const
Get the various style values.
Definition TaQLStyle.h:92
Bool isCOrder() const
Definition TaQLStyle.h:96
TaQLStyle(uInt origin=1)
Default style is Glish and no timing/tracing.
void reset()
Reset to the default Glish style and no timing/tracing.
String findSynonym(const String &synonym) const
Find the UDF library name belonging to a synonym.
this file contains all the compiler specific defines
Definition mainpage.dox:28
unsigned int uInt
Definition aipstype.h:49
bool Bool
Define the standard types used by Casacore.
Definition aipstype.h:40
LatticeExprNode value(const LatticeExprNode &expr)
This function returns the value of the expression without a mask.