CMS 3D CMS Logo

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

#include <FileInPath.h>

Public Types

enum  LocationCode { Unknown = 0, Local = 1, Release = 2, Data = 3 }
 

Public Member Functions

 FileInPath ()
 
 FileInPath (const std::string &r)
 We throw an exception is the referenced file is not found. More...
 
 FileInPath (const char *r)
 
 FileInPath (FileInPath const &other)
 
std::string fullPath () const
 
bool isLocal () const
 Was the file found under the "local" area? More...
 
LocationCode location () const
 Where was the file found? More...
 
FileInPathoperator= (FileInPath const &other)
 
void read (std::istream &is)
 
void readFromParameterSetBlob (std::istream &is)
 
std::string relativePath () const
 
void swap (FileInPath &other)
 
void write (std::ostream &os) const
 
 ~FileInPath ()
 

Private Member Functions

void getEnvironment ()
 
void initialize_ ()
 

Private Attributes

std::string canonicalFilename_
 
std::string dataTop_
 
std::string localTop_
 
LocationCode location_
 
std::string relativePath_
 
std::string releaseTop_
 
std::string searchPath_
 

Detailed Description

Definition at line 68 of file FileInPath.h.

Member Enumeration Documentation

Enumerator
Unknown 
Local 
Release 
Data 

Definition at line 72 of file FileInPath.h.

Constructor & Destructor Documentation

FileInPath::FileInPath ( )

Default c'tor does no file-existence check; what file would it check for existence?

Definition at line 90 of file FileInPath.cc.

References getEnvironment().

90  :
91  relativePath_(),
94  {
96  }
std::string canonicalFilename_
Definition: FileInPath.h:124
void getEnvironment()
Definition: FileInPath.cc:380
LocationCode location_
Definition: FileInPath.h:125
std::string relativePath_
Definition: FileInPath.h:123
FileInPath::FileInPath ( const std::string &  r)
explicit

We throw an exception is the referenced file is not found.

Definition at line 98 of file FileInPath.cc.

References getEnvironment(), and initialize_().

98  :
102  {
103  getEnvironment();
104  initialize_();
105  }
std::string canonicalFilename_
Definition: FileInPath.h:124
void getEnvironment()
Definition: FileInPath.cc:380
LocationCode location_
Definition: FileInPath.h:125
std::string relativePath_
Definition: FileInPath.h:123
void initialize_()
Definition: FileInPath.cc:407
FileInPath::FileInPath ( const char *  r)
explicit

Definition at line 107 of file FileInPath.cc.

References edm::hlt::Exception, edm::errors::FileInPathError, getEnvironment(), and initialize_().

107  :
108  relativePath_(r ? r : ""),
111  {
112  if(r == 0) {
113  throw edm::Exception(edm::errors::FileInPathError) << "Relative path must not be null\n";
114  }
115  getEnvironment();
116  initialize_();
117  }
std::string canonicalFilename_
Definition: FileInPath.h:124
void getEnvironment()
Definition: FileInPath.cc:380
LocationCode location_
Definition: FileInPath.h:125
std::string relativePath_
Definition: FileInPath.h:123
void initialize_()
Definition: FileInPath.cc:407
FileInPath::FileInPath ( FileInPath const &  other)

Definition at line 119 of file FileInPath.cc.

119  :
120  relativePath_(other.relativePath_),
121  canonicalFilename_(other.canonicalFilename_),
122  location_(other.location_),
123  localTop_(other.localTop_),
124  releaseTop_(other.releaseTop_),
125  dataTop_(other.dataTop_),
126  searchPath_(other.searchPath_)
127  {}
std::string canonicalFilename_
Definition: FileInPath.h:124
std::string dataTop_
Definition: FileInPath.h:128
std::string searchPath_
Definition: FileInPath.h:129
std::string releaseTop_
Definition: FileInPath.h:127
LocationCode location_
Definition: FileInPath.h:125
std::string relativePath_
Definition: FileInPath.h:123
std::string localTop_
Definition: FileInPath.h:126
FileInPath::~FileInPath ( )

