version  0.0.1
Defines the C++ API for MsPASS
Loading...
Searching...
No Matches
Public Member Functions | Public Attributes | Friends | List of all members
mspass::io::MSEED_sid Class Reference

Public Member Functions

 MSEED_sid (const char *sid)
 
 MSEED_sid (const MSEED_sid &parent)
 
MSEED_sidoperator= (const MSEED_sid &parent)
 
bool operator!= (const MSEED_sid &other) const
 

Public Attributes

string net
 
string sta
 
string chan
 
string loc
 

Friends

ostream & operator<< (ostream &os, MSEED_sid &self)
 

Detailed Description

Inline class used to make a cleaner interface the ugly libmseed function for dealing with what they call an "sid".

Constructor & Destructor Documentation

◆ MSEED_sid() [1/3]

mspass::io::MSEED_sid::MSEED_sid ( )
inline
26 {
27 string s("");
28 net = s;
29 sta = s;
30 chan = s;
31 loc = s;
32 }

◆ MSEED_sid() [2/3]

mspass::io::MSEED_sid::MSEED_sid ( const char *  sid)

Constructor for this class.

Just copies c strings to std::strings in the class. Throws a simple int exception if the libmseed parser returns an error. This could be improved if I could make sense of the error logger by retrieving the message this obnoxious function posts to its error log.

67 {
68 char net[16], sta[16], loc[16], chan[16]; // larger than needed but safe
69 /* sid apparently is not const in prototype so we need this cast to
70 make it more kosher for this class */
71 if (ms_sid2nslc(const_cast<char *>(sid), net, sta, loc, chan) == 0) {
72 this->net = string(net);
73 this->sta = string(sta);
74 this->chan = string(chan);
75 this->loc = string(loc);
76 } else {
77 throw 1;
78 }
79}

◆ MSEED_sid() [3/3]

mspass::io::MSEED_sid::MSEED_sid ( const MSEED_sid parent)
inline
34 {
35 net = parent.net;
36 sta = parent.sta;
37 chan = parent.chan;
38 loc = parent.loc;
39 };

Member Function Documentation

◆ operator!=()

bool mspass::io::MSEED_sid::operator!= ( const MSEED_sid other) const
80 {
81 if (this->net == other.net && this->sta == other.sta &&
82 this->chan == other.chan && this->loc == other.loc)
83 return false;
84 else
85 return true;
86};

◆ operator=()

MSEED_sid & mspass::io::MSEED_sid::operator= ( const MSEED_sid parent)
inline
44 {
45 if (this != &parent) {
46 net = parent.net;
47 sta = parent.sta;
48 chan = parent.chan;
49 loc = parent.loc;
50 }
51 return *this;
52 };

Friends And Related Symbol Documentation

◆ operator<<

ostream & operator<< ( ostream &  os,
MSEED_sid self 
)
friend
54 {
55 string sep(":");
56 os << self.net << sep << self.sta << sep << self.chan << sep << self.loc;
57 return os;
58 };

The documentation for this class was generated from the following file: