39 # define __attribute__(x)
55 namespace persistence {
79 storage->setPolicy(policy);
81 storage->setPersistLocation(location);
84 storage->setRetrieveLocation(location);
95 std::string::size_type pos = name.find_last_of(
'/');
96 if (pos == std::string::npos)
return;
97 std::string dirName = name.substr(0, pos);
101 int ret = ::stat(dirName.c_str(), &buf);
103 if (ret == -1 && errno == ENOENT) {
107 ret = ::mkdir(dirName.c_str(), 0777);
110 if (ret == -1 && errno != EEXIST) {
111 throw LSST_EXCEPT(lsst::pex::exceptions::RuntimeError,
112 dirName +
": Error creating directory = " + std::strerror(errno));
115 else if (ret == -1) {
117 throw LSST_EXCEPT(lsst::pex::exceptions::RuntimeError,
118 dirName +
": Error searching for directory = " + std::strerror(errno));
120 else if (!S_ISDIR(buf.st_mode)) {
122 throw LSST_EXCEPT(lsst::pex::exceptions::RuntimeError,
123 dirName +
": Non-directory in path");
table::Key< std::string > name
Include files required for standard LSST Exception handling.
Class for logical location of a persisted Persistable instance.
boost::shared_ptr< Policy > Ptr
Interface for Storage abstract base class.
static Ptr createInstance(std::string const &name, LogicalLocation const &location, bool persist, lsst::pex::policy::Policy::Ptr policy)
Interface for StorageRegistry class.
#define LSST_EXCEPT(type,...)
boost::shared_ptr< Storage > Ptr
void verifyPathName(std::string const &pathName)
static StorageRegistry & getRegistry(void)
Storage::Ptr createInstance(std::string const &name)
Storage(std::type_info const &type)