TaQLStyle.h

Go to the documentation of this file.
00001 //# TaQLStyle.h: Class with static members defining the TaQL style
00002 //# Copyright (C) 2006
00003 //# Associated Universities, Inc. Washington DC, USA.
00004 //#
00005 //# This library is free software; you can redistribute it and/or modify it
00006 //# under the terms of the GNU Library General Public License as published by
00007 //# the Free Software Foundation; either version 2 of the License, or (at your
00008 //# option) any later version.
00009 //#
00010 //# This library is distributed in the hope that it will be useful, but WITHOUT
00011 //# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
00012 //# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Library General Public
00013 //# License for more details.
00014 //#
00015 //# You should have received a copy of the GNU Library General Public License
00016 //# along with this library; if not, write to the Free Software Foundation,
00017 //# Inc., 675 Massachusetts Ave, Cambridge, MA 02139, USA.
00018 //#
00019 //# Correspondence concerning AIPS++ should be addressed as follows:
00020 //#        Internet email: aips2-request@nrao.edu.
00021 //#        Postal address: AIPS++ Project Office
00022 //#                        National Radio Astronomy Observatory
00023 //#                        520 Edgemont Road
00024 //#                        Charlottesville, VA 22903-2475 USA
00025 //#
00026 //# $Id$
00027 
00028 #ifndef TABLES_TAQLSTYLE_H
00029 #define TABLES_TAQLSTYLE_H
00030 
00031 //# Includes
00032 #include <casacore/casa/aips.h>
00033 #include <casacore/casa/BasicSL/String.h>
00034 #include <casacore/casa/stdmap.h>
00035 
00036 namespace casacore { //# NAMESPACE CASACORE - BEGIN
00037 
00038 // <summary>
00039 // Class with static members defining the TaQL style.
00040 // </summary>
00041 
00042 // <use visibility=local>
00043 
00044 // <reviewed reviewer="" date="" tests="">
00045 // </reviewed>
00046 
00047 // <synopsis>
00048 // Originally TaQL was developed to use the Glish style of indexing.
00049 // This meant 1-based indices, axes in Fortran order, and end is inclusive
00050 // in start:end.
00051 // On the other hand the Python style is the opposite.
00052 // In order to let the user choose between styles, one can define the
00053 // style in a TaQL command.
00054 // The default style is Glish.
00055 //
00056 // The class is also used to tell the TaQL execution engine if timings
00057 // or tracing of the various parts of the TaQL command need to be done.
00058 //
00059 // Finally it is possible to define synonyms for UDF library names.
00060 // For example, 'derivedmscal' is a lot to type, so a synonym 'mscal'
00061 // (or even 'mc') can be defined for it.
00062 // </synopsis> 
00063 
00064 class TaQLStyle
00065 {
00066 public:
00067   // Default style is Glish and no timing/tracing.
00068   explicit TaQLStyle (uInt origin=1);
00069 
00070   // Reset to the default Glish style and no timing/tracing.
00071   void reset();
00072 
00073   // Set the style according to the (case-insensitive) value.
00074   // Possible values are Glish, Python, Base0, Base1, FortranOrder, Corder,
00075   // InclEnd, and ExclEnd.
00076   void set (const String& value);
00077 
00078   // Define a UDF library name synonym.
00079   // The synonym name is always converted to lowercase because TaQL always
00080   // uses lowercase to lookup functions. The library name kept as is making
00081   // it possible to use a library containing uppercase characters.
00082   // If the synonym already exists, it is redefined.
00083   void defineSynonym (const String& synonym, const String& udfLibName);
00084 
00085   // Set a synonym using a command like 'synonym = udflibname'.
00086   void defineSynonym (const String& command);
00087 
00088   // Find the UDF library name belonging to a synonym.
00089   // If undefined, the synonym itself is returned.
00090   String findSynonym (const String& synonym) const;
00091 
00092   // Get the various style values.
00093   // <group>
00094   uInt origin() const
00095     { return itsOrigin; }
00096   Bool isEndExcl() const
00097     { return itsEndExcl; }
00098   Bool isCOrder() const
00099     { return itsCOrder; }
00100   // </group>
00101 
00102   // Set if timing needs to be done.
00103   void setTiming (Bool doTiming)
00104     { itsDoTiming = doTiming; }
00105 
00106   // Should timing be done?
00107   Bool doTiming() const
00108     { return itsDoTiming; }
00109 
00110   // Set if tracing needs to be done.
00111   void setTracing (Bool doTracing)
00112     { itsDoTracing = doTracing; }
00113 
00114   // Should tracing be done?
00115   Bool doTracing() const
00116     { return itsDoTracing; }
00117 
00118 private:
00119   uInt itsOrigin;
00120   Bool itsEndExcl;
00121   Bool itsCOrder;
00122   Bool itsDoTiming;
00123   Bool itsDoTracing;
00124   std::map<String,String> itsUDFLibNameMap;
00125 };
00126 
00127 
00128 } //# NAMESPACE CASACORE - END
00129 
00130 #endif
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines

Generated on 31 Aug 2016 for casa by  doxygen 1.6.1