Definition at line 129 of file FileInPath.cc.

129 {}

Member Function Documentation

std::string FileInPath::fullPath ( ) const

Return a string that can be used to open the referenced file.

Note that operations on this file may fail, including testing for existence. This is because the state of a filesystem is global; other threads, processes, etc., may have removed the file since we checked on its existence at the time of construction of the FileInPath object.

Definition at line 171 of file FileInPath.cc.

References canonicalFilename_.

Referenced by MillePedeAlignmentAlgorithm::addPxbSurvey(), SiStripBadFiberBuilder::algoAnalyze(), SiStripBadChannelBuilder::algoAnalyze(), SiStripNoisesBuilder::analyze(), SiStripApvGainBuilder::analyze(), SiStripPedestalsBuilder::analyze(), SiStripThresholdBuilder::analyze(), SiStripNoiseNormalizedWithApvGainBuilder::analyze(), JetCorrectorDemo::analyze(), SiStripApvGainBuilderFromTag::analyze(), MuonGeometrySVGTemplate::analyze(), cms::HcalConstantsASCIIWriter::analyze(), BeamSpotFakeConditions::BeamSpotFakeConditions(), JetCorrectorDBWriter::beginJob(), ProtonTaggerFilter::beginJob(), cms::HcalConstantsASCIIWriter::beginJob(), PileUpProducer::beginRun(), GoodSeedProducer::beginRun(), BOOST_PYTHON_MODULE(), SiStripDetVOffBuilder::BuildDetVOffObj(), MagGeoBuilderFromDDD::buildInterpolator(), MaterialBudgetCategorizer::buildMaps(), CaloMiscalibTools::CaloMiscalibTools(), CaloMiscalibToolsMC::CaloMiscalibToolsMC(), CastorTextCalibrations::CastorTextCalibrations(), SiStripBadModuleGenerator::createObject(), SiStripThresholdGenerator::createObject(), SiStripNoisesGenerator::createObject(), SiStripBaseDelayGenerator::createObject(), SiStripLatencyGenerator::createObject(), SiStripLorentzAngleGenerator::createObject(), CSCMonitorModule::CSCMonitorModule(), CSCTFPtLUT::CSCTFPtLUT(), CustomPhysicsList::CustomPhysicsList(), HcalTPGCoderULUT::dbRecordCallback(), DTTTrigResidualCorrection::DTTTrigResidualCorrection(), ElectronIdMVAProducer::ElectronIdMVAProducer(), ElectronPATIdMVAProducer::ElectronPATIdMVAProducer(), ESDataFormatterV4::ESDataFormatterV4(), ESElectronicsMapper::ESElectronicsMapper(), gen::EvtGenInterface::EvtGenInterface(), FastL1GlobalAlgo::FastL1GlobalAlgo(), MultipleScatteringX0Data::fileName(), CSCReadoutMappingFromFile::fill(), SiStripGain::fillNewGain(), popcon::SiStripPopConHandlerUnitTest< T >::fillObject(), popcon::SiStripPopConHandlerUnitTestGain< T >::fillObject(), popcon::SiStripPopConHandlerUnitTestNoise< T >::fillObject(), muonisolation::IsolatorByNominalEfficiency::findPath(), GeometryConfiguration::GeometryConfiguration(), ESTrivialConditionRetriever::getChannelStatusFromConfiguration(), EcalTrivialConditionRetriever::getChannelStatusFromConfiguration(), getfullpathfromfip_(), EcalTrivialConditionRetriever::getMappingFromConfiguration(), SiStripGainFromAsciiFile::getNewObject(), SiStripBadStripFromASCIIFile::getNewObject(), EcalMappingElectronicsHandler::getNewObjects(), cond::FipProtocolParser::getRealConnect(), EcalTrivialConditionRetriever::getTrgChannelStatusFromConfiguration(), ESTrivialConditionRetriever::getWeightsFromConfiguration(), EcalTrivialConditionRetriever::getWeightsFromConfiguration(), HcalForwardLibWriter::HcalForwardLibWriter(), HcalLaserEventFilter2012::HcalLaserEventFilter2012(), HcalTextCalibrations::HcalTextCalibrations(), HcalTPGCoderULUT::HcalTPGCoderULUT(), HFShowerLibrary::HFShowerLibrary(), HcalRecHitsMaker::init(), CastorShowerLibrary::initFile(), ApeSettingAlgorithm::initialize(), JetCalibrationParameterSetTauJet::JetCalibrationParameterSetTauJet(), JetPartonNamespace::JetPartonCalibrationParameterSet::JetPartonCalibrationParameterSet(), L1GtTriggerMenuXmlProducer::L1GtTriggerMenuXmlProducer(), L1MuDTPhiLut::load(), L1MuDTPtaLut::load(), L1MuDTEtaPatternLut::load(), L1MuDTQualPatternLut::load(), L1MuDTExtLut::load(), EnergyLossPlain::loadOptimalWeights(), ClusterShapeHitFilter::loadPixelLimits(), ClusterShapeHitFilter::loadStripLimits(), SiStripFedCablingFakeESSource::make(), SiStripHashedDetIdFakeESSource::make(), jpt::Map::Map(), MultiEventFilter::MultiEventFilter(), MuonErrorMatrix::MuonErrorMatrix(), PhysicsTools::MVAComputerESSourceBase::MVAComputerESSourceBase(), PhysicsTools::MVATrainer::MVATrainer(), NuclearInteractionSimulator::NuclearInteractionSimulator(), gen::Herwig6Instance::openParticleSpecFile(), HcalTBObjectUnpacker::parseCalib(), DDLParser::parseOneFile(), EcalTrigPrimESProducer::parseTextFile(), CaloTowerConstituentsMapBuilder::parseTextMap(), EcalTrigTowerConstituentsMapBuilder::parseTextMap(), PFRecoTauDiscriminationAgainstElectronMVA::PFRecoTauDiscriminationAgainstElectronMVA(), PFRecoTauDiscriminationAgainstElectronMVA2::PFRecoTauDiscriminationAgainstElectronMVA2(), PFRecoTauDiscriminationAgainstElectronMVA3::PFRecoTauDiscriminationAgainstElectronMVA3(), SiPixelFakeCPEGenericErrorParmESSource::produce(), SiPixelFakeTemplateDBObjectESSource::produce(), HepPDTESSource::produce(), SiPixelFakeLorentzAngleESSource::produce(), SiPixelFakeGainOfflineESSource::produce(), SiPixelFakeGainForHLTESSource::produce(), SiPixelFakeGainESSource::produce(), CaloTPGTranscoderULUTs::produce(), MaskedRctInputDigiProducer::produce(), JetCorrectionESSource< Corrector >::produce(), gen::PtYDistributor::PtYDistributor(), SiStripFEDErrorsDQM::readBadAPVs(), SiStripBadComponentsDQMService::readBadComponents(), FIPConfiguration::readConfig(), CSCTFPtLUT::readLUT(), CSCSectorReceiverLUT::readLUTsFromFile(), SiStripNoisesDQMService::readNoises(), GsfBetheHeitlerUpdator::readParameters(), SiStripPedestalsDQMService::readPedestals(), gen::ReggeGribovPartonMCHadronizer::ReggeGribovPartonMCHadronizer(), RPCCalibSetUp::RPCCalibSetUp(), RPCDBSimSetUp::RPCDBSimSetUp(), RPCRecHitProducer::RPCRecHitProducer(), gen::Pythia6Service::setPYUPDAParams(), gen::Pythia6Service::setSLHAParams(), PhiSymmetryCalibration::setUp(), SiPixelActionExecutor::setupQTests(), ShiftedJetProducerT< T, Textractor >::ShiftedJetProducerT(), ShiftedPFCandidateProducerForNoPileUpPFMEt::ShiftedPFCandidateProducerForNoPileUpPFMEt(), SiStripBadModuleByHandBuilder::SiStripBadModuleByHandBuilder(), SiStripDetInfoFileReader::SiStripDetInfoFileReader(), SiStripDQMProfileToTkMapConverter::SiStripDQMProfileToTkMapConverter(), SiStripHitEffFromCalibTree::SiStripHitEffFromCalibTree(), SiStripQuality::SiStripQuality(), SiStripQualityHotStripIdentifier::SiStripQualityHotStripIdentifier(), SiStripQualityHotStripIdentifierRoot::SiStripQualityHotStripIdentifierRoot(), SiStripQualityStatistics::SiStripQualityStatistics(), PhysicsTools::MVATrainerLooper::Trainer::Trainer(), TtSemiLepHitFitProducer< LeptonCollection >::TtSemiLepHitFitProducer(), UECalibration::UECalibration(), and ZSPJPTJetCorrector::ZSPJPTJetCorrector().

