MsPASS C++ API  2.4.3.dev1+g61b06b96
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:
85 AntelopePf(std::string pfbase);
94 AntelopePf(std::list<std::string> lines);
96 AntelopePf(const AntelopePf &parent);
106 std::list<std::string> get_tbl(const std::string key) const;
119 AntelopePf get_branch(const std::string key) const;
121 std::list<std::string> arr_keys() const;
123 std::list<std::string> tbl_keys() const;
138 AntelopePf &operator=(const AntelopePf &parent);
152 void pfwrite(std::ostream &ofs);
153
154private:
155 std::map<std::string, std::list<std::string>> pftbls;
156 /* This is used for nested Arrs */
157 std::map<std::string, AntelopePf> pfbranches;
158 /* This method is used to implemetn PFPATH - it is called for
159 each secondary file in the PFPATH chain. Returns the number of
160 items changed */
161 int merge_pfmf(AntelopePf &m);
162};
171public:
173 message = std::string("AntelopePfError->undefined error");
174 };
178 AntelopePfError(std::string mess) {
179 message = "AntelopePfError object message=" + mess;
180 };
184 AntelopePfError(const char *mess) {
185 message = std::string("AntelopePfError object message=") + mess;
186 };
188 void log_error() { std::cerr << message << std::endl; };
189};
190/* Procedural functions using AntelopePf object */
191
204MetadataList get_mdlist(const mspass::utility::AntelopePf &m,
205 const std::string tag);
207AntelopePf pfread(const std::string fname);
208
209} // namespace utility
210} // namespace mspass
211#endif
Error class for AntelopePf object.
Definition AntelopePf.h:170
AntelopePfError(std::string mess)
Definition AntelopePf.h:178
void log_error()
Definition AntelopePf.h:188
AntelopePfError(const char *mess)
Definition AntelopePf.h:184
C++ object version of a parameter file.
Definition AntelopePf.h:61
std::list< std::string > arr_keys() const
Definition AntelopePf.cc:407
std::list< std::string > get_tbl(const std::string key) const
get a Tbl component by key.
Definition AntelopePf.cc:392
AntelopePf get_branch(const std::string key) const
used for subtrees (nested Arrs in antelope)
Definition AntelopePf.cc:399
AntelopePf & operator=(const AntelopePf &parent)
Definition AntelopePf.cc:421
std::list< std::string > tbl_keys() const
Definition AntelopePf.cc:414
Metadata ConvertToMetadata()
Return an object with only simple name:value pairs.
Definition AntelopePf.cc:430
AntelopePf()
Definition AntelopePf.h:64
void pfwrite(std::ostream &ofs)
save result in a pf format.
Type-safe metadata container used throughout MsPASS.
Definition Metadata.h:101
Base class for error object thrown by MsPASS library routines.
Definition MsPASSError.h:38
std::string message
Definition MsPASSError.h:108