LSSTApplications  17.0+124,17.0+14,17.0+73,18.0.0+37,18.0.0+80,18.0.0-4-g68ffd23+4,18.1.0-1-g0001055+12,18.1.0-1-g03d53ef+5,18.1.0-1-g1349e88+55,18.1.0-1-g2505f39+44,18.1.0-1-g5315e5e+4,18.1.0-1-g5e4b7ea+14,18.1.0-1-g7e8fceb+4,18.1.0-1-g85f8cd4+48,18.1.0-1-g8ff0b9f+4,18.1.0-1-ga2c679d+1,18.1.0-1-gd55f500+35,18.1.0-10-gb58edde+2,18.1.0-11-g0997b02+4,18.1.0-13-gfe4edf0b+12,18.1.0-14-g259bd21+21,18.1.0-19-gdb69f3f+2,18.1.0-2-g5f9922c+24,18.1.0-2-gd3b74e5+11,18.1.0-2-gfbf3545+32,18.1.0-26-g728bddb4+5,18.1.0-27-g6ff7ca9+2,18.1.0-3-g52aa583+25,18.1.0-3-g8ea57af+9,18.1.0-3-gb69f684+42,18.1.0-3-gfcaddf3+6,18.1.0-32-gd8786685a,18.1.0-4-gf3f9b77+6,18.1.0-5-g1dd662b+2,18.1.0-5-g6dbcb01+41,18.1.0-6-gae77429+3,18.1.0-7-g9d75d83+9,18.1.0-7-gae09a6d+30,18.1.0-9-gc381ef5+4,w.2019.45
LSSTDataManagementBasePackage
Namespaces | Classes | Functions
lsst::pex::policy Namespace Reference

Namespaces

 paf
 
 policy
 
 version
 

Classes

class  BadNameError
 an exception thrown when Policy parameter name has an illegal form. More...
 
class  DefaultPolicyFile
 a representation of a default Policy file that is stored as a file in the installation directory of an LSST product. More...
 
class  DictionaryError
 There is a problem with a dictionary. More...
 
class  EOFError
 an exception indicated that the stream being parsed ended prematurely. More...
 
class  FormatSyntaxError
 an exception thrown because a syntax error specific to the format being parsed was encountered. More...
 
class  NameNotFound
 an exception indicating that a policy parameter of a given name can not be found in a Policy object. More...
 
class  ParserError
 an parent exception for errors that occur during the parsing of policy files. More...
 
class  Policy
 a container for holding hierarchical configuration data in memory. More...
 
class  PolicyConfigured
 an interface to indicate that a class is configured with a Policy More...
 
class  PolicyDestination
 a class representing a destination to serialize Policy parameter data to. More...
 
class  PolicyFile
 a representation of a file containing Policy parameter data. More...
 
class  PolicyParser
 an abstract class for parsing serialized Policy data and loading it into a Policy object. More...
 
class  PolicyParserFactory
 an abstract factory class for creating PolicyParser instances. More...
 
class  PolicySource
 an abstract class representing a source of serialized Policy parameter data. More...
 
class  PolicyStreamDestination
 a generic stream destination for policy data More...
 
class  PolicyString
 a representation of a string containing Policy parameter data More...
 
class  PolicyStringDestination
 a generic stream destination for policy data More...
 
class  PolicyWriter
 An abstract interface for writing policy data to streams. More...
 
class  SupportedFormats
 a list of supported Policy formats. More...
 
class  SyntaxError
 an exception thrown because a general syntax error was encountered. More...
 
class  TypeError
 an exception indicating that a policy parameter with a given name has a type different from the one that was requested. More...
 
class  UnsupportedSyntax
 an exception thrown because syntax was encountered that is legal for the format being parsed but which is not supported for encoding Policies. More...
 
class  UrnPolicyFile
 A Policy file in the installation directory of an LSST product, referred to using a URN. More...
 

Functions

std::ostreamoperator<< (std::ostream &os, const Policy &p)
 
template<>
std::string Policy::getValue< std::string > (const std::string &name) const
 
template<>
Policy::FilePtr Policy::getValue< Policy::FilePtr > (const std::string &name) const
 