172  {
173  return canonicalFilename_;
174  }
std::string canonicalFilename_
Definition: FileInPath.h:124
void FileInPath::getEnvironment ( void  )
private

Definition at line 380 of file FileInPath.cc.

References dataTop_, edm::hlt::Exception, edm::errors::FileInPathError, localTop_, releaseTop_, and searchPath_.

Referenced by FileInPath().

380  {
381  if (!envstring(RELEASETOP, releaseTop_)) {
382  releaseTop_.clear();
383  }
384  if (releaseTop_.empty()) {
385  // RELEASETOP was not set. This means that the environment is set
386  // for the base release itself. So LOCALTOP actually contains the
387  // location of the base release.
388  if (!envstring(LOCALTOP, releaseTop_)) {
389  releaseTop_.clear();
390  }
391  } else {
392  if (!envstring(LOCALTOP, localTop_)) {
393  localTop_.clear();
394  }
395  }
396  if (!envstring(DATATOP, dataTop_)) {
397  dataTop_.clear();
398  }
399  if (!envstring(PathVariableName, searchPath_)) {
401  << PathVariableName
402  << " must be defined\n";
403  }
404  }
std::string dataTop_
Definition: FileInPath.h:128
std::string searchPath_
Definition: FileInPath.h:129
std::string releaseTop_
Definition: FileInPath.h:127
std::string localTop_
Definition: FileInPath.h:126
void FileInPath::initialize_ ( )
private

