CMS 3D CMS Logo

Public Member Functions | Private Attributes

ContentReader Class Reference

#include <ContentReader.h>

List of all members.

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.

    {
      bei = the_bei;
    }
ContentReader::~ContentReader ( ) [inline]

Definition at line 21 of file ContentReader.h.

{}

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 bei, lut2db_cfg::filename, DQMStore::get(), DQMStore::getMEs(), i, NULL, DQMStore::pwd(), and DQMStore::setCurrentFolder().

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

{
 // std::cout << "ContentReader was asked to find the subfiles of : " 
//          << dir << std::endl;

  // for the interesting directory
  std::string old = bei->pwd();
  bei->setCurrentFolder(dir);
  // get the monitorable files
  std::vector<std::string> all_files = bei->getMEs();  

  if (only_contents)
    {
      // and copy those that exist in the files list
      for (unsigned int i = 0; i < all_files.size(); i++)
        {
          std::string filename = bei->pwd() + "/" + all_files[i];
          // if it does exist
          if (bei->get(filename) != NULL) 
            {
              files.push_back(filename);
            }
        }
      // go back to original folder:  
      bei->setCurrentFolder(old);
    }
  else
    {
      // and copy those that exist in the files list
      for (unsigned int i = 0; i < all_files.size(); i++)
        {
          std::string filename = bei->pwd() + "/" + all_files[i];
          files.push_back(filename);
        }
      // go back to original folder:  
      bei->setCurrentFolder(old);

    }
}
MonitorElement * ContentReader::give_ME ( std::string  filename)

Definition at line 78 of file ContentReader.cc.

References bei, and DQMStore::get().

Referenced by WebInterface::DrawGif().

{
  MonitorElement *requested = bei->get(filename);
  return requested;
}
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().

{

  std::string old = bei->pwd();
  bei->setCurrentFolder(dir);

  std::vector<std::string> all_subdirs = bei->getSubdirs();

 // std::cout << "The directory " << bei->pwd() << " contains " << all_subdirs.size() << " subdirectories!" << std::endl;

  subdirs.push_back("..");
  for (unsigned int i = 0; i < all_subdirs.size(); i++)
    {
      std::string subdir = dir + all_subdirs[i];
      if (mode == "User")
        {
          if (bei->containsAnyMonitorable(subdir))
            {
              subdirs.push_back(all_subdirs[i]);
            }
        }
      else if (mode == "SuperUser")
        {
          subdirs.push_back(all_subdirs[i]);
        }
    }

  bei->setCurrentFolder(old);
}
void ContentReader::give_subdirs_su ( std::string  dir,
std::list< std::string > &  subdirs 
)

Member Data Documentation

Definition at line 12 of file ContentReader.h.

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