casa  5.7.0-16
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
FlagVersion.h
Go to the documentation of this file.
1 //# FlagVersions.h: Maintain and manage different flag versions.
2 //# Copyright (C) 1994,1995,1996,1997,1998,1999,2000,2001,2002,2003
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 receied 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: aips2-request@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 //# $Id$
27 //#
28 //# ----------------------------------------------------------------------------
29 //# Change Log
30 //# ----------------------------------------------------------------------------
31 //# Date Name Comments
32 //#
33 
34 
35 #ifndef FLAGVERSION_H
36 #define FLAGVERSION_H
37 
38 //# Includes
39 
40 #include <casa/OS/Timer.h>
41 #include <casa/OS/File.h>
42 
43 #include <tables/Tables/Table.h>
47 
48 //# FlagVersion Change Log
49 //# =======================
50 //# Date Name Description
51 //# April 20 2007 Urvashi R.V. Created this class.
52 //# Aug 23 2007 Urvashi R.V. Added Documentation.
53 //# Oct 29 2007 Shannon J. Switched how msg logging was done.
54 
55 namespace casa { //# NAMESPACE CASA - BEGIN
56 
57 class SLog;
58 
59 // <summary>
60 // Class to generate and manage flag versions for Tables containing flag columns.
61 // </summary>
62 
63 // <reviewed reviewer="" date="" tests="">
64 // </reviewed>
65 
66 // <prerequisite>
67 // <li> casacore::Table
68 // </prerequisite>
69 
70 // <etymology>
71 // Manages Flag Versions.
72 // </etymology>
73 
74 // <synopsis>
75 // This class creates and manages flag versions. A flag version as defined in this
76 // class has the following structure.
77 //
78 // xxxx.ms
79 // xxxx.ms.flagversions
80 //
81 // When first opened, a flagversions directory is created parallel to the original Table.
82 // This directory contains a text file : FLAG_VERSION_LIST that holds a list of string pairs
83 // version name : comment for this version.
84 //
85 // The FLAG and FLAG_ROW columns of the main table are copied into new Tables with only two
86 // columns, whenever a new flag version is created. Flag versions can be merged using
87 // logical 'and', logical 'or', and 'replace' semantics. Flag versions can be restored to
88 // the main table of the MS.
89 //
90 // At the end of a "save" or "restore" operation, the latest flags are always also in
91 // the main table.
92 //
93 // </synopsis>
94 
95 // <motivation>
96 //
97 // </motivation>
98 
99 // <thrown>
100 // <li>
101 // <li>
102 // </thrown>
103 
104 
105 // <todo asof="$DATE:$">
106 // <li>
107 // </todo>
108 
109 
111 {
112  public:
113  // Constructor
114  FlagVersion(casacore::String intab, casacore::String dataflagcolname, casacore::String rowflagcolname);
115 
116  // Destructor
117  virtual ~FlagVersion();
118 
119  // Operator=
120  // Equate by reference.
121  FlagVersion& operator=(const FlagVersion&){return *this;}
122 
123  // Get a list of entries from the version-list file for this table
125 
126  // Specify the casacore::Table column names to use as flag columns.
127  // For example, for a casacore::MS, they are "FLAG" and "FLAG_ROW".
130 
131  // Save current main table flags into a separate version
132  // These keeps a copy in the main table too.
133  // "merge" can be one of 'or','and','replace'
135  casacore::String merge=casacore::String("replace") );
136 
137  // Copy flags from a flag version, into the main table
139  casacore::String merge=casacore::String("replace") );
140 
141  // Delete a version. This does not touch or update the main table
143 
144  // Clear all main table flags
146 
147  private:
149 
152  casacore::String merge = casacore::String("replace"));
154 
155  /* Variables to be maintained for the root casacore::Table */
160 
166  unsigned nrows_p;
167 
169 
171 
174 };
175 
176 } //# NAMESPACE CASA - END
177 
178 //#ifndef AIPS_NO_TEMPLATE_SRC
179 //#include <tableplot/TablePlot/FlagVersion.tcc>
180 //#endif //# AIPS_NO_TEMPLATE_SRC
181 #endif
182 
casacore::Table tab_p
Definition: FlagVersion.h:161
casacore::String rowflagcolname_p
Definition: FlagVersion.h:159
Main interface class to a read/write table.
Definition: Table.h:153
casacore::Bool attachFlagColumns(casacore::String version, casacore::ScalarColumn< casacore::Bool > &rowflag, casacore::ArrayColumn< casacore::Bool > &flags, casacore::Table &subtab)
Specify the casacore::Table column names to use as flag columns.
casacore::Bool frcol_p
Definition: FlagVersion.h:165
casacore::String verlistfile_p
Definition: FlagVersion.h:156
casacore::Vector< casacore::String > versionlist_p
Definition: FlagVersion.h:163
void FlagVersionError(casacore::String msg)
casacore::Bool saveFlagsInto(casacore::Table &fromFTab, casacore::Table &toFTab, casacore::String merge=casacore::String("replace"))
virtual ~FlagVersion()
Destructor.
casacore::Bool saveFlagVersion(casacore::String versionname, casacore::String comment, casacore::String merge=casacore::String("replace"))
Save current main table flags into a separate version These keeps a copy in the main table too...
casacore::Bool doesVersionExist(casacore::String versionname)
static casacore::String clname
Definition: FlagVersion.h:173
casacore::String flagtablename_p
Definition: FlagVersion.h:157
casacore::Bool readVersionList()
casacore::Bool clearAllFlags()
Clear all main table flags.
Class to get file information and a base for other file classes.
Definition: File.h:101
FlagVersion & operator=(const FlagVersion &)
Operator= Equate by reference.
Definition: FlagVersion.h:121
casacore::Vector< casacore::String > getVersionList()
Get a list of entries from the version-list file for this table.
bool Bool
Define the standard types used by Casacore.
Definition: aipstype.h:42
casacore::File file_p
Definition: FlagVersion.h:170
Class to generate and manage flag versions for Tables containing flag columns.
Definition: FlagVersion.h:110
casacore::String tabname_p
Definition: FlagVersion.h:162
FlagVersion(casacore::String intab, casacore::String dataflagcolname, casacore::String rowflagcolname)
Constructor.
String: the storage and methods of handling collections of characters.
Definition: String.h:223
casacore::Table subflagtable_p
Definition: FlagVersion.h:168
casacore::Bool deleteFlagVersion(casacore::String versionname)
Delete a version.
casacore::Bool fcol_p
Definition: FlagVersion.h:165
casacore::Vector< casacore::String > commentlist_p
Definition: FlagVersion.h:164
casacore::Bool restoreFlagVersion(casacore::String versionname, casacore::String merge=casacore::String("replace"))
Copy flags from a flag version, into the main table.
casacore::String dataflagcolname_p
Definition: FlagVersion.h:158