version  0.0.1
Defines the C++ API for MsPASS
Loading...
Searching...
No Matches
AntelopePf.h
1#ifndef _ANTELOPE_PF_H_
2#define _ANTELOPE_PF_H_
3
4#include "mspass/utility/Metadata.h"
5#include <list>
6#include <string>
7namespace mspass {
8namespace utility {
18const std::string pftbl_key("AntelopePfTbl");
19const std::string pfarr_key("AntelopePfArr");
61class AntelopePf : public Metadata {
62public:
81 AntelopePf(std::string pfbase);
90 AntelopePf(std::list<std::string> lines);
92 AntelopePf(const AntelopePf &parent);
102 std::list<std::string> get_tbl(const std::string key) const;
115 AntelopePf get_branch(const std::string key) const;
117 std::list<std::string> arr_keys() const;
119 std::list<std::string> tbl_keys() const;
134 AntelopePf &operator=(const AntelopePf &parent);
148 void pfwrite(std::ostream &ofs);
149
150private:
151 std::map<std::string, std::list<std::string>> pftbls;
152 /* This is used for nested Arrs */
153 std::map<std::string, AntelopePf> pfbranches;
154 /* This method is used to implemetn PFPATH - it is called for
155 each secondary file in the PFPATH chain. Returns the number of
156 items changed */
157 int merge_pfmf(AntelopePf &m);
158};
167public:
169 message = std::string("AntelopePfError->undefined error");
170 };
171 AntelopePfError(std::string mess) {
172 message = "AntelopePfError object message=" + mess;
173 };
174 AntelopePfError(const char *mess) {
175 message = std::string("AntelopePfError object message=") + mess;
176 };
177 void log_error() { std::cerr << message << std::endl; };
178};
179/* Procedural functions using AntelopePf object */
180
193MetadataList get_mdlist(const mspass::utility::AntelopePf &m,
194 const std::string tag);
196AntelopePf pfread(const std::string fname);
197
198} // namespace utility
199} // namespace mspass
200#endif
Error class for AntelopePf object.
Definition AntelopePf.h:166
C++ object version of a parameter file.
Definition AntelopePf.h:61
std::list< std::string > arr_keys() const
Definition AntelopePf.cc:400
AntelopePf(std::string pfbase)
Construct from a base pf name.
std::list< std::string > get_tbl(const std::string key) const
get a Tbl component by key.
Definition AntelopePf.cc:385
AntelopePf(std::list< std::string > lines)
Construct from a set of text lines.
AntelopePf get_branch(const std::string key) const
used for subtrees (nested Arrs in antelope)
Definition AntelopePf.cc:392
AntelopePf & operator=(const AntelopePf &parent)
Definition AntelopePf.cc:414
std::list< std::string > tbl_keys() const
Definition AntelopePf.cc:407
Metadata ConvertToMetadata()
Return an object with only simple name:value pairs.
Definition AntelopePf.cc:423
AntelopePf()
Definition AntelopePf.h:64
void pfwrite(std::ostream &ofs)
save result in a pf format.
Definition Metadata.h:71
Base class for error object thrown by MsPASS library routines.
Definition MsPASSError.h:38
std::string message
Definition MsPASSError.h:108