artdaq_core  v3_01_04
artdaq::SimpleLookupPolicy Class Reference

This class is intended to find files using a set lookup order. More...

#include <artdaq-core/Utilities/SimpleLookupPolicy.hh>

Inheritance diagram for artdaq::SimpleLookupPolicy:

Public Types

enum  ArgType : int { ArgType::ENV_VAR = 0, ArgType::PATH_STRING = 1 }
 Flag if the constructor argument is a list of paths or the name of an environment variable. More...
 

Public Member Functions

 SimpleLookupPolicy (std::string const &paths, ArgType argType=ArgType::ENV_VAR)
 Constructor. More...
 
std::string operator() (std::string const &filename) override
 Perform the file lookup. More...
 
virtual ~SimpleLookupPolicy () noexcept
 Default destructor.
 

Detailed Description

This class is intended to find files using a set lookup order.

This class is intended to find files using the following lookup order:

  • the absolute path, if provided
  • the current directory
  • the specified list of paths

Definition at line 21 of file SimpleLookupPolicy.hh.

Member Enumeration Documentation

Flag if the constructor argument is a list of paths or the name of an environment variable.

Enumerator
ENV_VAR 

Constructor argument is environment variable name.

PATH_STRING 

Constructor argument is a list of directories.

Definition at line 28 of file SimpleLookupPolicy.hh.

Constructor & Destructor Documentation

artdaq::SimpleLookupPolicy::SimpleLookupPolicy ( std::string const &  paths,
ArgType  argType = ArgType::ENV_VAR 
)

Constructor.

Parameters
pathsEither the name of an environment variable or a list of directories to search
argTypeFlag to determine if paths argument is an environment variable or a list of directories

The SimpleLookupPolicy Constructor instantiates the cet::search_path objects used for file lookup.

Definition at line 5 of file SimpleLookupPolicy.cc.

Member Function Documentation

std::string artdaq::SimpleLookupPolicy::operator() ( std::string const &  filename)
override

Perform the file lookup.

Parameters
filenameThe name of the file to find
Returns
The location that the file was found in.

The lookup proceeds in the following order:

  • the absolute path, if provided
  • the current directory
  • the specified list of paths

Definition at line 41 of file SimpleLookupPolicy.cc.


The documentation for this class was generated from the following files: