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
 
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:121
void getEnvironment()
Definition: FileInPath.cc:374
LocationCode location_
Definition: FileInPath.h:122
std::string relativePath_
Definition: FileInPath.h:120
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:121
void getEnvironment()
Definition: FileInPath.cc:374
LocationCode location_
Definition: FileInPath.h:122
std::string relativePath_
Definition: FileInPath.h:120
void initialize_()
Definition: FileInPath.cc:401
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:121
void getEnvironment()
Definition: FileInPath.cc:374
LocationCode location_
Definition: FileInPath.h:122
std::string relativePath_
Definition: FileInPath.h:120
void initialize_()
Definition: FileInPath.cc:401
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:121
std::string dataTop_
Definition: FileInPath.h:125
std::string searchPath_
Definition: FileInPath.h:126
std::string releaseTop_
Definition: FileInPath.h:124
LocationCode location_
Definition: FileInPath.h:122
std::string relativePath_
Definition: FileInPath.h:120
std::string localTop_
Definition: FileInPath.h:123
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 165 of file FileInPath.cc.

References canonicalFilename_.

Referenced by MillePedeAlignmentAlgorithm::addPxbSurvey(), SiStripBadFiberBuilder::algoAnalyze(), SiStripBadChannelBuilder::algoAnalyze(), SiStripNoisesBuilder::analyze(), SiStripThresholdBuilder::analyze(), SiStripApvGainBuilder::analyze(), SiStripPedestalsBuilder::analyze(), JetCorrectorDemo::analyze(), SiStripNoiseNormalizedWithApvGainBuilder::analyze(), SiStripApvGainBuilderFromTag::analyze(), MuonGeometrySVGTemplate::analyze(), cms::HcalConstantsASCIIWriter::analyze(), DetIdSelectorTest::analyze(), BeamSpotFakeConditions::BeamSpotFakeConditions(), AntiElectronIDMVA5::beginEvent(), JetCorrectorDBWriter::beginJob(), ProtonTaggerFilter::beginJob(), cms::HcalConstantsASCIIWriter::beginJob(), PileUpProducer::beginRun(), GoodSeedProducer::beginRun(), BOOST_PYTHON_MODULE(), HcalTPGCoderULUT::buildCoder(), SiStripDetVOffBuilder::BuildDetVOffObj(), MagGeoBuilderFromDDD::buildInterpolator(), MaterialBudgetCategorizer::buildMaps(), CaloMiscalibTools::CaloMiscalibTools(), CaloMiscalibToolsMC::CaloMiscalibToolsMC(), l1t::CaloParamsESProducer::CaloParamsESProducer(), CastorTextCalibrations::CastorTextCalibrations(), SiStripBadModuleGenerator::createObject(), SiStripThresholdGenerator::createObject(), SiStripNoisesGenerator::createObject(), SiStripLatencyGenerator::createObject(), SiStripBaseDelayGenerator::createObject(), SiStripBackPlaneCorrectionGenerator::createObject(), SiStripLorentzAngleGenerator::createObject(), CSCMonitorModule::CSCMonitorModule(), CSCTFPtLUT::CSCTFPtLUT(), CustomPhysicsList::CustomPhysicsList(), CustomPhysicsListSS::CustomPhysicsListSS(), HcalTPGCoderULUT::dbRecordCallback(), dtCalibration::DTTTrigResidualCorrection::DTTTrigResidualCorrection(), EcalDQMonitorClient::EcalDQMonitorClient(), ElectronIdMVAProducer::ElectronIdMVAProducer(), ElectronPATIdMVAProducer::ElectronPATIdMVAProducer(), OccupancyPlots::endRun(), ESDataFormatterV4::ESDataFormatterV4(), ESElectronicsMapper::ESElectronicsMapper(), gen::EvtGenLHCInterface::EvtGenLHCInterface(), 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(), HcalLaserEventFilter2012::HcalLaserEventFilter2012(), HcalTextCalibrations::HcalTextCalibrations(), HcalRecHitsMaker::init(), gen::EvtGenInterface::init(), ApeSettingAlgorithm::initialize(), PileupJetIdProducer::initJetEnergyCorrector(), JetCalibrationParameterSetTauJet::JetCalibrationParameterSetTauJet(), JetPartonNamespace::JetPartonCalibrationParameterSet::JetPartonCalibrationParameterSet(), L1GtTriggerMenuXmlProducer::L1GtTriggerMenuXmlProducer(), L1MuDTPhiLut::load(), L1MuDTPtaLut::load(), L1MuDTEtaPatternLut::load(), L1MuDTQualPatternLut::load(), L1MuDTExtLut::load(), EcalDeadChannelRecoveryNN< DetIdT >::load_file(), ClusterShapeHitFilter::loadStripLimits(), SiStripHashedDetIdFakeESSource::make(), SiStripFedCablingFakeESSource::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(), EcalTrigTowerConstituentsMapBuilder::parseTextMap(), CaloTowerConstituentsMapBuilder::parseTextMap(), PileupJetIdAlgo::PileupJetIdAlgo(), cms::PileupJPTJetIdAlgo::PileupJPTJetIdAlgo(), SiPixelFakeCPEGenericErrorParmESSource::produce(), SiPixelFakeGenErrorDBObjectESSource::produce(), SiPixelFakeTemplateDBObjectESSource::produce(), HepPDTESSource::produce(), SiPixelFakeGainForHLTESSource::produce(), SiPixelFakeGainESSource::produce(), SiPixelFakeGainOfflineESSource::produce(), SiPixelFakeLorentzAngleESSource::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(), ESPedestalClient::setup(), 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(), l1t::TriggerMenuXmlProducer::TriggerMenuXmlProducer(), TtSemiLepHitFitProducer< LeptonCollection >::TtSemiLepHitFitProducer(), and ZSPJPTJetCorrector::ZSPJPTJetCorrector().

