MsPASS C++ API  2.4.1.dev4+g92330b7a
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 }
string net
Definition mseed_file_indexer.cc:44
string chan
Definition mseed_file_indexer.cc:48
string sta
Definition mseed_file_indexer.cc:46
string loc
Definition mseed_file_indexer.cc:50

◆ 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.

87 {
88 char net[16], sta[16], loc[16], chan[16]; // larger than needed but safe
89 /* sid apparently is not const in prototype so we need this cast to
90 make it more kosher for this class */
91 if (ms_sid2nslc(const_cast<char *>(sid), net, sta, loc, chan) == 0) {
92 this->net = string(net);
93 this->sta = string(sta);
94 this->chan = string(chan);
95 this->loc = string(loc);
96 } else {
97 throw 1;
98 }
99}

References chan, loc, net, and sta.

◆ MSEED_sid() [3/3]

mspass::io::MSEED_sid::MSEED_sid ( const MSEED_sid parent)
inline

Standard copy constructor.

Parameters
parentsource station id to copy.
37 {
38 net = parent.net;
39 sta = parent.sta;
40 chan = parent.chan;
41 loc = parent.loc;
42 };

References chan, loc, net, and sta.

Member Function Documentation

◆ operator!=()

bool mspass::io::MSEED_sid::operator!= ( const MSEED_sid other) const

Test whether any network, station, channel, or location code differs.

Parameters
otherstation id to compare with this object.
Returns
true when at least one sid component is different.
100 {
101 if (this->net == other.net && this->sta == other.sta &&
102 this->chan == other.chan && this->loc == other.loc)
103 return false;
104 else
105 return true;
106};

References chan, loc, net, and sta.

◆ operator=()

MSEED_sid & mspass::io::MSEED_sid::operator= ( const MSEED_sid parent)
inline

Standard assignment operator.

Parameters
parentsource station id to assign from.
Returns
reference to this station id after assignment.
55 {
56 if (this != &parent) {
57 net = parent.net;
58 sta = parent.sta;
59 chan = parent.chan;
60 loc = parent.loc;
61 }
62 return *this;
63 };

References chan, loc, net, and sta.

Friends And Related Symbol Documentation

◆ operator<<

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

Write this station id as net:sta:chan:loc.

Parameters
osoutput stream to receive the station id.
selfstation id to write.
Returns
output stream after writing self.
74 {
75 string sep(":");
76 os << self.net << sep << self.sta << sep << self.chan << sep << self.loc;
77 return os;
78 };

Member Data Documentation

◆ chan

string mspass::io::MSEED_sid::chan

SEED channel code.

◆ loc

string mspass::io::MSEED_sid::loc

SEED location code.

◆ net

string mspass::io::MSEED_sid::net

SEED network code.

◆ sta

string mspass::io::MSEED_sid::sta

SEED station code.


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