template<>
Policy::ConstPtr Policy::getValue< Policy::ConstPtr > (const std::string &name) const
 
template<>
std::vector< std::stringPolicy::getValueArray< std::string > (const std::string &name) const
 
template<>
Policy::FilePtrArray Policy::getValueArray< Policy::FilePtr > (const std::string &name) const
 
template<>
Policy::PolicyPtrArray Policy::getValueArray< Policy::Ptr > (const std::string &name) const
 
template<>
Policy::ConstPolicyPtrArray Policy::getValueArray< Policy::ConstPtr > (const std::string &name) const
 
template<>
Policy::ValueType Policy::getValueType< std::string > ()
 
template<>
Policy::ValueType Policy::getValueType< Policy::FilePtr > ()
 
template<>
Policy::ValueType Policy::getValueType< Policy::Ptr > ()
 
template<>
Policy::ValueType Policy::getValueType< Policy::ConstPtr > ()
 
template<>
void Policy::setValue< std::string > (const std::string &name, const std::string &value)
 
template<>
void Policy::setValue< Policy::Ptr > (const std::string &name, const Policy::Ptr &value)
 
template<>
void Policy::setValue< Policy::FilePtr > (const std::string &name, const Policy::FilePtr &value)
 
template<>
void Policy::addValue< std::string > (const std::string &name, const std::string &value)
 
template<>
void Policy::addValue< Policy::Ptr > (const std::string &name, const Policy::Ptr &value)
 
template<>
void Policy::addValue< Policy::FilePtr > (const std::string &name, const Policy::FilePtr &value)
 
 PYBIND11_MODULE (defaultPolicyFile, mod)
 
 PYBIND11_MODULE (dictionary, mod)
 
 PYBIND11_MODULE (policy, mod)
 
 PYBIND11_MODULE (policyFile, mod)
 
 PYBIND11_MODULE (policySource, mod)
 
 PYBIND11_MODULE (policyString, mod)
 
 PYBIND11_MODULE (policyStringDestination, mod)
 
 PYBIND11_MODULE (supportedFormats, mod)
 
 PYBIND11_MODULE (urnPolicyFile, mod)
 

Function Documentation

◆ operator<<()

std::ostream& lsst::pex::policy::operator<< ( std::ostream os,
const Policy p 
)
inline

Definition at line 848 of file Policy.h.

848  {
849  p.print(os);
850  return os;
851 }
std::ostream * os
Definition: Schema.cc:746

◆ Policy::addValue< Policy::FilePtr >()

template<>
void lsst::pex::policy::Policy::addValue< Policy::FilePtr > ( const std::string name,
const Policy::FilePtr value 
)

◆ Policy::addValue< Policy::Ptr >()

template<>
void lsst::pex::policy::Policy::addValue< Policy::Ptr > ( const std::string name,
const Policy::Ptr value 
)

◆ Policy::addValue< std::string >()

template<>
void lsst::pex::policy::Policy::addValue< std::string > ( const std::string name,
const std::string value 
)

◆ Policy::getValue< Policy::ConstPtr >()

◆ Policy::getValue< Policy::FilePtr >()

◆ Policy::getValue< std::string >()

◆ Policy::getValueArray< Policy::ConstPtr >()

◆ Policy::getValueArray< Policy::FilePtr >()

◆ Policy::getValueArray< Policy::Ptr >()

◆ Policy::getValueArray< std::string >()

◆ Policy::getValueType< Policy::ConstPtr >()

◆ Policy::getValueType< Policy::FilePtr >()

◆ Policy::getValueType< Policy::Ptr >()

◆ Policy::getValueType< std::string >()

◆ Policy::setValue< Policy::FilePtr >()

template<>
void lsst::pex::policy::Policy::setValue< Policy::FilePtr > ( const std::string name,
const Policy::FilePtr value 
)

◆ Policy::setValue< Policy::Ptr >()

template<>
void lsst::pex::policy::Policy::setValue< Policy::Ptr > ( const std::string name,
const Policy::Ptr value 
)

◆ Policy::setValue< std::string >()

template<>
void lsst::pex::policy::Policy::setValue< std::string > ( const std::string name,
const std::string value 
)

