14 #ifndef __CVFHICL_PSET_H__
15 #define __CVFHICL_PSET_H__
21 namespace flashmatch {
32 const std::string data=
"");
44 inline const std::string&
name()
const {
return _name; }
51 if(v_keys.size() != rhs.
value_keys().size())
return false;
52 for(
auto const& key : v_keys) {
55 if(this->get<std::string>(key) != rhs.
get<std::string>(key))
59 if(p_keys.size() != rhs.
pset_keys().size())
return false;
60 for(
auto const& key : p_keys) {
70 {
return !((*this) == rhs); }
80 void add(
const std::string& data);
93 std::string
dump(
size_t indent_size=0)
const;
100 T
get(
const std::string& key)
const{
104 msg =
"Key does not exist: \"" + key +
"\"";
107 throw std::exception();
109 return parser::FromString<T>((*iter).second);
114 T
get(
const std::string& key,
const T default_value)
const{
117 return default_value;
118 return parser::FromString<T>((*iter).second);
127 const std::vector<std::string>
keys()
const;
129 const std::vector<std::string>
value_keys ()
const;
131 const std::vector<std::string>
pset_keys ()
const;
149 std::pair<PSet::KeyChar_t,size_t>
search(
const std::string& txt,
const size_t start)
const;
150 void strip(std::string& str,
const std::string& key);
151 void rstrip(std::string& str,
const std::string& key);
164 template<>
PSet PSet::get<flashmatch::PSet>(
const std::string& key)
const;
bool contains_pset(const std::string &key) const
Check if a specified key exists for key-PSet pairs.
std::map< std::string, std::string > _data_value
Key-Value pairs.
bool operator!=(const PSet &rhs) const
const std::vector< std::string > pset_keys() const
Returns a vector of keys for key-PSet pairs.
BEGIN_PROLOG could also be cerr
void no_space(std::string &txt)
void add_pset(const PSet &p)
Insert method for a PSet rep.
const std::vector< std::string > keys() const
Returns a vector of all parameter keys.
void add_value(std::string key, std::string value)
Insert method for a simple param.
List of functions to type-cast std::string to an appropriate value type.
void rename(std::string name)
rename method
virtual ~PSet()
Default destructor.
const std::string & name() const
name getter
std::map< std::string,::flashmatch::PSet > _data_pset
Key-PSet pairs.
PSet(const PSet &orig)
Copy ctor.
const std::vector< std::string > value_keys() const
Returns a vector of keys for key-value pairs.
T get(const std::string &key) const
Template getter.
void rstrip(std::string &str, const std::string &key)
void trim_space(std::string &txt)
std::string _name
The name of this flashmatch::PSet.
bool contains_value(const std::string &key) const
Check if a specified key exists for key-value pairs.
std::string data_string() const
Dump data string.
std::string dump(size_t indent_size=0) const
Dump into a text format.
void add(const std::string &data)
Set data contents.
bool operator==(const PSet &rhs) const
operator override
std::pair< PSet::KeyChar_t, size_t > search(const std::string &txt, const size_t start) const
PSet(const std::string name="", const std::string data="")
Default constructor.
size_t size() const
Returns # of parameters.
void strip(std::string &str, const std::string &key)
const PSet & get_pset(const std::string &key) const
None-template function to retrieve parameter set (deprecated)
BEGIN_PROLOG could also be cout
A nested configuration parameter set holder for flashmatch framework.