casacore
Loading...
Searching...
No Matches
StokesIStMan.h
Go to the documentation of this file.
1#ifndef CASACORE_STOKES_I_STORAGE_MANAGER_H_
2#define CASACORE_STOKES_I_STORAGE_MANAGER_H_
3
4#include <casacore/tables/DataMan/DataManager.h>
5
6#include <casacore/casa/Containers/Record.h>
7
9
10#ifndef DOXYGEN_SHOULD_SKIP_THIS
11extern "C" {
12#endif
14#ifndef DOXYGEN_SHOULD_SKIP_THIS
15}
16#endif
17
18namespace casacore {
19
21
26class StokesIStMan final : public casacore::DataManager {
27 public:
38
43 StokesIStMan(const StokesIStMan &source);
44
45 ~StokesIStMan() noexcept;
46
51 StokesIStMan &operator=(const StokesIStMan &source) = delete;
52
53 casacore::DataManager *clone() const final { return new StokesIStMan(*this); }
63 const casacore::Record &spec) {
64 return new StokesIStMan(name, spec);
65 }
66
67 casacore::String dataManagerType() const final { return "StokesIStMan"; }
68
70
71 casacore::Bool canAddRow() const final { return true; }
72
73 casacore::Bool canRemoveRow() const final { return true; }
74
75 casacore::Bool canAddColumn() const final { return true; }
76
77 casacore::Bool canRemoveColumn() const final { return true; }
78
82 static void registerClass();
83
84 protected:
85 private:
86 friend class StokesIStManColumn;
87
89
90 casacore::Bool flush(casacore::AipsIO &, [[maybe_unused]] casacore::Bool doFsync) final {
91 return false;
92 }
93
94 // Let the storage manager create files as needed for a new table.
95 // This allows a column with an indirect array to create its file.
96 void create64(casacore::rownr_t nRow) final;
97
98 // Open the storage manager file for an existing table.
99 // Return the number of rows in the data file.
101
102 // Create a column in the storage manager on behalf of a table column.
103 // The caller will NOT delete the newly created object.
104 // Create a scalar column.
106 const casacore::String &dataTypeID) final;
107
108 // Create a direct array column.
110 const casacore::String &dataTypeID) final;
111
112 // Create an indirect array column.
114 const casacore::String &dataTypeID) final;
115
117
118 void deleteManager() final;
119
120 // Prepare the columns, let the data manager initialize itself further.
121 // Prepare is called after create/open has been called for all
122 // columns. In this way one can be sure that referenced columns
123 // are read back and partly initialized.
124 void prepare() final;
125
126 // Reopen the storage manager files for read/write.
127 void reopenRW() final;
128
129 // Add rows to the storage manager.
130 void addRow64(casacore::rownr_t nrrow) final;
131
132 // Delete a row from all columns.
133 void removeRow64(casacore::rownr_t row_nr) final;
134
135 // Do the final addition of a column.
137
138 // Remove a column from the data file.
140
141 std::string name_;
142 // The item-type needs to be a pointer, because casacore::StManColumn
143 // does not have move construct/assignment.
144 std::vector<std::unique_ptr<StokesIStManColumn>> columns_;
146 constexpr static size_t kHeaderSize = 8;
147 constexpr static const char kMagicHeaderTag[8] = "StkIcol";
148};
149
150} // namespace casacore
151
152#endif
void register_stokesistman()
Abstract base class for a data manager.
DataManager()
Default constructor.
Base class for columns of the StokesIStMan.
casacore::DataManagerColumn * makeDirArrColumn(const casacore::String &name, int dataType, const casacore::String &dataTypeID) final
Create a direct array column.
casacore::Bool flush(casacore::AipsIO &, casacore::Bool doFsync) final
Flush and optionally fsync the data.
casacore::DataManagerColumn * makeIndArrColumn(const casacore::String &name, int dataType, const casacore::String &dataTypeID) final
Create an indirect array column.
StokesIStMan(const StokesIStMan &source)
Copy constructor that initializes a storage manager with similar specs.
static constexpr size_t kHeaderSize
casacore::DataManager * clone() const final
Make a clone of the derived object.
casacore::rownr_t resync64(casacore::rownr_t nRow) final
Resync the data by rereading cached data from the file.
void reopenRW() final
Reopen the storage manager files for read/write.
StokesIStMan(const casacore::String &name, const casacore::Record &spec)
This constructor is called by Casacore when it needs to create a StokesIStMan.
casacore::String dataManagerType() const final
Return the type name of the data manager (in fact its class name).
void prepare() final
Prepare the columns, let the data manager initialize itself further.
static constexpr const char kMagicHeaderTag[8]
casacore::Record dataManagerSpec() const final
Return a record containing data manager specifications.
void removeRow64(casacore::rownr_t row_nr) final
Delete a row from all columns.
friend class StokesIStManColumn
casacore::DataManagerColumn * makeScalarColumn(const casacore::String &name, int dataType, const casacore::String &dataTypeID) final
Create a column in the storage manager on behalf of a table column.
casacore::Bool canRemoveColumn() const final
Does the data manager allow to delete columns?
void create64(casacore::rownr_t nRow) final
Let the storage manager create files as needed for a new table.
static casacore::DataManager * makeObject(const casacore::String &name, const casacore::Record &spec)
Create an object with given name and spec.
void addRow64(casacore::rownr_t nrrow) final
Add rows to the storage manager.
casacore::Bool canRemoveRow() const final
Does the data manager allow to delete rows?
static void registerClass()
This function makes the StokesIStMan known to Casacore.
void deleteManager() final
The data manager will be deleted (because all its columns are requested to be deleted).
casacore::Bool canAddRow() const final
Does the data manager allow to add rows?
void removeColumn(casacore::DataManagerColumn *) final
Remove a column from the data file.
BufferedColumnarFile file_
uint64_t CalculateAndUpdateStride()
void addColumn(casacore::DataManagerColumn *) final
Do the final addition of a column.
casacore::rownr_t open64(casacore::rownr_t nRow, casacore::AipsIO &) final
Open the storage manager file for an existing table.
casacore::Bool canAddColumn() const final
Does the data manager allow to add columns?
std::vector< std::unique_ptr< StokesIStManColumn > > columns_
The item-type needs to be a pointer, because casacore::StManColumn does not have move construct/assig...
String: the storage and methods of handling collections of characters.
Definition String.h:355
bool Bool
Define the standard types used by Casacore.
uInt64 rownr_t
Define the type of a row number in a table.
For temporary backward namespace compatibility, use casa as alias for casacore.
Definition mainpage.dox:28
String name() const
Return the name of the field.
bool Bool
Define the standard types used by Casacore.
Definition aipstype.h:40
VarBufferedColumnarFile< 100 *1024 > BufferedColumnarFile
uInt64 rownr_t
Define the type of a row number in a table.
Definition aipsxtype.h:44
DataType dataType(const RecordFieldId &) const
Define real & complex conjugation for non-complex types and put comparisons into std namespace.
Definition Complex.h:344