CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Member Functions | Private Attributes
ContentReader Class Reference

#include <ContentReader.h>

Public Member Functions

 ContentReader (DQMStore *the_bei)
 
void give_files (std::string dir, std::list< std::string > &files, bool only_contents)
 
MonitorElementgive_ME (std::string filename)
 
void give_subdirs (std::string dir, std::list< std::string > &subdirs, std::string mode)
 
void give_subdirs_su (std::string dir, std::list< std::string > &subdirs)
 
 ~ContentReader ()
 

Private Attributes

DQMStorebei
 

Detailed Description

Definition at line 8 of file ContentReader.h.

Constructor & Destructor Documentation

ContentReader::ContentReader ( DQMStore the_bei)
inline

Definition at line 16 of file ContentReader.h.

References bei.

17  {
18  bei = the_bei;
19  }
DQMStore * bei
Definition: ContentReader.h:12
ContentReader::~ContentReader ( )
inline

Definition at line 21 of file ContentReader.h.

21 {}

Member Function Documentation

void ContentReader::give_files ( std::string  dir,
std::list< std::string > &  files,
bool  only_contents 
)

Definition at line 36 of file ContentReader.cc.

References fetchall_from_DQM_v2::all_files, bei, lut2db_cfg::filename, DQMStore::get(), DQMStore::getMEs(), i, NULL, DQMStore::pwd(), and DQMStore::setCurrentFolder().

Referenced by WebInterface::printContentViewerXML(), and WebInterface::printNavigatorXML().

37 {
38  // std::cout << "ContentReader was asked to find the subfiles of : "
39 // << dir << std::endl;
40 
41  // for the interesting directory
42  std::string old = bei->pwd();
44  // get the monitorable files
45  std::vector<std::string> all_files = bei->getMEs();
46 
47  if (only_contents)
48  {
49  // and copy those that exist in the files list
50  for (unsigned int i = 0; i < all_files.size(); i++)
51  {
52  std::string filename = bei->pwd() + "/" + all_files[i];
53  // if it does exist
54  if (bei->get(filename) != NULL)
55  {
56  files.push_back(filename);
57  }
58  }
59  // go back to original folder:
60  bei->setCurrentFolder(old);
61  }
62  else
63  {
64  // and copy those that exist in the files list
65  for (unsigned int i = 0; i < all_files.size(); i++)
66  {
67  std::string filename = bei->pwd() + "/" + all_files[i];
68  files.push_back(filename);
69  }
70  // go back to original folder:
71  bei->setCurrentFolder(old);
72 
73  }
74 }
int i
Definition: DBlmapReader.cc:9
#define NULL
Definition: scimark2.h:8
DQMStore * bei
Definition: ContentReader.h:12
MonitorElement * get(const std::string &path) const
get ME from full pathname (e.g. &quot;my/long/dir/my_histo&quot;)
Definition: DQMStore.cc:1468
std::vector< std::string > getMEs(void) const
get list of (non-dir) MEs of current directory
Definition: DQMStore.cc:1442
tuple filename
Definition: lut2db_cfg.py:20
dbl *** dir
Definition: mlp_gen.cc:35
void setCurrentFolder(const std::string &fullpath)
Definition: DQMStore.cc:429
const std::string & pwd(void) const
Definition: DQMStore.cc:401
MonitorElement * ContentReader::give_ME ( std::string  filename)

Definition at line 78 of file ContentReader.cc.

References bei, and DQMStore::get().

Referenced by WebInterface::DrawGif().

79 {
80  MonitorElement *requested = bei->get(filename);
81  return requested;
82 }
DQMStore * bei
Definition: ContentReader.h:12
MonitorElement * get(const std::string &path) const
get ME from full pathname (e.g. &quot;my/long/dir/my_histo&quot;)
Definition: DQMStore.cc:1468
tuple filename
Definition: lut2db_cfg.py:20
void ContentReader::give_subdirs ( std::string  dir,
std::list< std::string > &  subdirs,
std::string  mode 
)

Definition at line 5 of file ContentReader.cc.

References bei, DQMStore::containsAnyMonitorable(), DQMStore::getSubdirs(), i, DQMStore::pwd(), and DQMStore::setCurrentFolder().

Referenced by WebInterface::printContentViewerXML(), and WebInterface::printNavigatorXML().

6 {
7 
8  std::string old = bei->pwd();
10 
11  std::vector<std::string> all_subdirs = bei->getSubdirs();
12 
13  // std::cout << "The directory " << bei->pwd() << " contains " << all_subdirs.size() << " subdirectories!" << std::endl;
14 
15  subdirs.push_back("..");
16  for (unsigned int i = 0; i < all_subdirs.size(); i++)
17  {
18  std::string subdir = dir + all_subdirs[i];
19  if (mode == "User")
20  {
21  if (bei->containsAnyMonitorable(subdir))
22  {
23  subdirs.push_back(all_subdirs[i]);
24  }
25  }
26  else if (mode == "SuperUser")
27  {
28  subdirs.push_back(all_subdirs[i]);
29  }
30  }
31 
32  bei->setCurrentFolder(old);
33 }
int i
Definition: DBlmapReader.cc:9
bool containsAnyMonitorable(const std::string &path) const
Definition: DQMStore.cc:1458
std::vector< std::string > getSubdirs(void) const
Definition: DQMStore.cc:1419
DQMStore * bei
Definition: ContentReader.h:12
dbl *** dir
Definition: mlp_gen.cc:35
void setCurrentFolder(const std::string &fullpath)
Definition: DQMStore.cc:429
const std::string & pwd(void) const
Definition: DQMStore.cc:401
void ContentReader::give_subdirs_su ( std::string  dir,
std::list< std::string > &  subdirs 
)

Member Data Documentation

DQMStore* ContentReader::bei
private

Definition at line 12 of file ContentReader.h.

Referenced by ContentReader(), give_files(), give_ME(), and give_subdirs().