166  {
167  return canonicalFilename_;
168  }
std::string canonicalFilename_
Definition: FileInPath.h:121
void FileInPath::getEnvironment ( void  )
private

Definition at line 374 of file FileInPath.cc.

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

Referenced by FileInPath().

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

Definition at line 401 of file FileInPath.cc.

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

Referenced by FileInPath().

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

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

Referenced by edm::operator>>().

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

Definition at line 313 of file FileInPath.cc.

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

Referenced by edm::decode().

314  {
315  std::string vsn;
316  std::string relname;
317  std::string canFilename;
318  is >> vsn;
319  if (!is) return;
320  bool oldFormat = (version != vsn);
321  if (oldFormat) {
322  relname = vsn;
323  bool local;
324  is >> local;
325  location_ = (local ? Local : Release);
326  is >> canFilename;
327  } else {
328  // Current format
329  int loc;
330  is >> relname >> loc;
331  location_ = static_cast<FileInPath::LocationCode>(loc);
332  if (location_ != Unknown) is >> canFilename;
333  }
334  if (!is) return;
335  relativePath_ = relname;
336  if (location_ == Local) {
337  if (localTop_.empty()) {
338  localTop_ = "@LOCAL";
339  }
340  if (oldFormat) {
341  canonicalFilename_ = canFilename;
342  } else
343  canonicalFilename_ = localTop_ + canFilename;
344  } else if (location_ == Release) {
345  if (releaseTop_.empty()) {
346  releaseTop_="@RELEASE";
347  }
348  if (oldFormat) {
349  std::string::size_type pos = canFilename.find(BASE);
350  if (pos == 0) {
351  // Replace the placehoder with the path to the base release (site dependent).
352  canonicalFilename_ = releaseTop_ + canFilename.substr(BASE.size());
353  } else {
354  // Needed for files written before CMSSW_1_2_0_pre2.
355  canonicalFilename_ = canFilename;
356  }
357  } else
358  canonicalFilename_ = releaseTop_ + canFilename;
359  } else if (location_ == Data) {
360  if (dataTop_.empty()) {
362  << "Environment Variable "
363  << DATATOP
364  << " is not set.\n";
365  }
366  canonicalFilename_ = dataTop_ + canFilename;
367  }
368  }
std::string canonicalFilename_
Definition: FileInPath.h:121
std::string dataTop_
Definition: FileInPath.h:125
uint16_t size_type
std::string releaseTop_
Definition: FileInPath.h:124
LocationCode location_
Definition: FileInPath.h:122
std::string relativePath_
Definition: FileInPath.h:120
std::string localTop_
Definition: FileInPath.h:123
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:120
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:121
std::string dataTop_
Definition: FileInPath.h:125
std::string searchPath_
Definition: FileInPath.h:126
std::string releaseTop_
Definition: FileInPath.h:124
LocationCode location_
Definition: FileInPath.h:122
void swap(edm::DataFrameContainer &lhs, edm::DataFrameContainer &rhs)
std::string relativePath_
Definition: FileInPath.h:120
std::string localTop_
Definition: FileInPath.h:123
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 171 of file FileInPath.cc.

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

