39 # define __attribute__(x)
45 #include "boost/regex.hpp"
49 namespace dafBase = lsst::daf::base;
50 namespace dafPersist = lsst::daf::persistence;
51 namespace pexExcept = lsst::pex::exceptions;
52 namespace pexLog = lsst::pex::logging;
60 lsst::daf::base::Citizen(typeid(*this)), _locString() {
61 boost::regex expr(
"(%.*?)\\((\\w+?)\\)");
62 boost::sregex_iterator i = make_regex_iterator(locString, expr);
63 boost::sregex_iterator last;
64 pexLog::TTrace<5>(
"daf.persistence.LogicalLocation",
66 while (i != boost::sregex_iterator()) {
68 if ((*i).prefix().matched) {
71 std::string fmt = (*i).str(1);
72 std::string key = (*i).str(2);
73 pexLog::TTrace<5>(
"daf.persistence.LogicalLocation",
"Key: " + key);
75 if (
_map->typeOf(key) ==
typeid(int)) {
76 int value =
_map->getAsInt(key);
77 pexLog::TTrace<5>(
"daf.persistence.LogicalLocation",
78 "Map Val: %d", value);
87 std::string value =
_map->getAsString(key);
88 pexLog::TTrace<5>(
"daf.persistence.LogicalLocation",
93 else if (additionalData && additionalData->
exists(key)) {
94 if (additionalData->
typeOf(key) ==
typeid(int)) {
95 int value = additionalData->
getAsInt(key);
96 pexLog::TTrace<5>(
"daf.persistence.LogicalLocation",
97 "Map Val: %d", value);
106 std::string value = additionalData->
getAsString(key);
107 pexLog::TTrace<5>(
"daf.persistence.LogicalLocation",
108 "Map Val: " + value);
114 "Unknown substitution: " + key);
118 if (last == boost::sregex_iterator()) {
120 pexLog::TTrace<5>(
"daf.persistence.LogicalLocation",
125 pexLog::TTrace<5>(
"daf.persistence.LogicalLocation",
boost::shared_ptr< PropertySet > Ptr
definition of the Trace messaging facilities
static boost::shared_ptr< dafBase::PropertySet > _map
The logical-to-less-logical map.
int getAsInt(std::string const &name) const
LogicalLocation(std::string const &locString, boost::shared_ptr< dafBase::PropertySet const > additionalData=boost::shared_ptr< dafBase::PropertySet const >())
std::string const & locString(void) const
std::string _locString
The location string.
#define LSST_EXCEPT(type,...)
static void setLocationMap(boost::shared_ptr< dafBase::PropertySet > map)
std::type_info const & typeOf(std::string const &name) const
Class for storing generic metadata.
virtual Ptr deepCopy(void) const
std::string getAsString(std::string const &name) const
Interface for LogicalLocation class.
bool exists(std::string const &name) const
Include files required for standard LSST Exception handling.