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
62class TaQLStyle {
63 public:
64 // Default style is Glish and no timing/tracing.
65 explicit TaQLStyle(uInt origin = 1);
66
67 // Reset to the default Glish style and no timing/tracing.
68 void reset();
69
70 // Set the style according to the (case-insensitive) value.
71 // Possible values are Glish, Python, Base0, Base1, FortranOrder, Corder,
72 // InclEnd, and ExclEnd.
73 void set(const String& value);
74
75 // Define a UDF library name synonym.
76 // The synonym name is always converted to lowercase because TaQL always
77 // uses lowercase to lookup functions. The library name kept as is making
78 // it possible to use a library containing uppercase characters.
79 // If the synonym already exists, it is redefined.
80 void defineSynonym(const String& synonym, const String& udfLibName);
81
82 // Set a synonym using a command like 'synonym = udflibname'.
83 void defineSynonym(const String& command);
84
85 // Find the UDF library name belonging to a synonym.
86 // If undefined, the synonym itself is returned.
87 String findSynonym(const String& synonym) const;
88
89 // Get the various style values.
90 // <group>
91 uInt origin() const { return itsOrigin; }
92 Bool isEndExcl() const { return itsEndExcl; }
93 Bool isCOrder() const { return itsCOrder; }
94 // </group>
95
96 // Set if timing needs to be done.
98
99 // Should timing be done?
100 Bool doTiming() const { return itsDoTiming; }
101
102 // Set if tracing needs to be done.
104
105 // Should tracing be done?
106 Bool doTracing() const { return itsDoTracing; }
107
108 private:
114 std::map<String, String> itsUDFLibNameMap;
115};
116
117} // namespace casacore
118
119#endif
String: the storage and methods of handling collections of characters.
Definition String.h:355
Bool doTracing() const
Should tracing be done?
Definition TaQLStyle.h:106
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:103
void defineSynonym(const String &command)
Set a synonym using a command like 'synonym = udflibname'.
Bool isEndExcl() const
Definition TaQLStyle.h:92
void setTiming(Bool doTiming)
Set if timing needs to be done.
Definition TaQLStyle.h:97
Bool doTiming() const
Should timing be done?
Definition TaQLStyle.h:100
void defineSynonym(const String &synonym, const String &udfLibName)
Define a UDF library name synonym.
uInt origin() const
Get the various style values.
Definition TaQLStyle.h:91
Bool isCOrder() const
Definition TaQLStyle.h:93
TaQLStyle(uInt origin=1)
Default style is Glish and no timing/tracing.
std::map< String, String > itsUDFLibNameMap
Definition TaQLStyle.h:114
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.
For temporary backward namespace compatibility, use casa as alias for casacore.
Definition mainpage.dox:28
unsigned int uInt
Definition aipstype.h:49
bool Bool
Define the standard types used by Casacore.
Definition aipstype.h:40
NewDelAllocator< T > NewDelAllocator< T >::value
Definition Allocator.h:360