Referenced by pkg.AbstractPkg::generate(), and edm::operator<<().

172  {
173  if (location_ == Unknown) {
174  os << version << ' ' << relativePath_ << ' ' << location_;
175  } else if (location_ == Local) {
176  // Guarantee a site independent value by stripping $LOCALTOP.
177  if (localTop_.empty()) {
179  << "Environment Variable "
180  << LOCALTOP
181  << " is not set.\n";
182  }
184  if (pos != 0) {
186  << "Path "
188  << " is not in the local release area "
189  << localTop_
190  << "\n";
191  }
192  os << version << ' ' << relativePath_ << ' ' << location_ << ' ' << canonicalFilename_.substr(localTop_.size());
193  } else if (location_ == Release) {
194  // Guarantee a site independent value by stripping $RELEASETOP.
195  if (releaseTop_.empty()) {
197  << "Environment Variable "
198  << RELEASETOP
199  << " is not set.\n";
200  }
202  if (pos != 0) {
204  << "Path "
206  << " is not in the base release area "
207  << releaseTop_
208  << "\n";
209  }
210  os << version << ' ' << relativePath_ << ' ' << location_ << ' ' << canonicalFilename_.substr(releaseTop_.size());
211  } else if (location_ == Data) {
212  // Guarantee a site independent value by stripping $DATATOP.
213  if (dataTop_.empty()) {
215  << "Environment Variable "
216  << DATATOP
217  << " is not set.\n";
218  }
220  if (pos != 0) {
222  << "Path "
224  << " is not in the data area "
225  << dataTop_
226  << "\n";
227  }
228  os << version << ' ' << relativePath_ << ' ' << location_ << ' ' << canonicalFilename_.substr(dataTop_.size());
229  }
230  }
std::string canonicalFilename_
Definition: FileInPath.h:121
std::string dataTop_
Definition: FileInPath.h:125
uint16_t size_type
std::string releaseTop_
Definition: FileInPath.h:124
LocationCode location_
Definition: FileInPath.h:122
std::string relativePath_
Definition: FileInPath.h:120
std::string localTop_
Definition: FileInPath.h:123

Member Data Documentation

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

Definition at line 121 of file FileInPath.h.

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

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

Definition at line 125 of file FileInPath.h.

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

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

Definition at line 123 of file FileInPath.h.

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

LocationCode edm::FileInPath::location_
private

Definition at line 122 of file FileInPath.h.

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

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

Definition at line 120 of file FileInPath.h.

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

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

Definition at line 124 of file FileInPath.h.

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

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

Definition at line 126 of file FileInPath.h.

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