casacore
Loading...
Searching...
No Matches
TableParseUtil.h
Go to the documentation of this file.
1//# TableParseUtil.h: Convenience functions for TableParse classes
2//# Copyright (C) 1994-2022
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_TABLEPARSEUTIL_H
27#define TABLES_TABLEPARSEUTIL_H
28
29//# Includes
30#include <casacore/casa/aips.h>
31#include <casacore/tables/Tables/Table.h>
32#include <vector>
33
34namespace casacore { //# NAMESPACE CASACORE - BEGIN
35
36 //# Forward declarations
37 class TableParseQuery;
38
39 // <summary>
40 // Convenience functions for TableParse classes
41 // </summary>
42
43 // <use visibility=local>
44
45 // <reviewed reviewer="UNKNOWN" date="before2004/08/25" tests="">
46 // </reviewed>
47
48 // <synopsis>
49 // This file contains several static helper functions for TableParse.
50 // They handle splitting a name into its shorthand, column and/or keyword
51 // parts. A name can be given as
52 // <src>shorthand.column::key.subkey1.subkey2...</src>
53 // where each part is optional.
54 // It also has functions to find the given table, column and keyword.
55 // </synopsis>
56
57 namespace TableParseUtil
58 {
59 // Make a Table object for given name, seqnr or so.
60 // If <src>alwaysOpen=False</src> the table will only be looked up,
61 // but not opened if not found. This is meant for concatenated tables
62 // in TaQLNodeHandler.
63 Table getTable (Int tabnr, const String& name,
64 const Table& ftab,
65 const std::vector<const Table*>& tempTables,
66 const std::vector<TableParseQuery*>& stack,
67 Bool alwaysOpen=True);
68
69 // Open the parent table of a subtable.
70 Table openParentTable (const String& fullName,
71 const String& subTableName,
72 const std::vector<const Table*>& tempTables,
73 const std::vector<TableParseQuery*>& stack);
74
75 // Split a name into its parts (shorthand, column and field names).
76 // A name can be given as
77 // <src>[shorthand][column][::key1.key2.key3...]</src> where the
78 // square brackets indicate optional parts. Note that a single name given
79 // before :: is interpreted as a shorthand unless preceded by a period.
80 // <br>True is returned if the name contains a keyword part.
81 // In that case fieldNames contains the keyword name and the possible
82 // subfields. The possible shorthand and the column name are
83 // filled in if it is a column keyword.
84 // If the name contains a column, fieldNames is filled with the subfields
85 // of the column (for the case where the column contains records).
86 // <br>If isKeyword is True, the first part of name is a keyword,
87 // even if no :: is given.
88 // If allowNoKey is True, a single :: is allowed, otherwise the name is invalid.
89 // If the name is invalid, exceptions are only thrown if checkError=True.
90 // Otherwise the name is treated as a normal name without keyword.
91 Bool splitName (String& shorthand, String& columnName,
92 Vector<String>& fieldNames, const String& name,
93 Bool checkError, Bool isKeyword, Bool allowNoKey);
94
95 // Define a field with the given data type in the Record.
96 void setRecFld (RecordInterface& rec, const String& name,
97 const String& dtype, const ValueHolder& vh);
98
99 // Get the type string. If empty, it is made from the given
100 // data type.
101 String getTypeString (const String& typeStr, DataType type);
102
103 // Find the names of all stored columns in a table.
105
106 // Make an array from the contents of a column in a subquery.
108 }
109
110
111} //# NAMESPACE CASACORE - END
112
113#endif
simple 1-D array
Definition Block.h:198
String: the storage and methods of handling collections of characters.
Definition String.h:223
String getTypeString(const String &typeStr, DataType type)
Get the type string.
Bool splitName(String &shorthand, String &columnName, Vector< String > &fieldNames, const String &name, Bool checkError, Bool isKeyword, Bool allowNoKey)
Split a name into its parts (shorthand, column and field names).
Table openParentTable(const String &fullName, const String &subTableName, const std::vector< const Table * > &tempTables, const std::vector< TableParseQuery * > &stack)
Open the parent table of a subtable.
TableExprNode getColSet(const Table &table)
Make an array from the contents of a column in a subquery.
Block< String > getStoredColumns(const Table &tab)
Find the names of all stored columns in a table.
void setRecFld(RecordInterface &rec, const String &name, const String &dtype, const ValueHolder &vh)
Define a field with the given data type in the Record.
Table getTable(Int tabnr, const String &name, const Table &ftab, const std::vector< const Table * > &tempTables, const std::vector< TableParseQuery * > &stack, Bool alwaysOpen=True)
Make a Table object for given name, seqnr or so.
this file contains all the compiler specific defines
Definition mainpage.dox:28
int Int
Definition aipstype.h:48
bool Bool
Define the standard types used by Casacore.
Definition aipstype.h:40
const Bool True
Definition aipstype.h:41