MsPASS C++ API  2.4.4.dev121+ga7db94e3c
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_sid & operator= (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
28 {
29 string s("");
30 net = s;
31 sta = s;
32 chan = s;
33 loc = s;
34 }
string net
Definition mseed_file_indexer.cc:46
string chan
Definition mseed_file_indexer.cc:50
string sta
Definition mseed_file_indexer.cc:48
string loc
Definition mseed_file_indexer.cc:52

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

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

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.
39 {
40 net = parent.net;
41 sta = parent.sta;
42 chan = parent.chan;
43 loc = parent.loc;
44 };

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.
102 {
103 if (this->net == other.net && this->sta == other.sta &&
104 this->chan == other.chan && this->loc == other.loc)
105 return false;
106 else
107 return true;
108};

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.
57 {
58 if (this != &parent) {
59 net = parent.net;
60 sta = parent.sta;
61 chan = parent.chan;
62 loc = parent.loc;
63 }
64 return *this;
65 };

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.
76 {
77 string sep(":");
78 os << self.net << sep << self.sta << sep << self.chan << sep << self.loc;
79 return os;
80 };

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: