1 // $Id: TideEvent.hh 5748 2014-10-11 19:38:53Z flaterco $ 2 3 // TideEvent Generic representation for tide events. 4 5 /* 6 Copyright (C) 2004 David Flater. 7 8 This program is free software: you can redistribute it and/or modify 9 it under the terms of the GNU General Public License as published by 10 the Free Software Foundation, either version 3 of the License, or 11 (at your option) any later version. 12 13 This program is distributed in the hope that it will be useful, 14 but WITHOUT ANY WARRANTY; without even the implied warranty of 15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 GNU General Public License for more details. 17 18 You should have received a copy of the GNU General Public License 19 along with this program. If not, see <http://www.gnu.org/licenses/>. 20 */ 21 22 namespace libxtide { 23 24 class TideEvent { 25 public: 26 27 // CamelCasing waived here for consistency with sunrise, sunset. 28 enum EventType {max, min, slackrise, slackfall, markrise, markfall, 29 sunrise, sunset, moonrise, moonset, newmoon, firstquarter, fullmoon, 30 lastquarter, rawreading}; 31 32 Timestamp eventTime; 33 EventType eventType; 34 NullablePredictionValue eventLevel; 35 bool isCurrent; 36 37 // For sub stations with residual offsets, these record the time and 38 // level of the corresponding event before corrections are applied. 39 // This is not necessarily the same as the reference station: the 40 // harmonic constants may still have been adjusted. When not 41 // applicable, these variables remain null. 42 Timestamp uncorrectedEventTime; 43 NullablePredictionValue uncorrectedEventLevel; 44 45 // Generate one line of text output, applying global formatting 46 // rules and so on. 47 // Legal forms are c (CSV), t (text) or i (iCalendar). 48 // Legal modes are p (plain), r (raw), or m (medium rare). 49 // text_out is not newline terminated. 50 // 51 // print needs timezone and sometimes name and coordinates from station. 52 void print (Dstr &text_out, 53 Mode::Mode mode, 54 Format::Format form, 55 const Station &station) const; 56 57 constString longDescription () const; 58 constString shortDescription () const; 59 const bool isSunMoonEvent () const; 60 const bool isMaxMinEvent () const; 61 62 // This returns true if the description of the event would be Min Flood or 63 // Min Ebb. 64 const bool isMinCurrentEvent () const; 65 }; 66 67 } 68