◆ PYBIND11_MODULE() [1/9]

lsst::pex::policy::PYBIND11_MODULE ( supportedFormats  ,
mod   
)

Definition at line 33 of file supportedFormats.cc.

33  {
34  py::class_<SupportedFormats, std::shared_ptr<SupportedFormats>> cls(mod, "SupportedFormats");
35 
36  cls.def(py::init<>());
37 
38  cls.def("registerFormat", &SupportedFormats::registerFormat);
39  cls.def("recognizeType", &SupportedFormats::recognizeType);
40  cls.def("supports", &SupportedFormats::supports);
41  cls.def("size", &SupportedFormats::size);
42 }

◆ PYBIND11_MODULE() [2/9]

lsst::pex::policy::PYBIND11_MODULE ( policySource  ,
mod   
)

Definition at line 33 of file policySource.cc.

33  {
34  py::module::import("lsst.pex.exceptions");
35  py::class_<PolicySource, std::shared_ptr<PolicySource>> cls(mod, "PolicySource");
36 }

◆ PYBIND11_MODULE() [3/9]

lsst::pex::policy::PYBIND11_MODULE ( policyString  ,
mod   
)

Definition at line 34 of file policyString.cc.

34  {
35  py::class_<PolicyString, std::shared_ptr<PolicyString>, PolicySource> cls(mod, "PolicyString");
36 
37  cls.def(py::init<const std::string&, const SupportedFormats::Ptr&>(), "data"_a,
38  "fmts"_a = PolicyString::defaultFormats);
39 
40  cls.def(py::init<const SupportedFormats::Ptr&>(), "fmts"_a = PolicyString::defaultFormats);
41 }

◆ PYBIND11_MODULE() [4/9]

lsst::pex::policy::PYBIND11_MODULE ( policyFile  ,
mod   
)

Definition at line 34 of file policyFile.cc.

34  {
35  py::class_<PolicyFile, std::shared_ptr<PolicyFile>, PolicySource> cls(mod, "PolicyFile");
36 
37  // SupportedFormats is not exposed to Python so don't export the default argument
38  cls.def(py::init([](std::string const& filepath) { return new PolicyFile(filepath); }));
39 
40  cls.def("getPath", &PolicyFile::getPath);
41  cls.def("exists", &PolicyFile::exists);
42  cls.def("getFormatName", (const std::string& (PolicyFile::*)()) & PolicyFile::getFormatName);
43  cls.def("load", (void (PolicyFile::*)(Policy&)) & PolicyFile::load);
44 
45  cls.def_readonly_static("EXT_PAF", &PolicyFile::EXT_PAF);
46  cls.def_readonly_static("EXT_XML", &PolicyFile::EXT_XML);
47 }
def init()
Definition: tests.py:64
STL class.

◆ PYBIND11_MODULE() [5/9]

lsst::pex::policy::PYBIND11_MODULE ( policyStringDestination  ,
mod   
)

Definition at line 34 of file policyStringDestination.cc.

34  {
35  py::class_<PolicyStringDestination> cls(mod, "PolicyStringDestination");
36 
37  cls.def(py::init<>());
38  cls.def(py::init<const std::string&>());
39  cls.def("getData", &PolicyStringDestination::getData);
40 }

◆ PYBIND11_MODULE() [6/9]

lsst::pex::policy::PYBIND11_MODULE ( defaultPolicyFile  ,
mod   
)

Definition at line 35 of file defaultPolicyFile.cc.

35  {
36  py::class_<DefaultPolicyFile, std::shared_ptr<DefaultPolicyFile>, PolicyFile> cls(mod,
37  "DefaultPolicyFile");
38 
39  cls.def(py::init<const char* const, const std::string&, const std::string&, bool>(), "productName"_a,
40  "filepath"_a, "repos"_a = "", "strict"_a = true);
41 
42  cls.def("load", &DefaultPolicyFile::load);
43  cls.def("getRepositoryPath",
44  [](DefaultPolicyFile const& self) -> std::string { return self.getRepositoryPath().native(); });
45 }
STL class.

◆ PYBIND11_MODULE() [7/9]

