From 96c05ca4cbe18035f279d80f2f87615095ce6a86 Mon Sep 17 00:00:00 2001 From: Daniel Warner Date: Sun, 8 May 2011 13:39:20 +0100 Subject: [PATCH] Changes to tle rules --- Tle.cpp | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/Tle.cpp b/Tle.cpp index f9e3ca9..e3254e2 100644 --- a/Tle.cpp +++ b/Tle.cpp @@ -168,16 +168,17 @@ void Tle::Initialize() { */ bool Tle::IsValidPair(const std::string& line1, const std::string& line2) { - if (atoi(line1.substr(TLE1_COL_NORADNUM, TLE1_LEN_NORADNUM).c_str()) != - atoi(line2.substr(TLE2_COL_NORADNUM, TLE2_LEN_NORADNUM).c_str())) - return false; - if (!IsValidLine(line1, 1)) return false; if (!IsValidLine(line2, 2)) return false; + if (atoi(line1.substr(TLE1_COL_NORADNUM, TLE1_LEN_NORADNUM).c_str()) != + atoi(line2.substr(TLE2_COL_NORADNUM, TLE2_LEN_NORADNUM).c_str())) + return false; + + return true; } @@ -186,7 +187,7 @@ bool Tle::IsValidPair(const std::string& line1, const std::string& line2) { */ bool Tle::IsValidLine(const std::string& str, const unsigned char line_number) { - static const std::string line1_pattern = "1 NNNNNC NNNNAAAA NNNNN.NNNNNNNN +.NNNNNNNN +NNNNN-N +NNNNN-N N NNNNN"; + static const std::string line1_pattern = "1 NNNNNC XXXXXXXX NNNNN.NNNNNNNN +.NNNNNNNN +NNNNN-N +NNNNN-N N NNNNN"; static const std::string line2_pattern = "2 NNNNN NNN.NNNN NNN.NNNN NNNNNNN NNN.NNNN NNN.NNNN NN.NNNNNNNNNNNNNN"; /* @@ -249,15 +250,15 @@ bool Tle::ValidateLine(const std::string& line, const std::string& pattern) { } else if (*pattern_itr == '+') { /* - * if pattern value is '+' then either a '+' or a ' ' + * if pattern value is '+' then either a '+' or '-' or ' ' or '0' */ - if (*line_itr != '+' && *line_itr != '-' && *line_itr != ' ') + if (*line_itr != '+' && *line_itr != '-' && *line_itr != ' ' && *line_itr != '0') return false; } else if (*pattern_itr == '-') { /* - * if pattern value is '+' or a '+' + * if pattern value is '+' or '-' */ if (*line_itr != '+' && *line_itr != '-') return false;