From 5fc97115d2c8365046ad3021ba3eb38bbccdaf7e Mon Sep 17 00:00:00 2001 From: JP Swinski Date: Wed, 25 Oct 2023 15:02:16 +0000 Subject: [PATCH] updates to atlas plugin code to bring up to clang tidy and cppcheck standards --- packages/legacy/StatisticRecord.h | 2 +- plugins/atlas/plugin/AltimetryHistogram.cpp | 2 +- plugins/atlas/plugin/AltimetryHistogram.h | 2 +- .../atlas/plugin/AltimetryProcessorModule.h | 2 +- plugins/atlas/plugin/AtlasFileWriter.cpp | 77 +++++----- plugins/atlas/plugin/AtlasFileWriter.h | 14 +- plugins/atlas/plugin/AtlasHistogram.cpp | 2 +- .../atlas/plugin/CmdEchoProcessorModule.cpp | 12 +- plugins/atlas/plugin/CmdEchoProcessorModule.h | 2 +- .../atlas/plugin/DiagLogProcessorModule.cpp | 6 +- plugins/atlas/plugin/DiagLogProcessorModule.h | 2 +- plugins/atlas/plugin/HstvsSimulator.cpp | 73 +++++----- plugins/atlas/plugin/HstvsSimulator.h | 2 +- plugins/atlas/plugin/ItosRecord.cpp | 76 +++++----- plugins/atlas/plugin/ItosRecord.h | 86 +++++++----- plugins/atlas/plugin/ItosRecordParser.cpp | 132 ++++++++++-------- plugins/atlas/plugin/ItosRecordParser.h | 27 ++-- plugins/atlas/plugin/LaserProcessorModule.h | 2 +- .../atlas/plugin/MajorFrameProcessorModule.h | 2 +- plugins/atlas/plugin/SafeString.cpp | 5 +- plugins/atlas/plugin/TimeProcessorModule.h | 2 +- plugins/atlas/plugin/TimeTagHistogram.cpp | 15 +- plugins/atlas/plugin/TimeTagHistogram.h | 3 +- .../atlas/plugin/TimeTagProcessorModule.cpp | 9 +- plugins/atlas/plugin/TimeTagProcessorModule.h | 2 +- 25 files changed, 284 insertions(+), 275 deletions(-) diff --git a/packages/legacy/StatisticRecord.h b/packages/legacy/StatisticRecord.h index d34b3fd8d..086095db2 100644 --- a/packages/legacy/StatisticRecord.h +++ b/packages/legacy/StatisticRecord.h @@ -153,7 +153,7 @@ StatisticRecord::StatisticRecord(CommandProcessor* cmd_proc, const char* cmd_ RecordObject(rec_name) { /* Set Record to Data Allocated by RecordObject */ - rec = (T*)recordData; + rec = reinterpret_cast(recordData); /* Initialize Parameters */ statClear = CLEAR_NEVER; diff --git a/plugins/atlas/plugin/AltimetryHistogram.cpp b/plugins/atlas/plugin/AltimetryHistogram.cpp index e54a16bd5..15b5760b3 100644 --- a/plugins/atlas/plugin/AltimetryHistogram.cpp +++ b/plugins/atlas/plugin/AltimetryHistogram.cpp @@ -61,7 +61,7 @@ AltimetryHistogram::AltimetryHistogram(AtlasHistogram::type_t _type, int _intper double _gps, double _rws, double _rww): AtlasHistogram(rec_type, _type, _intperiod, _binsize, _pcenum, _mfc, _mfdata, _gps, _rws, _rww) { - alt = (altHist_t*)recordData; + alt = reinterpret_cast(recordData); } /*---------------------------------------------------------------------------- diff --git a/plugins/atlas/plugin/AltimetryHistogram.h b/plugins/atlas/plugin/AltimetryHistogram.h index 0d40cc4cd..b539815a9 100644 --- a/plugins/atlas/plugin/AltimetryHistogram.h +++ b/plugins/atlas/plugin/AltimetryHistogram.h @@ -72,7 +72,7 @@ class AltimetryHistogram: public AtlasHistogram double _rww ); virtual ~AltimetryHistogram (void); static recordDefErr_t defineHistogram (void); - bool calcAttributes (double sigwidth, double bincal); // returns if signal is found + bool calcAttributes (double sigwidth, double bincal) override; // returns if signal is found private: diff --git a/plugins/atlas/plugin/AltimetryProcessorModule.h b/plugins/atlas/plugin/AltimetryProcessorModule.h index 164d9e666..56e581279 100644 --- a/plugins/atlas/plugin/AltimetryProcessorModule.h +++ b/plugins/atlas/plugin/AltimetryProcessorModule.h @@ -86,7 +86,7 @@ class AltimetryProcessorModule: public CcsdsProcessorModule * Methods *--------------------------------------------------------------------*/ - bool processSegments (List& segments, int numpkts); + bool processSegments (List& segments, int numpkts) override; bool parseAltHist (List& segments, int numpkts); bool parseAtmHist (List& segments, int numpkts); diff --git a/plugins/atlas/plugin/AtlasFileWriter.cpp b/plugins/atlas/plugin/AtlasFileWriter.cpp index b2a26ed9b..74cbea107 100644 --- a/plugins/atlas/plugin/AtlasFileWriter.cpp +++ b/plugins/atlas/plugin/AtlasFileWriter.cpp @@ -52,10 +52,10 @@ /*---------------------------------------------------------------------------- * Constructor - *----------------------------------------------------------------------------*/ -AtlasFileWriter::AtlasFileWriter(CommandProcessor* cmd_proc, const char* obj_name, fmt_t _fmt, const char* _prefix, const char* inq_name, unsigned int _max_file_size): +AtlasFileWriter::AtlasFileWriter(CommandProcessor* cmd_proc, const char* obj_name, atlas_fmt_t _fmt, const char* _prefix, const char* inq_name, unsigned int _max_file_size): CcsdsFileWriter(cmd_proc, obj_name, CcsdsFileWriter::USER_DEFINED, _prefix, inq_name, _max_file_size) { - fmt = _fmt; + atlas_fmt = _fmt; } /*---------------------------------------------------------------------------- @@ -72,7 +72,7 @@ AtlasFileWriter::~AtlasFileWriter(void) *----------------------------------------------------------------------------*/ CommandableObject* AtlasFileWriter::createObject(CommandProcessor* cmd_proc, const char* name, int argc, char argv[][MAX_CMD_SIZE]) { - fmt_t format = str2fmt(argv[0]); + atlas_fmt_t format = str2fmt(argv[0]); const char* prefix = argv[1]; const char* stream = StringLib::checkNullStr(argv[2]); @@ -95,7 +95,7 @@ CommandableObject* AtlasFileWriter::createObject(CommandProcessor* cmd_proc, con /*---------------------------------------------------------------------------- * str2fmt - *----------------------------------------------------------------------------*/ -AtlasFileWriter::fmt_t AtlasFileWriter::str2fmt(const char* str) +AtlasFileWriter::atlas_fmt_t AtlasFileWriter::str2fmt(const char* str) { if(strcmp(str, "SCI_PKT") == 0) return SCI_PKT; else if(strcmp(str, "SCI_CH") == 0) return SCI_CH; @@ -114,7 +114,7 @@ AtlasFileWriter::fmt_t AtlasFileWriter::str2fmt(const char* str) /*---------------------------------------------------------------------------- * str2fmt - *----------------------------------------------------------------------------*/ -const char* AtlasFileWriter::fmt2str(AtlasFileWriter::fmt_t _fmt) +const char* AtlasFileWriter::fmt2str(AtlasFileWriter::atlas_fmt_t _fmt) { if(_fmt == SCI_PKT) return "SCI_PKT"; else if(_fmt == SCI_CH) return "SCI_CH"; @@ -139,7 +139,7 @@ const char* AtlasFileWriter::fmt2str(AtlasFileWriter::fmt_t _fmt) *----------------------------------------------------------------------------*/ int AtlasFileWriter::writeMsg(void* msg, int size, bool with_header) { - switch(fmt) + switch(atlas_fmt) { case SCI_PKT: return writeSciPkt(msg, size, with_header); case SCI_CH: return writeSciCh(msg, size, with_header); @@ -162,7 +162,7 @@ int AtlasFileWriter::writeMsg(void* msg, int size, bool with_header) *----------------------------------------------------------------------------*/ bool AtlasFileWriter::isBinary(void) { - switch(fmt) + switch(atlas_fmt) { case SCI_PKT: return false; case SCI_CH: return false; @@ -198,18 +198,18 @@ int AtlasFileWriter::writeSciPkt (void* msg, int size, bool with_header) if(!data) return 0; pktStat_t* stat = (pktStat_t*)data; - cnt += fprintf(outfp, "%6d, ", stat->pce); - cnt += fprintf(outfp, "%6d, ", stat->segcnt); - cnt += fprintf(outfp, "%6d, ", stat->pktcnt); - cnt += fprintf(outfp, "%3d, ", stat->mfc_errors); - cnt += fprintf(outfp, "%3d, ", stat->hdr_errors); - cnt += fprintf(outfp, "%3d, ", stat->fmt_errors); - cnt += fprintf(outfp, "%3d, ", stat->dlb_errors); - cnt += fprintf(outfp, "%3d, ", stat->tag_errors); - cnt += fprintf(outfp, "%3d, ", stat->pkt_errors); - cnt += fprintf(outfp, "%4d, ", stat->warnings); - cnt += fprintf(outfp, "%7d, ", stat->min_tags); - cnt += fprintf(outfp, "%7d, ", stat->max_tags); + cnt += fprintf(outfp, "%6u, ", stat->pce); + cnt += fprintf(outfp, "%6u, ", stat->segcnt); + cnt += fprintf(outfp, "%6u, ", stat->pktcnt); + cnt += fprintf(outfp, "%3u, ", stat->mfc_errors); + cnt += fprintf(outfp, "%3u, ", stat->hdr_errors); + cnt += fprintf(outfp, "%3u, ", stat->fmt_errors); + cnt += fprintf(outfp, "%3u, ", stat->dlb_errors); + cnt += fprintf(outfp, "%3u, ", stat->tag_errors); + cnt += fprintf(outfp, "%3u, ", stat->pkt_errors); + cnt += fprintf(outfp, "%4u, ", stat->warnings); + cnt += fprintf(outfp, "%7u, ", stat->min_tags); + cnt += fprintf(outfp, "%7u, ", stat->max_tags); cnt += fprintf(outfp, "%.1lf, ", stat->avg_tags); cnt += fprintf(outfp, "\n"); @@ -237,16 +237,16 @@ int AtlasFileWriter::writeSciCh (void* msg, int size, bool with_header) chStat_t* chstat = (chStat_t*)data; for(int channel = 0; channel < NUM_CHANNELS; channel++) { - cnt += fprintf(outfp, "%2d, ", chstat->pce + 1); + cnt += fprintf(outfp, "%2u, ", chstat->pce + 1); cnt += fprintf(outfp, "%2d, ", channel + 1); - cnt += fprintf(outfp, "%7d, ", chstat->statcnt); - cnt += fprintf(outfp, "%7d, ", chstat->rx_cnt[channel]); - cnt += fprintf(outfp, "%7d, ", chstat->num_dupr[channel]); + cnt += fprintf(outfp, "%7u, ", chstat->statcnt); + cnt += fprintf(outfp, "%7u, ", chstat->rx_cnt[channel]); + cnt += fprintf(outfp, "%7u, ", chstat->num_dupr[channel]); cnt += fprintf(outfp, "%7.1lf, ", chstat->tdc_calr[channel]); cnt += fprintf(outfp, "%7.1lf, ", chstat->min_calr[channel]); cnt += fprintf(outfp, "%7.1lf, ", chstat->max_calr[channel]); cnt += fprintf(outfp, "%7.1lf, ", chstat->avg_calr[channel]); - cnt += fprintf(outfp, "%7d, ", chstat->num_dupf[channel]); + cnt += fprintf(outfp, "%7u, ", chstat->num_dupf[channel]); cnt += fprintf(outfp, "%7.1lf, ", chstat->tdc_calf[channel]); cnt += fprintf(outfp, "%7.1lf, ", chstat->min_calf[channel]); cnt += fprintf(outfp, "%7.1lf, ", chstat->max_calf[channel]); @@ -276,15 +276,15 @@ int AtlasFileWriter::writeSciTx (void* msg, int size, bool with_header) if(!data) return 0; txStat_t* stat = (txStat_t*)data; - cnt += fprintf(outfp, "%7d, ", stat->pce + 1); - cnt += fprintf(outfp, "%7d, ", stat->statcnt); - cnt += fprintf(outfp, "%5d, ", stat->txcnt); - cnt += fprintf(outfp, "%6d, ", stat->min_tags[STRONG_SPOT]); - cnt += fprintf(outfp, "%7d, ", stat->max_tags[STRONG_SPOT]); + cnt += fprintf(outfp, "%7u, ", stat->pce + 1); + cnt += fprintf(outfp, "%7u, ", stat->statcnt); + cnt += fprintf(outfp, "%5u, ", stat->txcnt); + cnt += fprintf(outfp, "%6u, ", stat->min_tags[STRONG_SPOT]); + cnt += fprintf(outfp, "%7u, ", stat->max_tags[STRONG_SPOT]); cnt += fprintf(outfp, "%7.1lf, ", stat->avg_tags[STRONG_SPOT]); cnt += fprintf(outfp, "%7.1lf, ", stat->std_tags[STRONG_SPOT]); - cnt += fprintf(outfp, "%6d, ", stat->min_tags[WEAK_SPOT]); - cnt += fprintf(outfp, "%7d, ", stat->max_tags[WEAK_SPOT]); + cnt += fprintf(outfp, "%6u, ", stat->min_tags[WEAK_SPOT]); + cnt += fprintf(outfp, "%7u, ", stat->max_tags[WEAK_SPOT]); cnt += fprintf(outfp, "%7.1lf, ", stat->avg_tags[WEAK_SPOT]); cnt += fprintf(outfp, "%7.1lf, ", stat->std_tags[WEAK_SPOT]); cnt += fprintf(outfp, "%8.5lf, ", stat->min_delta); @@ -338,11 +338,11 @@ int AtlasFileWriter::writeCcsdsStat (void* msg, int size, bool with_header) CcsdsPacketParser::pktStats_t* stat = (CcsdsPacketParser::pktStats_t*)data; if((size - typelen) == sizeof(CcsdsPacketParser::pktStats_t)) { - cnt += fprintf(outfp, "%6d, ", stat->total_pkts); - cnt += fprintf(outfp, "%6d, ", stat->total_bytes); - cnt += fprintf(outfp, "%6d, ", stat->pkts_dropped); - cnt += fprintf(outfp, "%3d, ", stat->curr_pkts); - cnt += fprintf(outfp, "%3d, ", stat->curr_bytes); + cnt += fprintf(outfp, "%6u, ", stat->total_pkts); + cnt += fprintf(outfp, "%6u, ", stat->total_bytes); + cnt += fprintf(outfp, "%6u, ", stat->pkts_dropped); + cnt += fprintf(outfp, "%3u, ", stat->curr_pkts); + cnt += fprintf(outfp, "%3u, ", stat->curr_bytes); cnt += fprintf(outfp, "%.1lf, ", stat->max_bps); cnt += fprintf(outfp, "%.1lf, ", stat->min_bps); cnt += fprintf(outfp, "%.1lf, ", stat->avg_bps); @@ -519,9 +519,6 @@ int AtlasFileWriter::writeTimeDiag (void* msg, int size, bool with_header) { int cnt = 0; - const int num_sxp_status = 11; - const char* sxp_status[num_sxp_status] = { "Unknown", "Good", "Not_Enabled", "Could_Not_Run", "Spot_At_TQ_Failed", "Spot_Velocity_Failed", "Range_Velocity_Failed", "Off_Nadir_Velocity_Failed", "Params_Failed", "Failed", "Timeout" }; - if(with_header) { cnt += fprintf(outfp, "%12s,%12s,%12s,%12s,%12s,%12s,%12s,%12s,%12s,%12s,%12s,%12s,%12s,%12s,%12s,%12s,%12s,%12s\n", "REF", "TIME_REF", "SC_1PPS", "SC_TAT_RX", "SC_ATT_RX", "SC_POS_RX", "SC_ATT_SOL", "SC_POS_SOL", "SXP_PCE1_TIME_RX", "SXP_PCE2_TIME_RX", "SXP_PCE3_TIME_RX", "SXP_1ST_MF1_EXTRAP", "SXP_1ST_MF2_EXTRAP", "SXP_1ST_MF3_EXTRAP", "PCE1_1ST_MF_AFTER_1PPS", "PCE2_1ST_MF_AFTER_1PPS", "PCE3_1ST_MF_AFTER_1PPS", "SXP_STATUS"); @@ -551,8 +548,10 @@ int AtlasFileWriter::writeTimeDiag (void* msg, int size, bool with_header) cnt += fprintf(outfp, "%12lf,", timediag->pce_1st_mf_1pps_delta[0]); cnt += fprintf(outfp, "%12lf,", timediag->pce_1st_mf_1pps_delta[1]); cnt += fprintf(outfp, "%12lf,", timediag->pce_1st_mf_1pps_delta[2]); + const int num_sxp_status = 11; if(timediag->sxp_status[0] >= 0 && timediag->sxp_status[0] < num_sxp_status) { + const char* sxp_status[num_sxp_status] = { "Unknown", "Good", "Not_Enabled", "Could_Not_Run", "Spot_At_TQ_Failed", "Spot_Velocity_Failed", "Range_Velocity_Failed", "Off_Nadir_Velocity_Failed", "Params_Failed", "Failed", "Timeout" }; cnt += fprintf(outfp, "%12s\n", sxp_status[timediag->sxp_status[0]]); } else diff --git a/plugins/atlas/plugin/AtlasFileWriter.h b/plugins/atlas/plugin/AtlasFileWriter.h index a4743c351..3d0b6c579 100644 --- a/plugins/atlas/plugin/AtlasFileWriter.h +++ b/plugins/atlas/plugin/AtlasFileWriter.h @@ -53,24 +53,24 @@ class AtlasFileWriter: public CcsdsFileWriter TIMEDIAG, TIMESTAT, INVALID - } fmt_t; + } atlas_fmt_t; - AtlasFileWriter (CommandProcessor* cmd_proc, const char* name, fmt_t _fmt, const char* _prefix, const char* inq_name, unsigned int _max_file_size=FILE_MAX_SIZE); + AtlasFileWriter (CommandProcessor* cmd_proc, const char* name, atlas_fmt_t _fmt, const char* _prefix, const char* inq_name, unsigned int _max_file_size=FILE_MAX_SIZE); virtual ~AtlasFileWriter (void); static CommandableObject* createObject (CommandProcessor* cmd_proc, const char* name, int argc, char argv[][MAX_CMD_SIZE]); - static fmt_t str2fmt (const char* str); - static const char* fmt2str (fmt_t _fmt); + static atlas_fmt_t str2fmt (const char* str); + static const char* fmt2str (atlas_fmt_t _fmt); protected: - int writeMsg (void* msg, int size, bool with_header=false); - bool isBinary (void); + int writeMsg (void* msg, int size, bool with_header=false) override; + bool isBinary (void) override; private: - fmt_t fmt; + atlas_fmt_t atlas_fmt; int writeSciPkt (void* record, int size, bool with_header=false); int writeSciCh (void* record, int size, bool with_header=false); diff --git a/plugins/atlas/plugin/AtlasHistogram.cpp b/plugins/atlas/plugin/AtlasHistogram.cpp index 1259e4cd6..d2b53f310 100644 --- a/plugins/atlas/plugin/AtlasHistogram.cpp +++ b/plugins/atlas/plugin/AtlasHistogram.cpp @@ -66,7 +66,7 @@ AtlasHistogram::AtlasHistogram(const char* _rec_type, type_t _type, RecordObject(_rec_type) { /* Set Histogram Pointer */ - hist = (hist_t*)recordData; + hist = reinterpret_cast(recordData); /* Initialize Histogram Fields */ hist->type = _type; diff --git a/plugins/atlas/plugin/CmdEchoProcessorModule.cpp b/plugins/atlas/plugin/CmdEchoProcessorModule.cpp index ed27bbb1e..0a4d8173a 100644 --- a/plugins/atlas/plugin/CmdEchoProcessorModule.cpp +++ b/plugins/atlas/plugin/CmdEchoProcessorModule.cpp @@ -98,7 +98,7 @@ CommandableObject* CmdEchoProcessorModule::createObject(CommandProcessor* cmd_pr ItosRecordParser* itos = NULL; if(itos_name != NULL) { - itos = (ItosRecordParser*)cmd_proc->getObject(itos_name, ItosRecordParser::TYPE); + itos = dynamic_cast(cmd_proc->getObject(itos_name, ItosRecordParser::TYPE)); if(itos == NULL) { mlog(CRITICAL, "Unable to locate ITOS record parser: %s", itos_name); @@ -120,10 +120,8 @@ bool CmdEchoProcessorModule::processSegments(List& segments, { (void)numpkts; - char echo_msg[ECHO_MSG_STR_SIZE]; - char task_prefix[8]; - bool status; - unsigned char* cmd_pkt; + char echo_msg[ECHO_MSG_STR_SIZE]; + char task_prefix[8]; /* Process Segments */ int numsegs = segments.length(); @@ -136,8 +134,8 @@ bool CmdEchoProcessorModule::processSegments(List& segments, /* Pull Out Fields */ memset(task_prefix, 0, 8); memcpy(task_prefix, pktbuf + 12, 7); - status = pktbuf[19] == 0 ? false : true; - cmd_pkt = &pktbuf[20]; + bool status = pktbuf[19] == 0 ? false : true; + unsigned char* cmd_pkt = &pktbuf[20]; /* Print Prolog */ if(pce == NOT_PCE) diff --git a/plugins/atlas/plugin/CmdEchoProcessorModule.h b/plugins/atlas/plugin/CmdEchoProcessorModule.h index 2c13365ea..073e2722a 100644 --- a/plugins/atlas/plugin/CmdEchoProcessorModule.h +++ b/plugins/atlas/plugin/CmdEchoProcessorModule.h @@ -71,7 +71,7 @@ class CmdEchoProcessorModule: public CcsdsProcessorModule * Methods *--------------------------------------------------------------------*/ - bool processSegments (List& segments, int numpkts); + bool processSegments (List& segments, int numpkts) override; }; #endif /* __cmd_echo_processor_module__ */ diff --git a/plugins/atlas/plugin/DiagLogProcessorModule.cpp b/plugins/atlas/plugin/DiagLogProcessorModule.cpp index 1704aa948..3710819a8 100644 --- a/plugins/atlas/plugin/DiagLogProcessorModule.cpp +++ b/plugins/atlas/plugin/DiagLogProcessorModule.cpp @@ -75,11 +75,10 @@ CommandableObject* DiagLogProcessorModule::createObject(CommandProcessor* cmd_pr { const char* diagq_name = StringLib::checkNullStr(argv[0]); const char* prefix = StringLib::checkNullStr(argv[1]); - int pcenum = NOT_PCE; if(argc > 2) { - pcenum = (int)strtol(argv[2], NULL, 0); + int pcenum = (int)strtol(argv[2], NULL, 0); if(pcenum < 1 || pcenum > NUM_PCES) { mlog(CRITICAL, "Invalid PCE specified: %d, must be between 1 and %d", pcenum, NUM_PCES); @@ -115,7 +114,6 @@ bool DiagLogProcessorModule::processSegments(List& segments, char diagmsg[DIAG_LOG_STR_SIZE + 2]; int msgindex = 0; - int msgsize = 0; /* Populate Prefix */ if(prefix) @@ -134,7 +132,7 @@ bool DiagLogProcessorModule::processSegments(List& segments, /* Copy Out Log Message */ int diagmsg_len = strnlen((const char*)&pktbuf[DIAG_LOG_START], DIAG_LOG_STR_SIZE - (DIAG_LOG_START + msgindex)); memcpy(&diagmsg[msgindex], &pktbuf[DIAG_LOG_START], diagmsg_len); - msgsize = diagmsg_len + msgindex; + int msgsize = diagmsg_len + msgindex; /* Decide on New Line */ if(diagmsg_len < (DIAG_LOG_STR_SIZE - DIAG_LOG_START)) diff --git a/plugins/atlas/plugin/DiagLogProcessorModule.h b/plugins/atlas/plugin/DiagLogProcessorModule.h index 52c45a440..d88a5f4ab 100644 --- a/plugins/atlas/plugin/DiagLogProcessorModule.h +++ b/plugins/atlas/plugin/DiagLogProcessorModule.h @@ -71,7 +71,7 @@ class DiagLogProcessorModule: public CcsdsProcessorModule * Methods *--------------------------------------------------------------------*/ - bool processSegments (List& segments, int numpkts); + bool processSegments (List& segments, int numpkts) override; }; #endif /* __diag_log_processor_module__ */ diff --git a/plugins/atlas/plugin/HstvsSimulator.cpp b/plugins/atlas/plugin/HstvsSimulator.cpp index 477a320d6..ece78bebc 100644 --- a/plugins/atlas/plugin/HstvsSimulator.cpp +++ b/plugins/atlas/plugin/HstvsSimulator.cpp @@ -46,10 +46,7 @@ ******************************************************************************/ #define _USE_MATH_DEFINES - -#ifdef __gnu__ #include -#endif #include "AltimetryHistogram.h" #include "HstvsSimulator.h" @@ -65,7 +62,12 @@ /*---------------------------------------------------------------------------- * Constructor - *----------------------------------------------------------------------------*/ -PedProbabilityEncoder::PedProbabilityEncoder() {} +PedProbabilityEncoder::PedProbabilityEncoder(): + iNumberInternalPedBits(0), + iNumberModes(0), + NumberValues(0), + MaxValue(0) + {} /*---------------------------------------------------------------------------- * Destructor - @@ -210,14 +212,10 @@ void PedProbabilityEncoder::generateHighestBitSet() if( int(HighestBitSet.size()) != NumberValues ) HighestBitSet.resize( NumberValues ); - int index; - int bitNumber; - int nextBitMask; - - index = 0; - for( bitNumber = -1; bitNumbermet <= weak_input->met) spot = STRONG_SPOT; - else if(weak_input->met < strong_input->met) spot = WEAK_SPOT; + else /*if(weak_input->met < strong_input->met)*/spot = WEAK_SPOT; // Insert Spot's Test Data // if(spot == INVALID_SPOT) { mlog(CRITICAL, "Unable to determine spot for current input"); - if(weak_input) delete weak_input; - if(strong_input) delete strong_input; + delete weak_input; + delete strong_input; break; } else if(spot == STRONG_SPOT) @@ -568,7 +566,9 @@ const unsigned long HstvsSimulator::WeakChannelOutMask[NUM_WEAK_RX_CHANNELS + 1] * Constructor - *----------------------------------------------------------------------------*/ HstvsSimulator::HstvsSimulator(CommandProcessor* cmd_proc, const char* obj_name, const char* histq_name): - CommandableObject(cmd_proc, obj_name, TYPE) + CommandableObject(cmd_proc, obj_name, TYPE), + enableSimulation(false), + channelEnableOverride(0) { /* Initialize Streams */ histQ = NULL; @@ -826,7 +826,6 @@ void HstvsSimulator::generateSimulatedOutput14(ped_command_output_t* cmdout, int void HstvsSimulator::writeCommandOutput(int64_t met, double prob_curve[NUM_SPOTS][NUM_PROB_BINS_IN_15KM], int32_t start_bin, int32_t num_bins) { ped_command_output_t cmdout; - uint16_t decodeProbabiltyModeBits; mlog(INFO, "Writing Command Output at met %lld for %d bins", (unsigned long long)met, num_bins); @@ -850,7 +849,7 @@ void HstvsSimulator::writeCommandOutput(int64_t met, double prob_curve[NUM_SPOTS // Write Rx Probabilities // int decodeProbabiltyMode = PedEncoder.determineModeToUse( &prob_curve[0][0], NUM_PROB_BINS_IN_15KM * NUM_SPOTS ); - decodeProbabiltyModeBits = PedEncoder.getModeCommandBits( decodeProbabiltyMode ); + uint16_t decodeProbabiltyModeBits = PedEncoder.getModeCommandBits( decodeProbabiltyMode ); for(int32_t i = 0; i < NUM_PROB_BINS_IN_15KM; i++) { @@ -1001,26 +1000,30 @@ void HstvsSimulator::populateProbCurve(test_input_t* input, double prob_curve[NU if(return_index == (NUM_RX_PER_TESTINPUT - 1)) // cloud return goes into last slot and is square { - double width_bins = ((input->signal_return[return_index].width / 1000000000.0) / PROB_BIN_PERIOD); - double cloud_start_bin = range_bins - (0.5 * width_bins); - double cloud_stop_bin = range_bins + (0.5 * width_bins); - double step_energy = step_bin * (input->signal_return[return_index].energy_pe / width_bins); - for(double sigbin = cloud_start_bin; sigbin <= cloud_stop_bin; sigbin+=step_bin) + double width_bins = ((input->signal_return[return_index].width / 1000000000.0) / PROB_BIN_PERIOD); + double cloud_start_bin = range_bins - (0.5 * width_bins); + double cloud_stop_bin = range_bins + (0.5 * width_bins); + double step_energy = step_bin * (input->signal_return[return_index].energy_pe / width_bins); + double sigbin = cloud_start_bin; + while(sigbin <= cloud_stop_bin) { event_buffer[((int)sigbin) % NUM_PROB_BINS_IN_15KM] += step_energy; + sigbin+=step_bin; } } else // gaussian return for ground and canopy { - double std_bins = (((input->signal_return[return_index].width * 0.5887) / 1000000000.0) / PROB_BIN_PERIOD) / 2.3548200; - double gnd_start_bin = range_bins - (4 * std_bins); - double gnd_stop_bin = range_bins + (4 * std_bins); - for(double sigbin = gnd_start_bin; sigbin <= gnd_stop_bin; sigbin+=step_bin) + double std_bins = (((input->signal_return[return_index].width * 0.5887) / 1000000000.0) / PROB_BIN_PERIOD) / 2.3548200; + double gnd_start_bin = range_bins - (4 * std_bins); + double gnd_stop_bin = range_bins + (4 * std_bins); + double sigbin = gnd_start_bin; + while(sigbin <= gnd_stop_bin) { double scalar = 1.0 / (std_bins * sqrt(2.0 * M_PI)); double exponent = pow(sigbin - range_bins, 2.0) / (2.0 * pow(std_bins, 2.0)); double pdf = scalar * exp(-exponent); event_buffer[((int)sigbin) % NUM_PROB_BINS_IN_15KM] += pdf * input->signal_return[return_index].energy_pe * step_bin; + sigbin+=step_bin; } } } diff --git a/plugins/atlas/plugin/HstvsSimulator.h b/plugins/atlas/plugin/HstvsSimulator.h index 4637541ca..3fd4615da 100644 --- a/plugins/atlas/plugin/HstvsSimulator.h +++ b/plugins/atlas/plugin/HstvsSimulator.h @@ -170,7 +170,7 @@ class PedProbabilityEncoder * TEST INPUT LIST ******************************************************************************/ -class TestInputList: public MgList +class TestInputList: public List { public: diff --git a/plugins/atlas/plugin/ItosRecord.cpp b/plugins/atlas/plugin/ItosRecord.cpp index 651352e02..22ab6d7b8 100644 --- a/plugins/atlas/plugin/ItosRecord.cpp +++ b/plugins/atlas/plugin/ItosRecord.cpp @@ -74,7 +74,7 @@ Record::~Record(void) *----------------------------------------------------------------------------*/ void Record::addSubRecord(Record* record) { - subrecords.add(record); + subrecords.push_back(record); } /*---------------------------------------------------------------------------- @@ -83,7 +83,7 @@ void Record::addSubRecord(Record* record) void Record::addValue(const char* value) { SafeString str(value); - subvalues.add(str); + subvalues.push_back(str); } /*---------------------------------------------------------------------------- @@ -139,7 +139,7 @@ void Record::setComment(const char* _comment) *----------------------------------------------------------------------------*/ int Record::getNumSubRecords(void) { - return subrecords.length(); + return subrecords.size(); } /*---------------------------------------------------------------------------- @@ -147,7 +147,7 @@ int Record::getNumSubRecords(void) *----------------------------------------------------------------------------*/ int Record::getNumSubValues(void) { - return subvalues.length(); + return subvalues.size(); } /*---------------------------------------------------------------------------- @@ -201,7 +201,7 @@ const char* Record::getDisplayName(void) const char* Record::getUndottedName (void) { if(name == NULL) return NULL; - SafeString s("%s", name); + SafeString s(0, "%s", name); s.replace(".", "_"); s.replace("[", "_"); s.replace("]", "_"); @@ -289,7 +289,10 @@ TypeConversion::~TypeConversion(void) void TypeConversion::addEnumLookup(const char* enum_name, const char* value) { SafeString* valstr = new SafeString(value); - lookup.add(enum_name, valstr); + if(!lookup.add(enum_name, valstr)) + { + delete valstr; + } } /*---------------------------------------------------------------------------- @@ -1316,9 +1319,8 @@ Field* FloatField::duplicate(void) unsigned long FloatField::getRawValue (int element) { assert(element < numElements); - double val = value[element]; - unsigned long* raw_ptr = (unsigned long*)&val; - return *raw_ptr; + cast_t* cast = reinterpret_cast(&value[element]); + return cast->ival; } /*---------------------------------------------------------------------------- @@ -1408,23 +1410,23 @@ bool FloatField::populate (unsigned char* pkt) { /* Decompose Packet */ int i = 0; - unsigned long _value = 0; + cast_t _value; + _value.ival = 0; while(bits_left > 0) { int byte_mask = (1 << MIN(8, bits_left)) - 1; - _value += (pkt[byte_index--] & byte_mask) * (unsigned long)pow(2, bits_to_shift + (i++ * 8)); + _value.ival += (pkt[byte_index--] & byte_mask) * (unsigned long)pow(2, bits_to_shift + (i++ * 8)); bits_left -= 8; } /* Set Value */ - double* candidate = (double*)&_value; - if(!rangeChecking || (*candidate >= minRange && *candidate <= maxRange)) + if(!rangeChecking || (_value.dval >= minRange && _value.dval <= maxRange)) { - value[n] = *candidate; + value[n] = _value.dval; } else { - mlog(ERROR, "Failed to populate field %s from packet %04X due to out of bounds input %lf [%lf, %lf]", record->getName(), CCSDS_GET_SID(pkt), *candidate, minRange, maxRange); + mlog(ERROR, "Failed to populate field %s from packet %04X due to out of bounds input %lf [%lf, %lf]", record->getName(), CCSDS_GET_SID(pkt), _value.dval, minRange, maxRange); status = false; } } @@ -1618,8 +1620,8 @@ Filter::Filter ( int _q, int s = 0; while(_sources[s] != NULL) { - SafeString ss("%s", _sources[s]); - source.add(ss); + SafeString ss(0, "%s", _sources[s]); + source.push_back(ss); s++; } } @@ -1654,7 +1656,7 @@ const char* Filter::getProperty (const char* name) else if (strcmp(name, "task") == 0) snprintf(str, MAX_STR_LEN, "%s", task); else if (strcmp(name, "source") == 0) { - for(int s = 0; s < source.length(); s++) + for(int s = 0; s < source.size(); s++) { StringLib::concat(str, source[s].str(), MAX_STR_LEN); StringLib::concat(str, " ", MAX_STR_LEN); @@ -1733,13 +1735,13 @@ Packet::Packet(packet_type_t _packet_type, bool _populate, const char* _apid_des fields.add(sequenceCountFld); fields.add(lengthFld); - orphanRecs.add(ccsdsVersion); - orphanRecs.add(ccsdsCmdTlm); - orphanRecs.add(secondaryHeader); - orphanRecs.add(applicationId); - orphanRecs.add(segmentationFlags); - orphanRecs.add(sequenceCount); - orphanRecs.add(length); + orphanRecs.push_back(ccsdsVersion); + orphanRecs.push_back(ccsdsCmdTlm); + orphanRecs.push_back(secondaryHeader); + orphanRecs.push_back(applicationId); + orphanRecs.push_back(segmentationFlags); + orphanRecs.push_back(sequenceCount); + orphanRecs.push_back(length); currBitOffset = 48; currByteOffset = 6; @@ -1751,7 +1753,7 @@ Packet::Packet(packet_type_t _packet_type, bool _populate, const char* _apid_des *----------------------------------------------------------------------------*/ Packet::~Packet(void) { - for(int i = 0; i < orphanRecs.length(); i++) orphanFree(orphanRecs[i]); + for(int i = 0; i < orphanRecs.size(); i++) orphanFree(orphanRecs[i]); if(name) delete [] name; if(packetApidDesignation) delete [] packetApidDesignation; } @@ -2081,6 +2083,7 @@ void Packet::calcAttributes (void) Packet* Packet::duplicate(void) { Packet* pkt = _duplicate(); + if(!pkt) return NULL; pkt->packetType = packetType; pkt->declaration = declaration; @@ -2090,7 +2093,7 @@ Packet* Packet::duplicate(void) pkt->currByteOffset = currByteOffset; int _apid_designation_len = (int)strlen(packetApidDesignation) + 1; - if(pkt->packetApidDesignation != NULL) delete [] pkt->packetApidDesignation; + delete [] pkt->packetApidDesignation; pkt->packetApidDesignation = new char[_apid_designation_len]; memset(pkt->packetApidDesignation, 0, _apid_designation_len); StringLib::copy(pkt->packetApidDesignation, packetApidDesignation, _apid_designation_len); @@ -2402,8 +2405,8 @@ CommandPacket::CommandPacket(command_packet_type_t _type, bool _populate): Packe fields.add(fc_f); fields.add(cs_f); - orphanRecs.add(fc); - orphanRecs.add(cs); + orphanRecs.push_back(fc); + orphanRecs.push_back(cs); numBytes += 2; currBitOffset += 16; @@ -2502,7 +2505,10 @@ const char* TelemetryPacket::apidDesignation = RECORD_DEFAULT_APID_DESIGNATION; /*---------------------------------------------------------------------------- * Constructor - *----------------------------------------------------------------------------*/ -TelemetryPacket::TelemetryPacket(telemetry_packet_type_t _type, bool _populate): Packet(TELEMETRY, _populate, TelemetryPacket::apidDesignation) +TelemetryPacket::TelemetryPacket(telemetry_packet_type_t _type, bool _populate): + Packet(TELEMETRY, _populate, TelemetryPacket::apidDesignation), + filter(NULL), + timeout(0) { if(_populate) { @@ -2519,8 +2525,8 @@ TelemetryPacket::TelemetryPacket(telemetry_packet_type_t _type, bool _populate): fields.add(ts_days_f); fields.add(ts_ms_f); - orphanRecs.add(ts_days); - orphanRecs.add(ts_ms); + orphanRecs.push_back(ts_days); + orphanRecs.push_back(ts_ms); numBytes += 6; currBitOffset += 48; @@ -2548,8 +2554,8 @@ bool TelemetryPacket::setPktProperty (const char* property_name, const char* val if(strcmp(property_name, "applyWhen") == 0) { - SafeString valstr("%s", value); - applyWhen.add(valstr); + SafeString valstr(0, "%s", value); + applyWhen.push_back(valstr); } else if(strcmp(property_name, "timeout") == 0) { @@ -2603,7 +2609,7 @@ Packet* TelemetryPacket::_duplicate (void) { Packet* tpkt = new TelemetryPacket(STANDARD, false); - for(int i = 0; i < applyWhen.length(); i++) + for(int i = 0; i < applyWhen.size(); i++) { tpkt->setPktProperty("applyWhen", applyWhen[i].str()); } diff --git a/plugins/atlas/plugin/ItosRecord.h b/plugins/atlas/plugin/ItosRecord.h index 8a7280a2c..b40bae5da 100644 --- a/plugins/atlas/plugin/ItosRecord.h +++ b/plugins/atlas/plugin/ItosRecord.h @@ -35,6 +35,7 @@ #include "core.h" #include "ccsds.h" #include "legacy.h" +#include "SafeString.h" /************************************************* * DEFINES @@ -99,8 +100,8 @@ namespace Itos bool prototype; const char* type; const char* name; - List subrecords; - List subvalues; + vector subrecords; + vector subvalues; const char* comment; }; @@ -285,12 +286,12 @@ namespace Itos bool _big_endian ); ~IntegerField (void); - Field* duplicate (void); - unsigned long getRawValue (int element); - const char* getStrValue (int element); - bool _setProperty (const char* property, const char* _value, int index); - const char* _getProperty (const char* property, int index); - bool populate (unsigned char* pkt); + Field* duplicate (void) override; + unsigned long getRawValue (int element) override; + const char* getStrValue (int element) override; + bool _setProperty (const char* property, const char* _value, int index) override; + const char* _getProperty (const char* property, int index) override; + bool populate (unsigned char* pkt) override; private: @@ -330,12 +331,12 @@ namespace Itos bool _big_endian ); ~UnsignedField (void); - Field* duplicate (void); - unsigned long getRawValue (int element); - const char* getStrValue (int element); - bool _setProperty (const char* property, const char* _value, int index); - const char* _getProperty (const char* property, int index); - bool populate (unsigned char* pkt); + Field* duplicate (void) override; + unsigned long getRawValue (int element) override; + const char* getStrValue (int element) override; + bool _setProperty (const char* property, const char* _value, int index) override; + const char* _getProperty (const char* property, int index) override; + bool populate (unsigned char* pkt) override; private: @@ -375,12 +376,12 @@ namespace Itos bool _big_endian ); ~FloatField (void); - Field* duplicate (void); - unsigned long getRawValue (int element); - const char* getStrValue (int element); - bool _setProperty (const char* property, const char* _value, int index); - const char* _getProperty (const char* property, int index); - bool populate (unsigned char* pkt); + Field* duplicate (void) override; + unsigned long getRawValue (int element) override; + const char* getStrValue (int element) override; + bool _setProperty (const char* property, const char* _value, int index) override; + const char* _getProperty (const char* property, int index) override; + bool populate (unsigned char* pkt) override; private: @@ -418,12 +419,12 @@ namespace Itos bool _big_endian ); ~StringField (void); - Field* duplicate (void); - unsigned long getRawValue (int element); - const char* getStrValue (int element); - bool _setProperty (const char* property, const char* _value, int index); - const char* _getProperty (const char* property, int index); - bool populate (unsigned char* pkt); + Field* duplicate (void) override; + unsigned long getRawValue (int element) override; + const char* getStrValue (int element) override; + bool _setProperty (const char* property, const char* _value, int index) override; + const char* _getProperty (const char* property, int index) override; + bool populate (unsigned char* pkt) override; private: @@ -480,7 +481,7 @@ namespace Itos char type[MAX_STR_LEN]; char sender[MAX_STR_LEN]; char task[MAX_STR_LEN]; - List source; + vector source; }; /************************************************* @@ -512,7 +513,7 @@ namespace Itos /* Methods */ /* -------------------------- */ - Packet (packet_type_t _packet_type, bool populate=true, const char* _apid_designation=RECORD_DEFAULT_APID_DESIGNATION); + explicit Packet (packet_type_t _packet_type, bool populate=true, const char* _apid_designation=RECORD_DEFAULT_APID_DESIGNATION); virtual ~Packet (void); void addField ( Record* record, @@ -570,8 +571,8 @@ namespace Itos packet_type_t packetType; Record* declaration; // allocated externally - List orphanRecs; // records that need to be cleaned up if packet is deleted - MgList fields; + vector orphanRecs; // records that need to be cleaned up if packet is deleted + List fields; int numBytes; char* name; // allocated locally @@ -608,12 +609,12 @@ namespace Itos /* Methods */ /* -------------------------- */ - CommandPacket (command_packet_type_t _type, bool populate=true); + explicit CommandPacket (command_packet_type_t _type, bool populate=true); ~CommandPacket (void); - bool setPktProperty (const char* property_name, const char* value); // for setting packet properties - const char* getPktProperty (const char* property_name); // for getting packet properties - Packet* _duplicate (void); + bool setPktProperty (const char* property_name, const char* value) override; // for setting packet properties + const char* getPktProperty (const char* property_name) override; // for getting packet properties + Packet* _duplicate (void) override; static void setDesignations (const char* _apid_str, const char* _fc_str); @@ -657,9 +658,9 @@ namespace Itos TelemetryPacket (telemetry_packet_type_t _type = STANDARD, bool populate=true); ~TelemetryPacket (void); - bool setPktProperty (const char* property_name, const char* value); // for setting packet properties - const char* getPktProperty (const char* property_name); // for getting packet properties - Packet* _duplicate (void); + bool setPktProperty (const char* property_name, const char* value) override; // for setting packet properties + const char* getPktProperty (const char* property_name) override; // for getting packet properties + Packet* _duplicate (void) override; void setFilter (Filter* _filter); const char* getFilterProperty (const char* property_name); @@ -677,7 +678,7 @@ namespace Itos /* Data */ /* -------------------------- */ - List applyWhen; + vector applyWhen; Filter* filter; long timeout; SafeString source; @@ -699,6 +700,15 @@ namespace Itos TypeConversion* conversion; }; + /************************************************* + * Types + *************************************************/ + + typedef union { + double dval; + uint64_t ival; + } cast_t; + } /* namespace Itos */ #endif /* __itos_record__ */ diff --git a/plugins/atlas/plugin/ItosRecordParser.cpp b/plugins/atlas/plugin/ItosRecordParser.cpp index 02f310d61..cd84a4a7a 100644 --- a/plugins/atlas/plugin/ItosRecordParser.cpp +++ b/plugins/atlas/plugin/ItosRecordParser.cpp @@ -91,7 +91,7 @@ CommandableObject* ItosRecordParser::createObject(CommandProcessor* cmd_proc, co /*---------------------------------------------------------------------------- * getDictionary - *----------------------------------------------------------------------------*/ -MgDictionary* ItosRecordParser::getDictionary(void) +Dictionary* ItosRecordParser::getDictionary(void) { return &dictionary; } @@ -99,7 +99,7 @@ MgDictionary* ItosRecordParser::getDictionary(void) /*---------------------------------------------------------------------------- * etPackets - *----------------------------------------------------------------------------*/ -MgList* ItosRecordParser::getPackets(void) +List* ItosRecordParser::getPackets(void) { return &packets; } @@ -115,7 +115,7 @@ const char* ItosRecordParser::pkt2str(unsigned char* packet) if(CCSDS_IS_CMD(packet)) { int fc = CCSDS_GET_FC(packet); - for(int p = 0; p < cmdPackets[apid].length(); p++) + for(int p = 0; p < cmdPackets[apid].size(); p++) { CommandPacket* command_packet = (CommandPacket*)cmdPackets[apid][p]; const char* fc_str = command_packet->getProperty(CommandPacket::fcDesignation, "value", 0); @@ -133,7 +133,7 @@ const char* ItosRecordParser::pkt2str(unsigned char* packet) } else if(CCSDS_IS_TLM(packet)) { - for(int p = 0; p < tlmPackets[apid].length(); p++) + for(int p = 0; p < tlmPackets[apid].size(); p++) { TelemetryPacket* telemetry_packet = (TelemetryPacket*)tlmPackets[apid][p]; if(telemetry_packet->populate(packet)) @@ -233,16 +233,16 @@ bool ItosRecordParser::parseFilterTbl(SafeString* fcontents) { if(fcontents == NULL) return false; - List* dynlines = fcontents->split('\n'); - List& lines = *dynlines; // alias + List* dynlines = StringLib::split(fcontents->str(), fcontents->length(), '\n'); + List& lines = *dynlines; // alias for(int l = 0; l < lines.length(); l++) { - mlog(DEBUG, "PARSING: %s", lines[l].str()); - SafeString line("%s", lines[l].str()); - List* dynatoms = line.split(' '); - List& atoms = *dynatoms; + mlog(DEBUG, "PARSING: %s", lines[l]->c_str()); + SafeString line(0, "%s", lines[l]->c_str()); + List* dynatoms = StringLib::split(line.str(), line.length(), ' '); + List& atoms = *dynatoms; - const char* start_str = atoms[0].str(); + const char* start_str = atoms[0]->c_str(); if(start_str[0] == '!') { continue; @@ -250,18 +250,18 @@ bool ItosRecordParser::parseFilterTbl(SafeString* fcontents) long q = 0; // atoms[0] long spw = 0; // atoms[1] - const char* fsw_define = atoms[3].str(); + const char* fsw_define = atoms[3]->c_str(); long sid = 0; // atoms[4] double rate = 0; // atoms[5] - const char* type = atoms[6].str(); - const char* sender = atoms[7].str(); - const char* task = atoms[8].str(); + const char* type = atoms[6]->c_str(); + const char* sender = atoms[7]->c_str(); + const char* task = atoms[8]->c_str(); const char** sources = NULL; - StringLib::str2long(atoms[0].str(), &q); - StringLib::str2long(atoms[1].str(), &spw); - StringLib::str2long(atoms[4].str(), &sid); - StringLib::str2double(atoms[5].str(), &rate); + StringLib::str2long(atoms[0]->c_str(), &q); + StringLib::str2long(atoms[1]->c_str(), &spw); + StringLib::str2long(atoms[4]->c_str(), &sid); + StringLib::str2double(atoms[5]->c_str(), &rate); int num_sources = atoms.length() - 9; if(num_sources > 0) @@ -269,7 +269,7 @@ bool ItosRecordParser::parseFilterTbl(SafeString* fcontents) sources = new const char * [num_sources + 1]; for(int a = 0; a < num_sources; a++) { - sources[a] = atoms[a + 9].str(true); + sources[a] = StringLib::duplicate(atoms[a + 9]->c_str()); } sources[num_sources] = NULL; } @@ -302,7 +302,7 @@ bool ItosRecordParser::parseRecTokens(SafeString* fcontents) if(fcontents == NULL) return false; char token[Record::MAX_TOKEN_SIZE]; - long tindex = 0; + long tindex; long findex = 0; long fsize = fcontents->bytes(); bool offset_hack = false; @@ -334,7 +334,7 @@ bool ItosRecordParser::parseRecTokens(SafeString* fcontents) token[tindex++] = (*fcontents)[findex++]; } } - SafeString ss("%s", token); + SafeString ss(0, "%s", token); if(ss.length() > 0) tokens.add(ss); } else @@ -431,7 +431,7 @@ bool ItosRecordParser::parseRecTokens(SafeString* fcontents) offset_hack = true; } - SafeString ss("%s", token); + SafeString ss(0, "%s", token); if(ss.length() > 0) tokens.add(ss); } else @@ -488,7 +488,6 @@ bool ItosRecordParser::checkComment (int* c_index, Record* c_record, int* index) if(c_record != NULL) { c_record->setComment(tokens[*index].str()); - c_record = NULL; } else { @@ -768,7 +767,7 @@ void ItosRecordParser::populatePacket (Record* subrec, Packet* pkt, Record* conr subrec->isType("F") || subrec->isType("S")) { - mnemonics.add(subrec); + mnemonics.push_back(subrec); } else { @@ -819,12 +818,13 @@ Packet* ItosRecordParser::createPacket (Record* declaration, Packet* pkt, Record for(int s = 0; s < declaration->getNumSubRecords(); s++) { Record* srec = declaration->getSubRecord(s); - if(srec->isType("Structure") == false) + if(!srec->isType("Structure")) { srec->setPrototype((*system_declaration)->isPrototype()); mlog(DEBUG, "SYSTEM DECLARATION: %d, %s, %s", srec->isPrototype(), srec->getType(), srec->getName()); - assert(srec->isValue() == false); + bool is_value = srec->isValue(); + assert(!is_value); Packet* syspkt = createPacket(srec, NULL, system_declaration, struct_declaration, 0); if(syspkt != NULL) packets.add(syspkt); @@ -864,7 +864,7 @@ Packet* ItosRecordParser::createPacket (Record* declaration, Packet* pkt, Record } else if(declaration->isType("Alias")) { - aliases.add(declaration); + aliases.push_back(declaration); return NULL; // do no additional work for Alias at the moment } else if(declaration->isType("U") || @@ -874,7 +874,7 @@ Packet* ItosRecordParser::createPacket (Record* declaration, Packet* pkt, Record { if(!declaration->isPrototype()) { - mnemonics.add(declaration); + mnemonics.push_back(declaration); } return NULL; } @@ -954,14 +954,14 @@ Packet* ItosRecordParser::createPacket (Record* declaration, Packet* pkt, Record if(!instantiations.find(sysname)) { declaration->getName(); - List* instlist = new List(); - instlist->add(declaration); + vector* instlist = new vector(); + instlist->push_back(declaration); instantiations.add(sysname, instlist); } else { - List* instlist = instantiations[sysname]; - instlist->add(declaration); + vector* instlist = instantiations[sysname]; + instlist->push_back(declaration); } /* Process Sub Records */ @@ -1017,7 +1017,8 @@ void ItosRecordParser::createPackets (void) { Record* declaration = declarations[r]; mlog(DEBUG, "DECLARATION: %d, %s, %s", declaration->isPrototype(), declaration->getType(), declaration->getName()); - assert(declaration->isValue() == false); + bool is_value = declaration->isValue(); + assert(!is_value); Record* system = NULL; Record* structure = NULL; Packet* packet = createPacket(declaration, NULL, &system, &structure, 0); @@ -1049,7 +1050,7 @@ void ItosRecordParser::createPackets (void) void ItosRecordParser::createMnemonics (void) { /* Transverse through Mnemonics */ - for(int u = 0; u < mnemonics.length(); u++) + for(int u = 0; u < mnemonics.size(); u++) { Record* mnem = mnemonics[u]; mlog(INFO, "Generating definition for mnemonic: %s", mnem->getName()); @@ -1065,10 +1066,10 @@ void ItosRecordParser::createMnemonics (void) if(instantiations.find(tmpname)) { instantiated = true; - List* instlist = instantiations[tmpname]; - for(int i = 0; i < instlist->length(); i++) + vector* instlist = instantiations[tmpname]; + for(int i = 0; i < instlist->size(); i++) { - Record* instrec = instlist->get(i); + Record* instrec = instlist->at(i); char newname[Record::MAX_TOKEN_SIZE]; snprintf(newname, Record::MAX_TOKEN_SIZE, "%s.%s", instrec->getName(), dotptr + 1); SafeString instname(newname); @@ -1161,10 +1162,10 @@ void ItosRecordParser::createMnemonics (void) int l = strnlen(def->source, MAX_STR_SIZE); while(l > 0) { - char pkt_name[MAX_STR_SIZE]; while(l > 0 && def->source[l] != '.') l--; if(l > 0) { + char pkt_name[MAX_STR_SIZE]; memcpy(pkt_name, def->source, l); pkt_name[l] = '\0'; l--; // move to next character @@ -1192,10 +1193,10 @@ void ItosRecordParser::createMnemonics (void) int l = strnlen(def->name, MAX_STR_SIZE); while(l > 0) { - char pkt_name[MAX_STR_SIZE]; while(l > 0 && def->name[l] != '.') l--; if(l > 0) { + char pkt_name[MAX_STR_SIZE]; memcpy(pkt_name, def->name, l); pkt_name[l] = '\0'; l--; // move to next character @@ -1217,12 +1218,12 @@ void ItosRecordParser::createMnemonics (void) } /* Add Mnemonic to Definition List */ - mneDefinitions.add(def); + mneDefinitions.push_back(def); } } /* Sort Mnemonic Definitions */ - for(int i = 1; i < mneDefinitions.length(); i++) + for(int i = 1; i < mneDefinitions.size(); i++) { Mnemonic* tmp1 = mneDefinitions[i]; int j = i; @@ -1233,10 +1234,10 @@ void ItosRecordParser::createMnemonics (void) { break; } - mneDefinitions.set(j, tmp2); + mneDefinitions[j] = tmp2; j--; } - mneDefinitions.set(j, tmp1); + mneDefinitions[j] = tmp1; } } @@ -1248,7 +1249,7 @@ void ItosRecordParser::createMnemonics (void) void ItosRecordParser::createCmdTlmLists(void) { /* Get Packets */ - MgList* pkts = getPackets(); + List* pkts = getPackets(); for(int p = 0; p < pkts->length(); p++) { Packet* pkt = (Packet*)pkts->get(p); @@ -1257,11 +1258,11 @@ void ItosRecordParser::createCmdTlmLists(void) { if(pkt->isType(Packet::COMMAND)) { - cmdPackets[apid].add(pkt); + cmdPackets[apid].push_back(pkt); } else if(pkt->isType(Packet::TELEMETRY)) { - tlmPackets[apid].add(pkt); + tlmPackets[apid].push_back(pkt); } } else @@ -1440,18 +1441,23 @@ const char* ItosRecordParser::createCTSummary (const char* pkttype, bool local) const char* ItosRecordParser::createPacketDetails (Packet* packet) { #define MAX_CT_DETIALS_STRING_SIZE 5000 - char tmp[MAX_CT_DETIALS_STRING_SIZE]; - SafeString html = SafeString(1000); + SafeString html = SafeString(1000); if(packet->isPrototype() == false) { + char tmp[MAX_CT_DETIALS_STRING_SIZE]; mlog(INFO, "Generating detailed report for packet: %s", packet->getName()); if(optUserEditable) { snprintf(tmp, MAX_CT_DETIALS_STRING_SIZE, "
"); html += tmp; } snprintf(tmp, MAX_CT_DETIALS_STRING_SIZE, "

%s ", packet->getName(), packet->getName()); html += tmp; - if(optUserEditable) { html += ""; } - if(optUserEditable) { snprintf(tmp, MAX_CT_DETIALS_STRING_SIZE, "", packet->getUndottedName()); html += tmp; } - if(optUserEditable) { snprintf(tmp, MAX_CT_DETIALS_STRING_SIZE, "", packet->isType(Packet::COMMAND) ? "command" : "telemetry"); html += tmp; } + if(optUserEditable) + { + html += ""; + snprintf(tmp, MAX_CT_DETIALS_STRING_SIZE, "", packet->getUndottedName()); + html += tmp; + snprintf(tmp, MAX_CT_DETIALS_STRING_SIZE, "", packet->isType(Packet::COMMAND) ? "command" : "telemetry"); + html += tmp; + } html += "

"; if(optUserEditable) { html += "
"; } @@ -1506,7 +1512,7 @@ const char* ItosRecordParser::createPacketDetails (Packet* packet) const char* comment = packet->getComment(); if(comment != NULL) { - SafeString safe_comment("%s", comment + 3); + SafeString safe_comment(0, "%s", comment + 3); safe_comment.replace("\n", "
"); html += "\n"; html += " \n"; @@ -1733,7 +1739,7 @@ const char* ItosRecordParser::createMNSummary (bool local) html += " \n"; html += " \n"; - for(int u = 0; u < mneDefinitions.length(); u++) + for(int u = 0; u < mneDefinitions.size(); u++) { Mnemonic* mnem = mneDefinitions[u]; @@ -1844,8 +1850,6 @@ bool ItosRecordParser::writeFile (const char* fname, const char* fcontents, long *----------------------------------------------------------------------------*/ void ItosRecordParser::generateReport(const char* reporttemplate, const char* summarytemplate, const char* outputpath) { - char fullreportname[256], cmdreportname[256], tlmreportname[256], mnereportname[256], pktreportname[512]; - /* Get Time String */ char timestr[25] = {'\0'}; TimeLib::gmt_time_t timeinfo = TimeLib::gmttime(); @@ -1870,6 +1874,7 @@ void ItosRecordParser::generateReport(const char* reporttemplate, const char* su } else { + char fullreportname[256]; report->replace("$DATE", timestr); report->replace("$APPENDIX_A1", createCTSummary("cmd")); report->replace("$APPENDIX_A2", createCTSummary("tlm")); @@ -1888,6 +1893,7 @@ void ItosRecordParser::generateReport(const char* reporttemplate, const char* su } else { + char cmdreportname[256]; cmdsummary->replace("$DATE", timestr); cmdsummary->replace("$APPENDIX_CONTENT", createCTSummary("cmd", false)); snprintf(cmdreportname, 256, "%s_cmd.html", outputpath); @@ -1903,6 +1909,7 @@ void ItosRecordParser::generateReport(const char* reporttemplate, const char* su } else { + char tlmreportname[256]; tlmsummary->replace("$DATE", timestr); tlmsummary->replace("$APPENDIX_CONTENT", createCTSummary("tlm", false)); snprintf(tlmreportname, 256, "%s_tlm.html", outputpath); @@ -1918,6 +1925,7 @@ void ItosRecordParser::generateReport(const char* reporttemplate, const char* su } else { + char mnereportname[256]; mnesummary->replace("$DATE", timestr); mnesummary->replace("$APPENDIX_CONTENT", createMNSummary(false)); sprintf(mnereportname, "%s_mne.html", outputpath); @@ -1937,6 +1945,7 @@ void ItosRecordParser::generateReport(const char* reporttemplate, const char* su } else { + char pktreportname[512]; pktsummary->replace("$DATE", timestr); pktsummary->replace("$APPENDIX_CONTENT", pkthtml); snprintf(pktreportname, 256, "%s_%s.html", outputpath, pktname); @@ -1953,8 +1962,6 @@ void ItosRecordParser::generateReport(const char* reporttemplate, const char* su *----------------------------------------------------------------------------*/ void ItosRecordParser::generateDocuments(const char* documenttemplate, const char* outputpath) { - char cmddocname[256], tlmdocname[256], mnedocname[256]; - /* Get Time String */ char timestr[25] = {'\0'}; TimeLib::gmt_time_t timeinfo = TimeLib::gmttime(); @@ -1984,6 +1991,7 @@ void ItosRecordParser::generateDocuments(const char* documenttemplate, const cha } else { + char cmddocname[256]; cmddoc->replace("$DATE", timestr); cmddoc->replace("$SUMMARY", createCTSummary("cmd", true)); cmddoc->replace("$DESCRIPTIONS", cmdpktdoc.str(true)); @@ -2000,6 +2008,7 @@ void ItosRecordParser::generateDocuments(const char* documenttemplate, const cha } else { + char tlmdocname[256]; tlmdoc->replace("$DATE", timestr); tlmdoc->replace("$SUMMARY", createCTSummary("tlm", true)); tlmdoc->replace("$DESCRIPTIONS", tlmpktdoc.str(true)); @@ -2016,6 +2025,7 @@ void ItosRecordParser::generateDocuments(const char* documenttemplate, const cha } else { + char mnedocname[256]; mnedoc->replace("$DATE", timestr); mnedoc->replace("$SUMMARY", createMNSummary(true)); mnedoc->replace("$DESCRIPTIONS", ""); @@ -2196,7 +2206,7 @@ int ItosRecordParser::buildDatabaseCmd(int argc, char argv[][MAX_CMD_SIZE]) createCmdTlmLists(); /* Populate Mnemonics */ - mlog(CRITICAL, "Populating list of mnemonics... from %d records", mnemonics.length()); + mlog(CRITICAL, "Populating list of mnemonics... from %lu records", mnemonics.size()); createMnemonics(); return 0; @@ -2215,7 +2225,7 @@ int ItosRecordParser::buildRecordsCmd(int argc, char argv[][MAX_CMD_SIZE]) char namebuf[Itos::Record::MAX_TOKEN_SIZE]; /* Get Packets */ - MgList* pkts = getPackets(); + List* pkts = getPackets(); for(int p = 0; p < pkts->length(); p++) { Packet* pkt = (Packet*)pkts->get(p); @@ -2415,7 +2425,7 @@ int ItosRecordParser::datasrvExportCmd(int argc, char argv[][MAX_CMD_SIZE]) /* Get Packets */ long data_key = 0; - MgList* pkts = getPackets(); + List* pkts = getPackets(); for(int p = 0; p < pkts->length(); p++) { Packet* pkt = (Packet*)pkts->get(p); diff --git a/plugins/atlas/plugin/ItosRecordParser.h b/plugins/atlas/plugin/ItosRecordParser.h index dcfa285b5..a44dd557d 100644 --- a/plugins/atlas/plugin/ItosRecordParser.h +++ b/plugins/atlas/plugin/ItosRecordParser.h @@ -54,8 +54,8 @@ class ItosRecordParser: public CommandableObject static CommandableObject* createObject (CommandProcessor* cmd_proc, const char* name, int argc, char argv[][MAX_CMD_SIZE]); - MgDictionary* getDictionary (void); - MgList* getPackets (void); + Dictionary* getDictionary (void); + List* getPackets (void); const char* pkt2str (unsigned char* packet); private: @@ -66,26 +66,25 @@ class ItosRecordParser: public CommandableObject List tokens; // all tokens in rec files - MgList filters; // all filter entries in filter table + List filters; // all filter entries in filter table - MgDictionary dictionary; // key'ed database of all records + Dictionary dictionary; // key'ed database of all records - Dictionary*, false> instantiations; // given a system prototype name, gives list of instantiated system records + Dictionary*> instantiations; // given a system prototype name, gives list of instantiated system records - MgList declarations; // zero-depth records in rec files - MgList packets; // list of all the packet definitions: commands, telemetry - List mnemonics; // zero-depth list of all the mnemonics definitions - MgList conversions; // zero-depth list of all discrete conversions - List aliases; // zero-depth list of all aliases + List declarations; // zero-depth records in rec files + List packets; // list of all the packet definitions: commands, telemetry + vector mnemonics; // zero-depth list of all the mnemonics definitions + List conversions; // zero-depth list of all discrete conversions + vector aliases; // zero-depth list of all aliases bool optFullPktDetails; // option to show all fields in a packet when generating a report bool optUserEditable; // option to provide edit buttons interactively via mod_python bool optRemoteContent; // option to use local content vs remote iframe content for packet display - List cmdPackets[CCSDS_NUM_APIDS]; - List tlmPackets[CCSDS_NUM_APIDS]; - List mneDefinitions; - + vector cmdPackets[CCSDS_NUM_APIDS]; + vector tlmPackets[CCSDS_NUM_APIDS]; + vector mneDefinitions; /*-------------------------------------------------------------------- * Methods diff --git a/plugins/atlas/plugin/LaserProcessorModule.h b/plugins/atlas/plugin/LaserProcessorModule.h index b05feabea..ef728ad8d 100644 --- a/plugins/atlas/plugin/LaserProcessorModule.h +++ b/plugins/atlas/plugin/LaserProcessorModule.h @@ -90,7 +90,7 @@ class LaserProcessorModule: public CcsdsProcessorModule * Methods *--------------------------------------------------------------------*/ - bool processSegments (List& segments, int numpkts); + bool processSegments (List& segments, int numpkts) override; double laserConv (const laserConv_t* c, double temp, long raw); double tempConv (const double c[NUM_POLY_COEFFS], long raw); int attachApidsCmd (int argc, char argv[][MAX_CMD_SIZE]); diff --git a/plugins/atlas/plugin/MajorFrameProcessorModule.h b/plugins/atlas/plugin/MajorFrameProcessorModule.h index da5b7e6f4..95c37e89b 100644 --- a/plugins/atlas/plugin/MajorFrameProcessorModule.h +++ b/plugins/atlas/plugin/MajorFrameProcessorModule.h @@ -176,7 +176,7 @@ class MajorFrameProcessorModule: public CcsdsProcessorModule * Methods *--------------------------------------------------------------------*/ - bool processSegments (List& segments, int numpkts); + bool processSegments (List& segments, int numpkts) override; }; typedef MajorFrameProcessorModule::majorFrameData_t mfdata_t; // short cut diff --git a/plugins/atlas/plugin/SafeString.cpp b/plugins/atlas/plugin/SafeString.cpp index 16cca4a49..4c18ed9ed 100644 --- a/plugins/atlas/plugin/SafeString.cpp +++ b/plugins/atlas/plugin/SafeString.cpp @@ -63,11 +63,12 @@ SafeString::SafeString(long _maxlen) *----------------------------------------------------------------------------*/ SafeString::SafeString(long _maxlen, const char* _str, ...) { + (void)_maxlen; if(_str != NULL) { va_list args; va_start(args, _str); - len = vsnprintf(NULL, _maxlen, _str, args) + 1; // get length + len = vsnprintf(NULL, 0, _str, args) + 1; // get length va_end(args); carray = new char[len]; // allocate memory maxlen = len; @@ -549,6 +550,8 @@ SafeString& SafeString::operator+=(const char* rstr) *----------------------------------------------------------------------------*/ SafeString& SafeString::operator=(const SafeString& rhs) { + if(&rhs == this) return *this; + if(maxlen < rhs.len) { delete [] carray; diff --git a/plugins/atlas/plugin/TimeProcessorModule.h b/plugins/atlas/plugin/TimeProcessorModule.h index a814a2003..74b031feb 100644 --- a/plugins/atlas/plugin/TimeProcessorModule.h +++ b/plugins/atlas/plugin/TimeProcessorModule.h @@ -204,7 +204,7 @@ class TimeProcessorModule: public CcsdsProcessorModule * Methods *--------------------------------------------------------------------*/ - bool processSegments (List& segments, int numpkts); + bool processSegments (List& segments, int numpkts) override; bool parseSimHkPkt (unsigned char* pktbuf); bool parseSxpHkPkt (unsigned char* pktbuf); diff --git a/plugins/atlas/plugin/TimeTagHistogram.cpp b/plugins/atlas/plugin/TimeTagHistogram.cpp index 0bd3a26cd..dea0b0140 100644 --- a/plugins/atlas/plugin/TimeTagHistogram.cpp +++ b/plugins/atlas/plugin/TimeTagHistogram.cpp @@ -101,7 +101,7 @@ TimeTagHistogram::TimeTagHistogram( AtlasHistogram::type_t _type, int _intperiod /* Initialize Internal Data */ memset(tags, 0, sizeof(tags)); - deepFree = _deep_free; + (void)_deep_free; // no longer used /* Initialize Serializable Data */ memset(tt->channelBiases, 0, sizeof(tt->channelBiases)); @@ -124,18 +124,7 @@ TimeTagHistogram::~TimeTagHistogram(void) { for(int i = 0; i < tt->hist.size; i++) { - if(tags[i] != NULL) - { - if(deepFree) - { - for(int k = 0; k < tags[i]->length(); k++) - { - delete tags[i]->get(k); - } - } - delete tags[i]; - tags[i] = NULL; - } + delete tags[i]; } } diff --git a/plugins/atlas/plugin/TimeTagHistogram.h b/plugins/atlas/plugin/TimeTagHistogram.h index b4a3841b5..79ffea396 100644 --- a/plugins/atlas/plugin/TimeTagHistogram.h +++ b/plugins/atlas/plugin/TimeTagHistogram.h @@ -100,7 +100,7 @@ class TimeTagHistogram: public AtlasHistogram const stat_t* getPktStats (void); static recordDefErr_t defineHistogram (void); - bool calcAttributes (double sigwidth, double bincal); // returns if signal is found + bool calcAttributes (double sigwidth, double bincal) override; // returns if signal is found private: @@ -112,7 +112,6 @@ class TimeTagHistogram: public AtlasHistogram static int rec_elem; List* tags[MAX_HIST_SIZE]; - bool deepFree; ttHist_t* tt; }; diff --git a/plugins/atlas/plugin/TimeTagProcessorModule.cpp b/plugins/atlas/plugin/TimeTagProcessorModule.cpp index 660abbbf1..a7b442b0a 100644 --- a/plugins/atlas/plugin/TimeTagProcessorModule.cpp +++ b/plugins/atlas/plugin/TimeTagProcessorModule.cpp @@ -361,7 +361,6 @@ bool TimeTagProcessorModule::processSegments(List& segments, int intperiod = numpkts; double cvr = 0.0; // calibration value rising double cvf = 0.0; // calibration value falling - uint64_t amet = 0; long mfc = 0; double rws[NUM_SPOTS] = { 0.0, 0.0 }; double rww[NUM_SPOTS] = { 0.0, 0.0 }; @@ -377,6 +376,7 @@ bool TimeTagProcessorModule::processSegments(List& segments, TimeTagHistogram* hist[NUM_SPOTS] = { NULL, NULL }; /* Uninitialized Data */ + uint64_t amet; mfdata_t mfdata; pktStat_t pkt_stat; chStat_t mf_ch_stat; @@ -1192,7 +1192,7 @@ bool TimeTagProcessorModule::processSegments(List& segments, if(resultFile) { - fprintf(resultFile, "%ld, %d, %d, %u, %d, %d, %d, %d, %d, %d, %lf, %lf, %lf, %lf, %lf, %lf, %lf, %lf, %lf, %lf, %lf, %lf, %d, %d, %d, %d, %d, %d, %d, %d, %d, %d, %d, %d, %d, %d, %d, %d, %d, %d, %d, %d, %ld, %04X, %d, %d, %04X, %d, %d, %04X, %d, %d, %04X, %d, %d\n", + fprintf(resultFile, "%ld, %d, %d, %u, %d, %d, %u, %u, %u, %u, %lf, %lf, %lf, %lf, %lf, %lf, %lf, %lf, %lf, %lf, %lf, %lf, %u, %u, %u, %u, %u, %u, %u, %u, %u, %u, %u, %u, %u, %u, %u, %u, %u, %u, %u, %u, %ld, %04X, %u, %u, %04X, %u, %u, %04X, %u, %u, %04X, %u, %u\n", mfc, intperiod, num_shots, pkt_stat.sum_tags, hist[STRONG_SPOT]->getSum(), hist[WEAK_SPOT]->getSum(), tx_min_tags[STRONG_SPOT], tx_max_tags[STRONG_SPOT], tx_min_tags[WEAK_SPOT], tx_max_tags[WEAK_SPOT], @@ -1218,11 +1218,6 @@ bool TimeTagProcessorModule::processSegments(List& segments, delete hist[s]; } - for(int i = 0; i < shot_data_list.length(); i++) - { - delete shot_data_list[i]; - } - if( pkt_stat.mfc_errors + pkt_stat.hdr_errors + pkt_stat.fmt_errors + diff --git a/plugins/atlas/plugin/TimeTagProcessorModule.h b/plugins/atlas/plugin/TimeTagProcessorModule.h index b1357096c..674726de7 100644 --- a/plugins/atlas/plugin/TimeTagProcessorModule.h +++ b/plugins/atlas/plugin/TimeTagProcessorModule.h @@ -305,7 +305,7 @@ class TimeTagProcessorModule: public CcsdsProcessorModule * Methods *--------------------------------------------------------------------*/ - bool processSegments (List& segments, int numpkts); + bool processSegments (List& segments, int numpkts) override; int removeDuplicatesCmd (int argc, char argv[][MAX_CMD_SIZE]); int setClkPeriodCmd (int argc, char argv[][MAX_CMD_SIZE]);
Database Comments: