Skip to content

Commit

Permalink
Per #1809, Update the ProbGenInfo class to store a pointer to the mat…
Browse files Browse the repository at this point in the history
…ching Best Genesis event.
  • Loading branch information
JohnHalleyGotway committed Nov 12, 2021
1 parent 3b0a2df commit 42d6fad
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 3 deletions.
23 changes: 20 additions & 3 deletions met/src/libcode/vx_tc_util/prob_gen_info.cc
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,8 @@ void ProbGenInfo::clear() {
GenOrDis.clear();
GenTime = (unixtime) 0;

BestGen = (const GenesisInfo *) 0;

return;
}

Expand All @@ -92,6 +94,7 @@ void ProbGenInfo::dump(ostream &out, int indent_depth) const {
out << prefix << "Initials = \"" << Initials.contents() << "\"\n";
out << prefix << "GenOrDis = \"" << GenOrDis.contents() << "\"\n";
out << prefix << "GenTime = " << unix_to_yyyymmdd_hhmmss(GenTime) << "\n";
out << prefix << "BestGen = " << (BestGen ? "set" : "(nul)") << "\n";

out << flush;

Expand All @@ -108,7 +111,8 @@ ConcatString ProbGenInfo::serialize() const {
<< ", ProbGenInfo: "
<< "Initials = \"" << Initials << "\""
<< ", GenOrDis = \"" << GenOrDis << "\""
<< ", GenTime = " << unix_to_yyyymmdd_hhmmss(GenTime) << "\n";
<< ", GenTime = " << unix_to_yyyymmdd_hhmmss(GenTime)
<< ", BestGen = " << (BestGen ? "set" : "(nul)") << "\n";

return(s);
}
Expand All @@ -135,6 +139,17 @@ void ProbGenInfo::assign(const ProbGenInfo &p) {
GenOrDis = p.GenOrDis;
GenTime = p.GenTime;

BestGen = p.BestGen;

return;
}

////////////////////////////////////////////////////////////////////////

void ProbGenInfo::set_best_gen(const GenesisInfo *bg) {

BestGen = bg;

return;
}

Expand All @@ -146,14 +161,16 @@ void ProbGenInfo::initialize(const ATCFProbLine &l, double dland) {

ProbInfoBase::initialize(l, dland);

Initials = l.get_item(ProbGenInitialsOffset);
GenOrDis = l.get_item(ProbGenOrDisOffset);
Initials = l.get_item(ProbGenInitialsOffset);
GenOrDis = l.get_item(ProbGenOrDisOffset);

// Store an empty string as unixtime 0
GenTime = (l.get_item(ProbGenTimeOffset).empty() ?
(unixtime) 0 :
parse_time(l.get_item(ProbGenTimeOffset).c_str()));

BestGen = (const GenesisInfo *) 0;

return;
}

Expand Down
7 changes: 7 additions & 0 deletions met/src/libcode/vx_tc_util/prob_gen_info.h
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,9 @@ class ProbGenInfo : public ProbInfoBase {
ConcatString GenOrDis;
unixtime GenTime;

// Pointer to the matching BEST genesis event
const GenesisInfo * BestGen;

public:

ProbGenInfo();
Expand All @@ -55,13 +58,16 @@ class ProbGenInfo : public ProbInfoBase {
// set stuff
//

void set_best_gen(const GenesisInfo *);

//
// get stuff
//

const ConcatString & initials() const;
const ConcatString & gen_or_dis() const;
unixtime gen_time() const;
const GenesisInfo * best_gen() const;

//
// do stuff
Expand All @@ -83,6 +89,7 @@ class ProbGenInfo : public ProbInfoBase {
inline const ConcatString & ProbGenInfo::initials() const { return(Initials); }
inline const ConcatString & ProbGenInfo::gen_or_dis() const { return(GenOrDis); }
inline unixtime ProbGenInfo::gen_time() const { return(GenTime); }
inline const GenesisInfo * ProbGenInfo::best_gen() const { return(BestGen); }

////////////////////////////////////////////////////////////////////////

Expand Down

0 comments on commit 42d6fad

Please sign in to comment.