VEventFile.cc
Go to the documentation of this file.
1 #include <io/VEventFile.h>
2 #include <utl/ErrorLogger.h>
3 #include <boost/filesystem/operations.hpp>
4 #include <boost/filesystem/path.hpp>
5 #include <iostream>
6 #include <fstream>
7 
8 using namespace std;
9 using namespace io;
10 using namespace utl;
11 namespace fs = boost::filesystem;
12 
13 
14 int
15 VEventFile::DefaultWrite(evt::Event& /*event*/)
16 {
17  if (fMode == eRead) {
18  ostringstream fat;
19  fat << "File " << fFilename << " is open for reading only.";
20  FATAL(fat);
21  return -1;
22  }
23 
24  // Do we want to check if it still exists?
25 
26  return 0;
27 }
28 
29 
30 int
31 VEventFile::DefaultOpen(const string& filename, const Mode mode)
32 {
33  // perform actions common to all open methods
34 
35 #if BOOST_FILESYSTEM_VERSION < 3
36  fs::path fullPath(filename.c_str(), fs::native);
37  fFilename = fullPath.native_file_string();
38 #else
39  fs::path fullPath(filename.c_str());
40  fullPath = fs::system_complete(fullPath);
41  fFilename = fullPath.c_str();
42 #endif
43 
44  fMode = mode;
45 
46  // Problem: how do we handle URL:://name, rfio::Name, etc ???
47 
48  return 0;
49 }
Mode
Available open modes.
Definition: IoCodes.h:16
#define FATAL(message)
Macro for logging fatal messages.
Definition: ErrorLogger.h:167
char * filename
Definition: dump1090.h:266

, generated on Tue Sep 26 2023.