MultiFile.h
1 //-*-C++-*-
2 /***************************************************************************
3  *
4  * Copyright (C) 2023 by Willem van Straten
5  * Licensed under the Academic Free License version 2.1
6  *
7  ***************************************************************************/
8 
9 // dspsr/Kernel/Classes/dsp/MultiFile.h
10 
11 #ifndef __dsp_Kernel_Classes_MultiFile_h
12 #define __dsp_Kernel_Classes_MultiFile_h
13 
14 #include "dsp/File.h"
15 
16 namespace dsp {
17 
19  class MultiFile : public File {
20 
21  public:
22 
24  MultiFile (const char* name = "MultiFile");
25 
27  virtual ~MultiFile ();
28 
30  bool is_valid (const char* filename) const;
31 
33  bool validate_filenames (std::vector<std::string>& filenames, const char* metafile) const;
34 
36  virtual void open_file (const char* filename);
37 
39  virtual void open (const std::vector<std::string>& new_filenames);
40 
42  const std::vector<std::string>& get_filenames() const { return filenames; }
43 
45  unsigned nfiles() { return files.size(); }
46 
47  protected:
48 
50  std::vector< Reference::To<File> > files;
51 
53  std::vector<std::string> filenames;
54 
56  virtual void after_open (File*);
57 
59  virtual void setup ();
60 
61  };
62 
63 } // namespace dsp
64 
65 #endif // !defined(__dsp_Kernel_Classes_MultiFile_h)
66 
Contains all Baseband Data Reduction Library classes.
Definition: ASCIIObservation.h:17
static File * create(const char *filename)
Return a pointer to a new instance of the appropriate sub-class.
Definition: File.C:67
virtual void after_open(File *)
Operation performed on each File instance after it is opened.
Definition: MultiFile.C:126
Loads BitSeries data from file.
Definition: File.h:38
std::string name
Operation name.
Definition: Operation.h:153
virtual void open(const std::vector< std::string > &new_filenames)
Open a number of files and treat them as one logical observation composed of multiple parallel stream...
Definition: MultiFile.C:95
const std::vector< std::string > & get_filenames() const
Get the names of the loaded files.
Definition: MultiFile.h:52
virtual void setup()
Called at the end of open method, after all File instances are opened.
Definition: MultiFile.C:131
File(const char *name)
Constructor.
Definition: File.C:34
unsigned nfiles()
Inquire the number of files.
Definition: MultiFile.h:55
std::vector< std::string > filenames
Name of the currently opened file.
Definition: MultiFile.h:63
std::string get_filename() const
Return the name of the file from which this instance was created.
Definition: File.h:86
bool validate_filenames(std::vector< std::string > &filenames, const char *metafile) const
Return validated filenames loaded from metafile.
Definition: MultiFile.C:38
bool is_valid(const char *filename) const
Returns true if filename is an ASCII file listing valid filenames.
Definition: MultiFile.C:29
virtual void open_file(const char *filename)
Open the files listed in the provided ASCII file.
Definition: MultiFile.C:82
MultiFile(const char *name="MultiFile")
Constructor.
Definition: MultiFile.C:20
virtual ~MultiFile()
Destructor.
Definition: MultiFile.C:24
std::vector< Reference::To< File > > files
List of files.
Definition: MultiFile.h:60

Generated using doxygen 1.8.17