Definition at line 407 of file FileInPath.cc.

References scaleCards::br, canonicalFilename_, Data, dataTop_, end, edm::hlt::Exception, edm::errors::FileInPathError, Local, localTop_, location_, scaleCards::path, relativePath_, Release, releaseTop_, searchPath_, and edm::tokenize().

Referenced by FileInPath().

408  {
409  if (relativePath_.empty())
411  << "Relative path must not be empty\n";
412 
413  // Find the file, based on the value of path variable.
414  typedef std::vector<std::string> stringvec_t;
415  stringvec_t pathElements = tokenize(searchPath_, ":");
416  stringvec_t::const_iterator it = pathElements.begin();
417  stringvec_t::const_iterator end = pathElements.end();
418  while (it != end) {
419  // Set the boost::fs path to the current element of
420  // CMSSW_SEARCH_PATH:
421  bf::path pathPrefix(*it);
422 
423  // Does the a file exist? locateFile throws is it finds
424  // something goofy.
425  if (locateFile(pathPrefix, relativePath_)) {
426  // Convert relative path to canonical form, and save it.
427  relativePath_ = bf::path(relativePath_).normalize().string();
428 
429  // Save the absolute path.
430 #if ((BOOST_VERSION / 100000) >= 1) && (((BOOST_VERSION / 100) % 1000) >= 47)
431  canonicalFilename_ = bf::absolute(relativePath_,
432  pathPrefix).string();
433 #else
434  canonicalFilename_ = bf::complete(relativePath_,
435  pathPrefix).string();
436 #endif
437  if (canonicalFilename_.empty())
439  << "fullPath is empty"
440  << "\nrelativePath() is: " << relativePath_
441  << "\npath prefix is: " << pathPrefix.string()
442  << '\n';
443 
444  // From the current path element, find the branch path (basically the path minus the
445  // last directory, e.g. /src or /share):
446  for (bf::path br = pathPrefix.branch_path(); !br.normalize().string().empty(); br = br.branch_path()) {
447 
448  if (!localTop_.empty()) {
449  // Create a path object for our local path LOCALTOP:
450  bf::path local_(localTop_);
451  // If the branch path matches the local path, the file was found locally:
452  if (br == local_) {
453  location_ = Local;
454  return;
455  }
456  }
457 
458  if (!releaseTop_.empty()) {
459  // Create a path object for our release path RELEASETOP:
460  bf::path release_(releaseTop_);
461  // If the branch path matches the release path, the file was found in the release:
462  if (br == release_) {
463  location_ = Release;
464  return;
465  }
466  }
467 
468  if (!dataTop_.empty()) {
469  // Create a path object for our data path DATATOP:
470  bf::path data_(dataTop_);
471  // If the branch path matches the data path, the file was found in the data area:
472  if (br == data_) {
473  location_ = Data;
474  return;
475  }
476  }
477  }
478 
479  // This is really gross --- this organization of if/else
480  // inside the while-loop should be changed so that
481  // this break isn't needed.
482  }
483  // Keep trying
484  ++it;
485  }
486 
487  // If we got here, we ran out of path elements without finding
488  // what we're looking found.
490  << "edm::FileInPath unable to find file "
491  << relativePath_
492  << " anywhere in the search path."
493  << "\nThe search path is defined by: "
494  << PathVariableName
495  << "\n${"
496  << PathVariableName
497  << "} is: "
498  << getenv(PathVariableName.c_str())
499  << "\nCurrent directory is: "
500  << bf::initial_path().string()
501  << "\n";
502  }
std::string canonicalFilename_
Definition: FileInPath.h:124
std::string dataTop_
Definition: FileInPath.h:128
std::string searchPath_
Definition: FileInPath.h:129
std::string releaseTop_
Definition: FileInPath.h:127
LocationCode location_
Definition: FileInPath.h:125
list path
Definition: scaleCards.py:51
tuple br
Definition: scaleCards.py:54
#define end
Definition: vmac.h:38
std::vector< std::string > tokenize(std::string const &input, std::string const &separator)
breaks the input string into tokens, delimited by the separator
Definition: Parse.cc:57
std::string relativePath_
Definition: FileInPath.h:123
std::string localTop_
Definition: FileInPath.h:126
bool FileInPath::isLocal ( ) const