lsst::pex::policy::PYBIND11_MODULE ( urnPolicyFile  ,
mod   
)

Definition at line 35 of file urnPolicyFile.cc.

35  {
36  py::class_<UrnPolicyFile, std::shared_ptr<UrnPolicyFile>, DefaultPolicyFile> cls(mod, "UrnPolicyFile");
37 
38  cls.def(py::init<const std::string&, bool, bool>(), "urn"_a, "strictUrn"_a = false,
39  "strictLoads"_a = true);
40 
41  cls.def_static("productNameFromUrn", &UrnPolicyFile::productNameFromUrn);
42  cls.def_static("filePathFromUrn", &UrnPolicyFile::filePathFromUrn);
43  cls.def_static("reposFromUrn", &UrnPolicyFile::reposFromUrn);
44  cls.def_readonly_static("URN_PREFIX", &UrnPolicyFile::URN_PREFIX);
45  cls.def_readonly_static("URN_PREFIX_ABBREV", &UrnPolicyFile::URN_PREFIX_ABBREV);
46  cls.def_static("looksLikeUrn", &UrnPolicyFile::looksLikeUrn);
47 }

◆ PYBIND11_MODULE() [8/9]

lsst::pex::policy::PYBIND11_MODULE ( dictionary  ,
mod   
)

Definition at line 37 of file dictionary.cc.

37  {
38  py::class_<Dictionary, std::shared_ptr<Dictionary>, Policy> clsDictionary(mod, "Dictionary");
39 
40  clsDictionary.def(py::init<>());
41  clsDictionary.def(py::init<std::string &>());
42  clsDictionary.def(py::init<const Dictionary &>());
43  clsDictionary.def(py::init<PolicyFile &>());
44  clsDictionary.def(py::init<const Policy &>());
45 
46  clsDictionary.def("getDefinitions", (Policy::Ptr (Dictionary::*)()) & Dictionary::getDefinitions);
47  clsDictionary.def("check", &Dictionary::check);
48  clsDictionary.def("definedNames",
49  (int (Dictionary::*)(std::list<std::string> &, bool) const) & Dictionary::definedNames,
50  "names"_a, "append"_a = false);
51  clsDictionary.def("definedNames",
52  (Dictionary::StringArray (Dictionary::*)() const) & Dictionary::definedNames);
53  clsDictionary.def("getDef", &Dictionary::getDef);
54  clsDictionary.def("makeDef", &Dictionary::makeDef);
55  clsDictionary.def("hasSubDictionary", &Dictionary::hasSubDictionary);
56  clsDictionary.def("getSubDictionary", &Dictionary::getSubDictionary);
57 
58  // For some strange reason pybind11 doesn't like it if we use the default argument here
59  clsDictionary.def("validate",
60  [](Dictionary const &self, Policy const &pol) { return self.validate(pol); }, "pol"_a);
61  clsDictionary.def("validate", [](Dictionary const &self, Policy const &pol,
62  ValidationError *errs) { self.validate(pol, errs); },
63  "pol"_a, "errs"_a);
64 
65  clsDictionary.def("loadPolicyFiles", (int (Dictionary::*)(bool)) & Dictionary::loadPolicyFiles,
66  "strict"_a = true);
67  clsDictionary.def("loadPolicyFiles", [](Dictionary &self, std::string const &repository) {
68  return self.loadPolicyFiles(repository);
69  });
70  clsDictionary.def("loadPolicyFiles", [](Dictionary &self, std::string const &repository, bool strict) {
71  return self.loadPolicyFiles(repository, strict);
72  });
73 
74  clsDictionary.def("getPrefix", &Dictionary::getPrefix);
75 
76  py::class_<Definition> clsDefinition(mod, "Definition");
77 
78  clsDefinition.def(py::init<const std::string &>(), "paramName"_a = "");
79 
80  clsDefinition.def("getName", &Definition::getName);
81  clsDefinition.def("getPrefix", &Definition::getPrefix);
82  clsDefinition.def("setPrefix", &Definition::setPrefix);
83  clsDefinition.def("isChildDefinition", &Definition::isChildDefinition);
84  clsDefinition.def("setChildDefinition", &Definition::setChildDefinition);
85  clsDefinition.def("isWildcard", &Definition::isWildcard);
86  clsDefinition.def("setWildcard", &Definition::setWildcard);
87  clsDefinition.def("setName", &Definition::setName);
88  clsDefinition.def("getData", &Definition::getData);
89  clsDefinition.def("setData", &Definition::setData);
90  clsDefinition.def("getType", &Definition::getType);
91  clsDefinition.def("getTypeName", &Definition::getTypeName);
92  clsDefinition.def("getDefault", &Definition::getDefault);
93  clsDefinition.def("getDescription", &Definition::getDescription);
94  clsDefinition.def("getMaxOccurs", &Definition::getMaxOccurs);
95  clsDefinition.def("getMinOccurs", &Definition::getMinOccurs);
96  clsDefinition.def("check", &Definition::check);
97 }
STL class.

