LSSTApplications  16.0-10-g0ee56ad+5,16.0-11-ga33d1f2+5,16.0-12-g3ef5c14+3,16.0-12-g71e5ef5+18,16.0-12-gbdf3636+3,16.0-13-g118c103+3,16.0-13-g8f68b0a+3,16.0-15-gbf5c1cb+4,16.0-16-gfd17674+3,16.0-17-g7c01f5c+3,16.0-18-g0a50484+1,16.0-20-ga20f992+8,16.0-21-g0e05fd4+6,16.0-21-g15e2d33+4,16.0-22-g62d8060+4,16.0-22-g847a80f+4,16.0-25-gf00d9b8+1,16.0-28-g3990c221+4,16.0-3-gf928089+3,16.0-32-g88a4f23+5,16.0-34-gd7987ad+3,16.0-37-gc7333cb+2,16.0-4-g10fc685+2,16.0-4-g18f3627+26,16.0-4-g5f3a788+26,16.0-5-gaf5c3d7+4,16.0-5-gcc1f4bb+1,16.0-6-g3b92700+4,16.0-6-g4412fcd+3,16.0-6-g7235603+4,16.0-69-g2562ce1b+2,16.0-8-g14ebd58+4,16.0-8-g2df868b+1,16.0-8-g4cec79c+6,16.0-8-gadf6c7a+1,16.0-8-gfc7ad86,16.0-82-g59ec2a54a+1,16.0-9-g5400cdc+2,16.0-9-ge6233d7+5,master-g2880f2d8cf+3,v17.0.rc1
LSSTDataManagementBasePackage
PolicyString.h
Go to the documentation of this file.
1 // -*- lsst-c++ -*-
2 
3 /*
4  * LSST Data Management System
5  * Copyright 2008, 2009, 2010 LSST Corporation.
6  *
7  * This product includes software developed by the
8  * LSST Project (http://www.lsst.org/).
9  *
10  * This program is free software: you can redistribute it and/or modify
11  * it under the terms of the GNU General Public License as published by
12  * the Free Software Foundation, either version 3 of the License, or
13  * (at your option) any later version.
14  *
15  * This program is distributed in the hope that it will be useful,
16  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18  * GNU General Public License for more details.
19  *
20  * You should have received a copy of the LSST License Statement and
21  * the GNU General Public License along with this program. If not,
22  * see <http://www.lsstcorp.org/LegalNotices/>.
23  */
24 
31 #ifndef LSST_PEX_POLICY_STRING_H
32 #define LSST_PEX_POLICY_STRING_H
33 
34 #include <memory>
35 #include <boost/regex.hpp>
36 
40 
41 namespace lsst {
42 namespace pex {
43 namespace policy {
44 
53 public:
54 
62  explicit PolicyString(const std::string& data,
64 
71 
75  const std::string& getData() const { return _data; }
76 
78 
87  virtual const std::string& getFormatName();
88  const std::string& getFormatName() const {
89  return const_cast<PolicyString*>(this)->getFormatName();
90  }
92 
94 
101  virtual void load(Policy& policy);
102  void load(Policy& policy) const {
103  const_cast<PolicyString*>(this)->load(policy);
104  }
106 
107  static const boost::regex SPACE_RE;
108  static const boost::regex COMMENT;
109 
112  static const boost::regex CONTENTID;
113 
114 protected:
119 
120 private:
121  const std::string& cacheName(const std::string& name) {
122  _format = name;
123  return _format;
124  }
125 
126  std::string _format;
128 
129  // inherits SupportedFormats _formats from PolicySource
130 };
131 
132 }}} // end namespace lsst::pex::policy
133 
134 #endif // LSST_PEX_POLICY_STRING_H
135 
136 
definition of the PolicySource class
char * data
Definition: BaseTable.cc:205
static const boost::regex CONTENTID
reg-exp for the start of a comment
Definition: PolicyString.h:112
void load(Policy &policy) const
load the data from this Policy source into a Policy object
Definition: PolicyString.h:102
a container for holding hierarchical configuration data in memory.
Definition: Policy.h:169
virtual void load(Policy &policy)
load the data from this Policy source into a Policy object
static const boost::regex COMMENT
reg-exp for an empty line
Definition: PolicyString.h:108
Interface for Persistable base class.
STL class.
an abstract class representing a source of serialized Policy parameter data.
Definition: PolicySource.h:53
a representation of a string containing Policy parameter data
Definition: PolicyString.h:52
static const boost::regex SPACE_RE
Definition: PolicyString.h:107
A base class for image defects.
const std::string & getData() const
return the wrapped policy data as a string
Definition: PolicyString.h:75
PolicyString(const std::string &data, const SupportedFormats::Ptr &fmts=defaultFormats)
create a PolicyString that&#39;s wrapped around a given string.
definition of the SupportedFormats class
virtual const std::string & getFormatName()
return the name of the format that the data is stored in.
std::string _data
the policy data
Definition: PolicyString.h:118
Base class for all persistable classes.
Definition: Persistable.h:75
static SupportedFormats::Ptr defaultFormats
returns true if the given string containing a content identifier indicates that it contains dictionar...
Definition: PolicySource.h:135
const std::string & getFormatName() const
return the name of the format that the data is stored in.
Definition: PolicyString.h:88