Was the file found under the "local" area?

Definition at line 165 of file FileInPath.cc.

References Local, and location_.

Referenced by BOOST_PYTHON_MODULE().

166  {
167  return Local == location_;
168  }
LocationCode location_
Definition: FileInPath.h:125
FileInPath::LocationCode FileInPath::location ( ) const

Where was the file found?

Definition at line 159 of file FileInPath.cc.

References location_.

Referenced by edm::operator==(), ShiftedJetProducerT< T, Textractor >::ShiftedJetProducerT(), and ShiftedPFCandidateProducerForNoPileUpPFMEt::ShiftedPFCandidateProducerForNoPileUpPFMEt().

160  {
161  return location_;
162  }
LocationCode location_
Definition: FileInPath.h:125
FileInPath & FileInPath::operator= ( FileInPath const &  other)

Definition at line 132 of file FileInPath.cc.

References swap(), and groupFilesInBlocks::temp.

133  {
134  FileInPath temp(other);
135  this->swap(temp);
136  return *this;
137  }
void swap(FileInPath &other)
Definition: FileInPath.cc:140
void FileInPath::read ( std::istream &  is)

Read from the given istream, and set contents accordingly. Reading errors are reflected in the state of the stream.

Definition at line 240 of file FileInPath.cc.

References canonicalFilename_, dataTop_, edm::hlt::Exception, edm::errors::FileInPathError, Local, localTop_, location_, pos, relativePath_, Release, releaseTop_, Unknown, and BeamSplash_cfg::version.

