ewmscp  ..
Classes | Public Member Functions | Static Public Member Functions | Protected Member Functions | Static Protected Member Functions | List of all members
inputHandler::base Class Referenceabstract

class for handling input This is the (abstract) base class for handling input, both reading a file via the reader class and for reading directories via the Directory class More...

#include <inputHandler.h>

Inheritance diagram for inputHandler::base:
[legend]
Collaboration diagram for inputHandler::base:
[legend]

Classes

class  Directory
 
class  factoryClass
 
class  factoryTemplate
 
class  reader
 (abstract) class for reading a file An instance of this class is used to read data from a file vie the readBlock function. More...
 

Public Member Functions

virtual ~base () override=default
 
virtual std::unique_ptr< readernewReader (const std::string &path, copyRequest::stateType &state, const genericStat &inititalStat)=0
 get a reader for the file at path More...
 
virtual bool readLinkTarget (const std::string &, std::vector< char > &)
 read link target from a symlink More...
 
virtual std::unique_ptr< acl::listgetAclData (const std::string &)
 
virtual std::unique_ptr< DirectorygetDirectory (const std::string &path)=0
 
- Public Member Functions inherited from pathHandler
virtual ~pathHandler ()=default
 
virtual bool pathExists (const std::string &path)=0
 
virtual std::unique_ptr< const genericStatgetStat (const std::string &path, bool followLink=true)=0
 
virtual std::string getXattr (const std::string &, const std::string &)
 

Static Public Member Functions

static basenewHandler (const std::string &name)
 create an instance of an inputHandler, select by name More...
 
template<class T >
static void addAllowedNamesToOption (T &option)
 

Protected Member Functions

 base ()=default
 

Static Protected Member Functions

static std::map< std::string, factoryClass * > & getFactoryMap ()
 

Detailed Description

class for handling input This is the (abstract) base class for handling input, both reading a file via the reader class and for reading directories via the Directory class

Definition at line 35 of file inputHandler.h.

Constructor & Destructor Documentation

◆ base()

inputHandler::base::base ( )
protecteddefault

◆ ~base()

virtual inputHandler::base::~base ( )
overridevirtualdefault

Member Function Documentation

◆ addAllowedNamesToOption()

template<class T >
static void inputHandler::base::addAllowedNamesToOption ( T &  option)
inlinestatic

Definition at line 137 of file inputHandler.h.

137  {
138  for (const auto& item : getFactoryMap()) {
139  option.fAddToRange(item.first);
140  }
141  };

References getFactoryMap().

Here is the call graph for this function:

◆ getAclData()

virtual std::unique_ptr<acl::list> inputHandler::base::getAclData ( const std::string &  )
inlinevirtual

Reimplemented in inputHandler::Gpfs.

Definition at line 155 of file inputHandler.h.

155  {
156  return nullptr;
157  }

Referenced by outputHandler::dcap::ensureParentDirs().

Here is the caller graph for this function:

◆ getDirectory()

virtual std::unique_ptr<Directory> inputHandler::base::getDirectory ( const std::string &  path)
pure virtual

Implemented in inputHandler::posixFile, inputHandler::dummy, inputHandler::daosFs, inputHandler::libssh, inputHandler::davix, and inputHandler::dcap.

Referenced by moveRequestProvider::addDirContent(), and cmdLineRequestProvider::addDirContent().

Here is the caller graph for this function:

◆ getFactoryMap()

static std::map<std::string, factoryClass*>& inputHandler::base::getFactoryMap ( )
inlinestaticprotected

Definition at line 40 of file inputHandler.h.

40  {
41  static std::remove_reference<decltype(getFactoryMap())>::type map;
42  return map;
43  }

Referenced by addAllowedNamesToOption(), inputHandler::base::factoryClass::factoryClass(), and newHandler().

Here is the caller graph for this function:

◆ newHandler()

static base* inputHandler::base::newHandler ( const std::string &  name)
inlinestatic

create an instance of an inputHandler, select by name

Definition at line 130 of file inputHandler.h.

130  {
131  auto it = getFactoryMap().find(name);
132  if (it != getFactoryMap().end()) {
133  return it->second->create();
134  }
135  throw std::runtime_error("no inputHandler factory called " + name);
136  }

References getFactoryMap().

Referenced by copyRequest::perThreadData::perThreadData().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ newReader()

virtual std::unique_ptr<reader> inputHandler::base::newReader ( const std::string &  path,
copyRequest::stateType state,
const genericStat inititalStat 
)
pure virtual

get a reader for the file at path

Returns
unique ptr to a file reader.
Exceptions
std::system_errorif file can't be opened File will be closed when the pointer goes out of scope.
Parameters
[in]path[in] path to the file to be opened for reading
[in,out]state[in,out] state may be set to vanished if the file does not exist
[in]inititalStat[in] genericStat data of the file encountered before reading, needed for checking unchangedness at the end

Implemented in inputHandler::posixFile, inputHandler::dummy, inputHandler::daosFs, inputHandler::libssh, inputHandler::davix, inputHandler::dcap, and inputHandler::Gpfs.

◆ readLinkTarget()

virtual bool inputHandler::base::readLinkTarget ( const std::string &  ,
std::vector< char > &   
)
inlinevirtual

read link target from a symlink

Parameters
[in]pathis the path to the link
[in,out]targetis a vector that the link target gets written into, must be large enough
Returns
true if link could be read, false if the link does not exist
Exceptions
std::system_errorif the link could not be read
std::runtime_errorif the target size is larger than target.size()

Reimplemented in inputHandler::posixFile, inputHandler::daosFs, and inputHandler::libssh.

Definition at line 149 of file inputHandler.h.

150  {
151  throw unimplementedActionError("link reading not implemented");
152  }

The documentation for this class was generated from the following file:
unimplementedActionError
class for exceptions that result from unimplemented functions Exceptions of this kind are to be throw...
Definition: copyRequestTypes.h:32
inputHandler::base::getFactoryMap
static std::map< std::string, factoryClass * > & getFactoryMap()
Definition: inputHandler.h:40