◆ PYBIND11_MODULE() [9/9]

lsst::pex::policy::PYBIND11_MODULE ( policy  ,
mod   
)

Definition at line 41 of file policy.cc.

41  {
42  exceptions::python::declareException<BadNameError, exceptions::RuntimeError>(mod, "BadNameError",
43  "RuntimeError");
44  exceptions::python::declareException<DictionaryError, exceptions::DomainError>(mod, "DictionaryError",
45  "DomainError");
46  exceptions::python::declareException<NameNotFound, exceptions::NotFoundError>(mod, "NameNotFound",
47  "NotFoundError");
48  exceptions::python::declareException<TypeError, exceptions::DomainError>(mod, "TypeError", "DomainError");
49  auto clsValidationError =
50  exceptions::python::declareException<ValidationError>(mod, "ValidationError", "LogicError");
51 
52  py::enum_<ValidationError::ErrorType>(clsValidationError, "ErrorType")
53  .value("OK", ValidationError::ErrorType::OK)
54  .value("WRONG_TYPE", ValidationError::ErrorType::WRONG_TYPE)
55  .value("MISSING_REQUIRED", ValidationError::ErrorType::MISSING_REQUIRED)
56  .value("NOT_AN_ARRAY", ValidationError::ErrorType::NOT_AN_ARRAY)
57  .value("ARRAY_TOO_SHORT", ValidationError::ErrorType::ARRAY_TOO_SHORT)
58  .value("TOO_FEW_VALUES", ValidationError::ErrorType::TOO_FEW_VALUES)
59  .value("TOO_MANY_VALUES", ValidationError::ErrorType::TOO_MANY_VALUES)
60  .value("WRONG_OCCURRENCE_COUNT", ValidationError::ErrorType::WRONG_OCCURRENCE_COUNT)
61  .value("VALUE_DISALLOWED", ValidationError::ErrorType::VALUE_DISALLOWED)
62  .value("VALUE_OUT_OF_RANGE", ValidationError::ErrorType::VALUE_OUT_OF_RANGE)
63  .value("BAD_VALUE", ValidationError::ErrorType::BAD_VALUE)
64  .value("UNKNOWN_NAME", ValidationError::ErrorType::UNKNOWN_NAME)
65  .value("BAD_DEFINITION", ValidationError::ErrorType::BAD_DEFINITION)
66  .value("NOT_LOADED", ValidationError::ErrorType::NOT_LOADED)
67  .value("UNKNOWN_ERROR", ValidationError::ErrorType::UNKNOWN_ERROR)
68  .export_values();
69 
70  clsValidationError.def(py::init<const std::string&>());
71  clsValidationError.def(py::init<char const*, int, char const*>());
72 
73  clsValidationError.def_readonly_static("EMPTY", &ValidationError::EMPTY);
74  clsValidationError.def("getErrorMessageFor", &ValidationError::getErrorMessageFor);
75  clsValidationError.def("getParamCount", &ValidationError::getParamCount);
76  clsValidationError.def("paramNames", &ValidationError::paramNames);
77  clsValidationError.def("getParamNames", &ValidationError::getParamNames);
78  clsValidationError.def("getErrors",
79  (int (ValidationError::*)(const std::string&) const) & ValidationError::getErrors);
80  clsValidationError.def("getErrors", (int (ValidationError::*)() const) & ValidationError::getErrors);
81  clsValidationError.def("describe", &ValidationError::describe);
82  clsValidationError.def("what", &ValidationError::what);
83 
84  py::class_<Policy, std::shared_ptr<Policy>> clsPolicy(mod, "Policy");
85 
86  py::enum_<Policy::ValueType>(clsPolicy, "ValueType")
87  .value("UNDETERMINED", Policy::ValueType::UNDETERMINED)
88  .value("UNDEF", Policy::ValueType::UNDEF)
89  .value("BOOL", Policy::ValueType::BOOL)
90  .value("INT", Policy::ValueType::INT)
91  .value("DOUBLE", Policy::ValueType::DOUBLE)
92  .value("STRING", Policy::ValueType::STRING)
93  .value("POLICY", Policy::ValueType::POLICY)
94  .value("FILE", Policy::ValueType::FILE)
95  .export_values();
96 
97  clsPolicy.def(py::init<>());
98  clsPolicy.def(py::init<bool, const Dictionary&>());
99  clsPolicy.def(py::init<const std::string&>());
100  clsPolicy.def(py::init<Policy&, bool>(), "pol"_a, "deep"_a = false);
101  clsPolicy.def(py::init<const PolicySource&>());
102 
103  clsPolicy.def_static("createPolicyFromUrn", &Policy::createPolicyFromUrn, "urn"_a, "validate"_a = true);
104  clsPolicy.def_static("createPolicy", (Policy * (*)(PolicySource&, bool, bool)) & Policy::createPolicy,
105  "input"_a, "doIncludes"_a = true, "validate"_a = true);
106  clsPolicy.def_static("createPolicy",
107  (Policy * (*)(const std::string&, bool, bool)) & Policy::createPolicy, "input"_a,
108  "doIncludes"_a = true, "validate"_a = true);
109  clsPolicy.def_static("createPolicy",
110  (Policy * (*)(PolicySource&, const std::string&, bool)) & Policy::createPolicy,
111  "input"_a, "repos"_a, "validate"_a = true);
112  clsPolicy.def_static("createPolicy",
113  (Policy * (*)(const std::string&, const std::string&, bool)) & Policy::createPolicy,
114  "input"_a, "repos"_a, "validate"_a = true);
115  clsPolicy.def("getValueType",
116  (Policy::ValueType (Policy::*)(const std::string&) const) & Policy::getValueType);
117  clsPolicy.def("nameCount", &Policy::nameCount);
118  clsPolicy.def("names", (int (Policy::*)(std::list<std::string>&, bool, bool) const) & Policy::names,
119  "names"_a, "topLevelOnly"_a = false, "append"_a = false);
120  clsPolicy.def("paramNames",
121  (int (Policy::*)(std::list<std::string>&, bool, bool) const) & Policy::paramNames,
122  "names"_a, "topLevelOnly"_a = false, "append"_a = false);
123  clsPolicy.def("policyNames",
124  (int (Policy::*)(std::list<std::string>&, bool, bool) const) & Policy::policyNames,
125  "names"_a, "topLevelOnly"_a = false, "append"_a = false);
126  clsPolicy.def("fileNames",
127  (int (Policy::*)(std::list<std::string>&, bool, bool) const) & Policy::fileNames, "names"_a,
128  "topLevelOnly"_a = false, "append"_a = false);
129  clsPolicy.def("names", (Policy::StringArray (Policy::*)(bool) const) & Policy::names,
130  "topLevelOnly"_a = false);
131  clsPolicy.def("paramNames", (Policy::StringArray (Policy::*)(bool) const) & Policy::paramNames,
132  "topLevelOnly"_a = false);
133  clsPolicy.def("policyNames", (Policy::StringArray (Policy::*)(bool) const) & Policy::policyNames,
134  "topLevelOnly"_a = false);
135  clsPolicy.def("fileNames", (Policy::StringArray (Policy::*)(bool) const) & Policy::fileNames,
136  "topLevelOnly"_a = false);
137  clsPolicy.def("isDictionary", &Policy::isDictionary);
138  clsPolicy.def("canValidate", &Policy::canValidate);
139  clsPolicy.def("getDictionary", &Policy::getDictionary);
140  clsPolicy.def("setDictionary", &Policy::setDictionary);
141  // Somehow default arguments don't work here
142  clsPolicy.def("validate", [](Policy const& self) { return self.validate(); });
143  clsPolicy.def("validate", [](Policy const& self, ValidationError* errs) { return self.validate(errs); });
144  clsPolicy.def("valueCount", &Policy::valueCount);
145  clsPolicy.def("isArray", &Policy::isArray);
146  clsPolicy.def("exists", &Policy::exists);
147  clsPolicy.def("isBool", &Policy::isBool);
148  clsPolicy.def("isInt", &Policy::isInt);
149  clsPolicy.def("isDouble", &Policy::isDouble);
150  clsPolicy.def("isString", &Policy::isString);
151  clsPolicy.def("isPolicy", &Policy::isPolicy);
152  clsPolicy.def("isFile", &Policy::isFile);
153  clsPolicy.def("getTypeInfo", &Policy::getTypeInfo);
154  clsPolicy.def("getPolicy", (Policy::Ptr (Policy::*)(const std::string&)) & Policy::getPolicy);
155  clsPolicy.def("getFile", &Policy::getFile);
156  clsPolicy.def("getBool", &Policy::getBool);
157  clsPolicy.def("getInt", &Policy::getInt);
158  clsPolicy.def("getDouble", &Policy::getDouble);
159  clsPolicy.def("getString", &Policy::getString);
160  clsPolicy.def("getPolicyArray", &Policy::getPolicyArray);
161  clsPolicy.def("getFileArray", &Policy::getFileArray);
162  clsPolicy.def("getBoolArray", &Policy::getBoolArray);
163  clsPolicy.def("getIntArray", &Policy::getIntArray);
164  clsPolicy.def("getDoubleArray", &Policy::getDoubleArray);
165  clsPolicy.def("getStringArray", &Policy::getStringArray);
166  // _set is called from Python set
167  clsPolicy.def("_set", (void (Policy::*)(const std::string&, const Policy::Ptr&)) & Policy::set);
168  clsPolicy.def("_set", (void (Policy::*)(const std::string&, bool)) & Policy::set);
169  clsPolicy.def("_set", (void (Policy::*)(const std::string&, int)) & Policy::set);
170  clsPolicy.def("_set", (void (Policy::*)(const std::string&, double)) & Policy::set);
171  clsPolicy.def("_set", (void (Policy::*)(const std::string&, const std::string&)) & Policy::set);
172  clsPolicy.def("add", (void (Policy::*)(const std::string&, const Policy::Ptr&)) & Policy::add);
173  clsPolicy.def("add", (void (Policy::*)(const std::string&, bool)) & Policy::add);
174  clsPolicy.def("add", (void (Policy::*)(const std::string&, int)) & Policy::add);
175  clsPolicy.def("add", (void (Policy::*)(const std::string&, double)) & Policy::add);
176  clsPolicy.def("add", (void (Policy::*)(const std::string&, const std::string&)) & Policy::add);
177  clsPolicy.def("remove", &Policy::remove);
178  clsPolicy.def("loadPolicyFiles", (int (Policy::*)(bool)) & Policy::loadPolicyFiles, "strict"_a = true);
179 
180  // boost::filesystem::path is equivalent to str in Python
181  clsPolicy.def("loadPolicyFiles",
182  [](Policy& self, const std::string& path, bool strict = true) -> int {
183  return self.loadPolicyFiles(boost::filesystem::path(path), strict);
184  },
185  "repository"_a, "strict"_a = true);
186 
187  clsPolicy.def("mergeDefaults", &Policy::mergeDefaults, "defaultPol"_a, "keepForValidation"_a = true,
188  "errs"_a = nullptr);
189  clsPolicy.def("str", &Policy::str, "name"_a, "indent"_a = "");
190  clsPolicy.def("toString", &Policy::toString);
191  clsPolicy.def("__str__", &Policy::toString); // Cleanup stringification later
192  clsPolicy.def("asPropertySet", &Policy::asPropertySet);
193 }
daf::base::PropertySet * set
Definition: fits.cc:902
STL class.