Exemple #1
0
/**
* Returns for the given stream ID the corresponding WaveformStreamID object.
*
* @param: streamID, a string specifying the <network>.<station>.<location>.<channel>
* @return: a WaveformStreamID object
**/
DataModel::WaveformStreamID getWaveformID(const std::string &streamID) {

std::string s = streamID;
std::string::size_type dot;

DataModel::WaveformStreamID waveformID;

if((dot = s.find('.')) != std::string::npos) {
	waveformID.setNetworkCode(std::string(s, 0, dot));
	s = std::string(s, dot + 1, std::string::npos);

	if((dot = s.find('.')) != std::string::npos) {
		waveformID.setStationCode(std::string(s, 0, dot));
		s = std::string(s, dot + 1, std::string::npos);
	
		if((dot = s.find('.')) != std::string::npos) {
			waveformID.setLocationCode(std::string(s, 0, dot));
			waveformID.setChannelCode(std::string(s, dot + 1, std::string::npos));
		}
	}
}
return waveformID;
}