casacore
StorageOption.h
Go to the documentation of this file.
1 //# StorageOption.h: Options defining how table files are organized
2 //# Copyright (C) 2014
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: StorageOption.h 20859 2010-02-03 13:14:15Z gervandiepen $
27 
28 #ifndef TABLES_STORAGEOPTION_H
29 #define TABLES_STORAGEOPTION_H
30 
31 
32 //# Includes
33 #include <casacore/casa/aips.h>
34 
35 namespace casacore { //# NAMESPACE CASACORE - BEGIN
36 
37 // <summary>
38 // Options defining how table files are organized
39 // </summary>
40 
41 // <use visibility=export>
42 
43 // <reviewed reviewer="TPPR" date="08.11.94" tests="tTable.cc">
44 // </reviewed>
45 
46 // <synopsis>
47 // This class can be used to define how the files of a table are organized.
48 // There are two ways:
49 // <ol>
50 // <li> The old way where each storage manager has its own file(s).
51 // <li> Using MultiFile that storage managers can use to combine about all
52 // table files in a single file. This mode is particularly useful
53 // for new file systems (like Lustre) requiring large block sizes.
54 // <br>The block size to be used in a MultiFile can be defined in
55 // this class. Default is 4 MByte.
56 // <li> Using MultiHDF5 which behaves similar to MultiFile but uses an
57 // HDF5 file instead of a regular file. Note that it requires that
58 // support for HDF5 has been used in the build system.
59 // </ol>
60 // It is possible to specify the storage type and block size using aipsrc.
61 // The aipsrc variables are:
62 // <ul>
63 // <li> <src>table.storage.option</src>. The (case-insensitive) value can be
64 // 'multifile' or 'multihdf5'.
65 // Another value means the old way (separate files).
66 // <li> <src>table.storage.blocksize</src> gives the default blocksize to be
67 // used for the multifile and multihdf5 option.
68 // <li> <src>table.storage.odirect</src> can be true or false. It tells if the
69 // O_DIRECT option has to be used to let the kernel bypass its filecache
70 // for more predictable I/O behaviour. It's only used for MultiFile and
71 // only if the OS supports O_DIRECT.
72 // </ul>
73 // </synopsis>
74 
75 
77  {
78  public:
79  // Define the possible options how table files are organized.
80  enum Option {
81  // Let storage managers use a combined MultiFile.
83  // Let storage managers use a combined MultiHDF5.
85  // Let storage managers use separate files.
87  // Use default (currently SepFile).
89  // Use as defined in the aipsrc file.
90  Aipsrc
91  };
92 
93  // Create an option object.
94  // The parameter values are described in the synopsis.
95  // The blocksize has to be given in bytes.
96  // A size value -2 means reading that size from the aipsrc file.
97  // A size value -1 means use the default of 4*1024*1024.
98  // <br>useODirect<0 means reading the option from the aipsrc file.
99  // It is only set if the OS supports O_DIRECT.
101 
102  // Fill the option in case Aipsrc or Default was given.
103  // It is done as explained in the synopsis.
104  void fillOption();
105 
106  // Get the option.
107  Option option() const
108  { return itsOption; }
109 
110  // Set the option.
112  { itsOption = option; }
113 
114  // Get the block size (in bytes).
115  uInt blockSize() const
116  { return itsBlockSize; }
117 
118  // Set the block size (in bytes).
120  { itsBlockSize = blockSize; }
121 
122  // Get the O_DIRECT option.
123  Bool useODirect() const
124  { return itsUseODirect; }
125 
126  // Set the O_DIRECT option.
127  // It is only set if the OS supports O_DIRECT.
129 
130  private:
135  };
136 
137 } //# NAMESPACE CASACORE - END
138 
139 #endif
StorageOption(Option option=Aipsrc, Int blockSize=-2, Int useODirect=-3)
Create an option object.
void fillOption()
Fill the option in case Aipsrc or Default was given.
void setOption(Option option)
Set the option.
Bool useODirect() const
Get the O_DIRECT option.
Option
Define the possible options how table files are organized.
Definition: StorageOption.h:80
@ MultiFile
Let storage managers use a combined MultiFile.
Definition: StorageOption.h:82
@ SepFile
Let storage managers use separate files.
Definition: StorageOption.h:86
@ MultiHDF5
Let storage managers use a combined MultiHDF5.
Definition: StorageOption.h:84
@ Default
Use default (currently SepFile).
Definition: StorageOption.h:88
uInt blockSize() const
Get the block size (in bytes).
void setBlockSize(Int blockSize)
Set the block size (in bytes).
void setUseODirect(Bool useODirect)
Set the O_DIRECT option.
Option option() const
Get the option.
this file contains all the compiler specific defines
Definition: mainpage.dox:28
unsigned int uInt
Definition: aipstype.h:51
int Int
Definition: aipstype.h:50
bool Bool
Define the standard types used by Casacore.
Definition: aipstype.h:42