CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
LocalStorageMaker.cc
Go to the documentation of this file.
1 #define _GNU_SOURCE 1
2 #define _FILE_OFFSET_BITS 64
7 #include <sys/types.h>
8 #include <sys/stat.h>
9 #include <unistd.h>
10 
12 {
13 public:
14  virtual Storage *open (const std::string &proto,
15  const std::string &path,
16  int mode) override
17  {
19  StorageFactory::ReadHint readHint = f->readHint();
20  StorageFactory::CacheHint cacheHint = f->cacheHint();
21 
23  || cacheHint == StorageFactory::CACHE_HINT_STORAGE)
24  mode &= ~IOFlags::OpenUnbuffered;
25  else
27 
28  File *file = new File (path, mode);
29  return f->wrapNonLocalFile (file, proto, path, mode);
30  }
31 
32  virtual bool check (const std::string &/*proto*/,
33  const std::string &path,
34  IOOffset *size = 0) override
35  {
36  struct stat st;
37  if (stat (path.c_str(), &st) != 0)
38  return false;
39 
40  if (size)
41  *size = st.st_size;
42 
43  return true;
44  }
45 };
46 
CacheHint cacheHint(void) const
Storage * wrapNonLocalFile(Storage *s, const std::string &proto, const std::string &path, int mode)
static StorageFactory * get(void)
double f[11][100]
virtual Storage * open(const std::string &proto, const std::string &path, int mode) override
ReadHint readHint(void) const
int64_t IOOffset
Definition: IOTypes.h:19
#define DEFINE_EDM_PLUGIN(factory, type, name)
Definition: File.h:11
tuple size
Write out results.
virtual bool check(const std::string &, const std::string &path, IOOffset *size=0) override