Referenced by edm::operator>>().

241  {
242  std::string vsn;
243  std::string relname;
244  std::string canFilename;
245 #if 1
246  // This #if needed for backward compatibility
247  // for files written before CMSSW_1_5_0_pre3.
248  is >> vsn;
249  if (!is) return;
250  bool oldFormat = (version != vsn);
251  if (oldFormat) {
252  relname = vsn;
253  bool local;
254  is >> local;
255  location_ = (local ? Local : Release);
256  is >> canFilename;
257  } else {
258  // Current format
259  int loc;
260  is >> relname >> loc;
261  location_ = static_cast<FileInPath::LocationCode>(loc);
262  if (location_ != Unknown) is >> canFilename;
263  }
264 #else
265  is >> vsn >> relname >> loc >> canFilename;
266 #endif
267  if (!is) return;
268  relativePath_ = relname;
269  if (location_ == Local) {
270  if (localTop_.empty()) {
272  << "Environment Variable "
273  << LOCALTOP
274  << " is not set.\n"
275  << "Trying to read Local file: " << canFilename << ".\n";
276  }
277 #if 1
278  // This #if needed for backward compatibility
279  // for files written before CMSSW_1_5_0_pre3.
280  if (oldFormat) {
281  canonicalFilename_ = canFilename;
282  } else
283 #endif
284  canonicalFilename_ = localTop_ + canFilename;
285  } else if (location_ == Release) {
286  if (releaseTop_.empty()) {
288  << "Environment Variable "
289  << RELEASETOP
290  << " is not set.\n";
291  }
292 #if 1
293  // This #if needed for backward compatibility
294  // for files written before CMSSW_1_5_0_pre3.
295  if (oldFormat) {
296  std::string::size_type pos = canFilename.find(BASE);
297  if (pos == 0) {
298  // Replace the placehoder with the path to the base release (site dependent).
299  canonicalFilename_ = releaseTop_ + canFilename.substr(BASE.size());
300  } else {
301  // Needed for files written before CMSSW_1_2_0_pre2.
302  canonicalFilename_ = canFilename;
303  }
304  } else
305 #endif
306  canonicalFilename_ = releaseTop_ + canFilename;
307  } else if (location_ == Data) {
308  if (dataTop_.empty()) {
310  << "Environment Variable "
311  << DATATOP
312  << " is not set.\n";
313  }
314  canonicalFilename_ = dataTop_ + canFilename;
315  }
316  }
std::string canonicalFilename_
Definition: FileInPath.h:124
std::string dataTop_
Definition: FileInPath.h:128
uint16_t size_type
std::string releaseTop_
Definition: FileInPath.h:127
LocationCode location_
Definition: FileInPath.h:125
std::string relativePath_
Definition: FileInPath.h:123
std::string localTop_
Definition: FileInPath.h:126
void FileInPath::readFromParameterSetBlob ( std::istream &  is)

Definition at line 319 of file FileInPath.cc.

References canonicalFilename_, dataTop_, edm::hlt::Exception, edm::errors::FileInPathError, Local, localTop_, location_, pos, relativePath_, Release, releaseTop_, Unknown, and BeamSplash_cfg::version.

Referenced by edm::decode().

320  {
321  std::string vsn;
322  std::string relname;
323  std::string canFilename;
324  is >> vsn;
325  if (!is) return;
326  bool oldFormat = (version != vsn);
327  if (oldFormat) {
328  relname = vsn;
329  bool local;
330  is >> local;
331  location_ = (local ? Local : Release);
332  is >> canFilename;
333  } else {
334  // Current format
335  int loc;
336  is >> relname >> loc;
337  location_ = static_cast<FileInPath::LocationCode>(loc);
338  if (location_ != Unknown) is >> canFilename;
339  }
340  if (!is) return;
341  relativePath_ = relname;
342  if (location_ == Local) {
343  if (localTop_.empty()) {
344  localTop_ = "@LOCAL";
345  }
346  if (oldFormat) {
347  canonicalFilename_ = canFilename;
348  } else
349  canonicalFilename_ = localTop_ + canFilename;
350  } else if (location_ == Release) {
351  if (releaseTop_.empty()) {
352  releaseTop_="@RELEASE";
353  }
354  if (oldFormat) {
355  std::string::size_type pos = canFilename.find(BASE);
356  if (pos == 0) {
357  // Replace the placehoder with the path to the base release (site dependent).
358  canonicalFilename_ = releaseTop_ + canFilename.substr(BASE.size());
359  } else {
360  // Needed for files written before CMSSW_1_2_0_pre2.
361  canonicalFilename_ = canFilename;
362  }
363  } else
364  canonicalFilename_ = releaseTop_ + canFilename;
365  } else if (location_ == Data) {
366  if (dataTop_.empty()) {
368  << "Environment Variable "
369  << DATATOP
370  << " is not set.\n";
371  }
372  canonicalFilename_ = dataTop_ + canFilename;
373  }
374  }
std::string canonicalFilename_
Definition: FileInPath.h:124
std::string dataTop_
Definition: FileInPath.h:128
uint16_t size_type
std::string releaseTop_
Definition: FileInPath.h:127
LocationCode location_
Definition: FileInPath.h:125
std::string relativePath_
Definition: FileInPath.h:123
std::string localTop_
Definition: FileInPath.h:126
std::string FileInPath::relativePath ( ) const

Return a string containing the canonical form of the relative path. DO NOT USE THIS AS THE FILENAME for any file operations; use fullPath() for that purpose.

Definition at line 152 of file FileInPath.cc.

References relativePath_.

Referenced by BOOST_PYTHON_MODULE(), FWPSetTableManager::handleEntry(), and edm::operator==().

153  {
154  return relativePath_;
155  }
std::string relativePath_
Definition: FileInPath.h:123
void FileInPath::swap ( FileInPath other)

Definition at line 140 of file FileInPath.cc.

References canonicalFilename_, dataTop_, localTop_, location_, relativePath_, releaseTop_, searchPath_, and std::swap().

Referenced by operator=(), and edm::swap().

141  {
142  relativePath_.swap(other.relativePath_);
143  canonicalFilename_.swap(other.canonicalFilename_);
144  std::swap(location_, other.location_);
145  localTop_.swap(other.localTop_);
146  releaseTop_.swap(other.releaseTop_);
147  dataTop_.swap(other.dataTop_);
148  searchPath_.swap(other.searchPath_);
149  }
std::string canonicalFilename_
Definition: FileInPath.h:124
std::string dataTop_
Definition: FileInPath.h:128
std::string searchPath_
Definition: FileInPath.h:129
std::string releaseTop_
Definition: FileInPath.h:127
LocationCode location_
Definition: FileInPath.h:125
void swap(edm::DataFrameContainer &lhs, edm::DataFrameContainer &rhs)
std::string relativePath_
Definition: FileInPath.h:123
std::string localTop_
Definition: FileInPath.h:126
void FileInPath::write ( std::ostream &  os) const

Write contents to the given ostream. Writing errors are reflected in the state of the stream.

Definition at line 177 of file FileInPath.cc.

References canonicalFilename_, dataTop_, edm::hlt::Exception, edm::errors::FileInPathError, Local, localTop_, location_, pos, relativePath_, Release, releaseTop_, Unknown, and BeamSplash_cfg::version.

Referenced by edm::operator<<().

178  {
179  if (location_ == Unknown) {
180  os << version << ' ' << relativePath_ << ' ' << location_;
181  } else if (location_ == Local) {
182  // Guarantee a site independent value by stripping $LOCALTOP.
183  if (localTop_.empty()) {
185  << "Environment Variable "
186  << LOCALTOP
187  << " is not set.\n";
188  }
190  if (pos != 0) {
192  << "Path "
194  << " is not in the local release area "
195  << localTop_
196  << "\n";
197  }
198  os << version << ' ' << relativePath_ << ' ' << location_ << ' ' << canonicalFilename_.substr(localTop_.size());
199  } else if (location_ == Release) {
200  // Guarantee a site independent value by stripping $RELEASETOP.
201  if (releaseTop_.empty()) {
203  << "Environment Variable "
204  << RELEASETOP
205  << " is not set.\n";
206  }
208  if (pos != 0) {
210  << "Path "
212  << " is not in the base release area "
213  << releaseTop_
214  << "\n";
215  }
216  os << version << ' ' << relativePath_ << ' ' << location_ << ' ' << canonicalFilename_.substr(releaseTop_.size());
217  } else if (location_ == Data) {
218  // Guarantee a site independent value by stripping $DATATOP.
219  if (dataTop_.empty()) {
221  << "Environment Variable "
222  << DATATOP
223  << " is not set.\n";
224  }
226  if (pos != 0) {
228  << "Path "
230  << " is not in the data area "
231  << dataTop_
232  << "\n";
233  }
234  os << version << ' ' << relativePath_ << ' ' << location_ << ' ' << canonicalFilename_.substr(dataTop_.size());
235  }
236  }
std::string canonicalFilename_
Definition: FileInPath.h:124
std::string dataTop_
Definition: FileInPath.h:128
uint16_t size_type
std::string releaseTop_
Definition: FileInPath.h:127
LocationCode location_
Definition: FileInPath.h:125
std::string relativePath_
Definition: FileInPath.h:123
std::string localTop_
Definition: FileInPath.h:126

Member Data Documentation

std::string edm::FileInPath::canonicalFilename_
private

Definition at line 124 of file FileInPath.h.

Referenced by fullPath(), initialize_(), read(), readFromParameterSetBlob(), swap(), and write().

std::string edm::FileInPath::dataTop_
private

Definition at line 128 of file FileInPath.h.

Referenced by getEnvironment(), initialize_(), read(), readFromParameterSetBlob(), swap(), and write().

std::string edm::FileInPath::localTop_
private

Definition at line 126 of file FileInPath.h.

Referenced by getEnvironment(), initialize_(), read(), readFromParameterSetBlob(), swap(), and write().

LocationCode edm::FileInPath::location_
private

Definition at line 125 of file FileInPath.h.

Referenced by initialize_(), isLocal(), location(), read(), readFromParameterSetBlob(), swap(), and write().

std::string edm::FileInPath::relativePath_
private

Definition at line 123 of file FileInPath.h.

Referenced by initialize_(), read(), readFromParameterSetBlob(), relativePath(), swap(), and write().

std::string edm::FileInPath::releaseTop_
private

Definition at line 127 of file FileInPath.h.

Referenced by getEnvironment(), initialize_(), read(), readFromParameterSetBlob(), swap(), and write().

std::string edm::FileInPath::searchPath_
private

Definition at line 129 of file FileInPath.h.

Referenced by getEnvironment(), initialize_(), and swap().