Functions | |
std::string | format (const int32_t &value, const int &ndigits=8) |
std::string | format (const int64_t &value, const int &ndigits=16) |
std::string | format (const std::string &decimalString, const int &ndigits=8) |
int64_t | unsafeParse (const std::string &hexString) |
bool | isValidHex (const std::string &hexString) |
bool | parse (const std::string &hexString, int32_t &decimalValue) |
bool | parse (const std::string &hexString, int64_t &decimalValue) |
Utilities for parsing and formatting integers in hex.
std::string novadaq::HexUtils::format | ( | const int32_t & | value, |
const int & | ndigits | ||
) |
Formats the specified 32-bit integer as a hex string with the specified number of hex digits.
Definition at line 14 of file HexUtils.cpp.
Referenced by run_unfold_ppfx_multiprocess.Task::__call__(), run_unfold_systs_multiprocess.Task::__call__(), run_unfold_genie_multiprocess.Task::__call__(), run_unfold_genie_multiprocess.Task::__str__(), dbutils::gui::ConfigDataTreeModel::_populateSubTree(), HTMLView.HTMLView::add_figure(), HTMLView.HTMLView::add_plot_information(), air::AirShower::analyze(), ViewHTML::assumptionsToTable(), ancestor.Ancestor::book_hists(), vdbl.Vdbl::book_hists(), nuray.Nuray::book_hists(), tgtexit.Tgtexit::book_hists(), decay.Decay::book_hists(), regression::callbacks(), plot_validation_datamc_2018::Caption(), check_jobs::check_dir(), getGoodRuns4SAM::consolidate(), ViewHTML::definitionListToExplorerData(), ViewHTML::directoryToTable(), bp_docdb.DocDB::DownloadArchive(), bp_docdb.DocDB::DownloadFile(), stan::lang::dump_program_line(), PandAna.reco_validation.prod5_pid_validation::event_count_report(), mjf_common::fcl_loop(), highe::HighEnergyFilt::filter(), PandAna.utils.misc::FindPandAnaDir(), format(), regression::generate_name(), PandAna.reco_validation.plot_pid_data_mc_cvn2020::get_all_files(), check_jobs::get_complete_jobs(), check_jobs::get_files(), PandAna.reco_validation.prod5_pid_validation_data_mc::get_files_nd(), plot_xsec_1d::get_genie_universes(), plot_xsec_2d::get_genie_universes(), plot_xsec_1d::get_ppfx_universes(), plot_xsec_2d::get_ppfx_universes(), POTPopulateData::get_runs(), POTGetData::get_runs(), POTSpillRate::get_spills(), POTPopulateData::get_spills(), POTGetData::get_spills(), canMan.Table::getLatex(), PandAna.core.filesource.listsource::getnextfile(), PandAna.core.filesource.globsource::getnextfile(), runNovaSAM::getOutputFileName(), runNovaSAM_cmake::getOutputFileName(), canMan.Table::getReadable(), dbutils::gui::BitmapEditor::getResult(), modify_metadata_with_upmu_sample_type::getSubRunType(), daqdataformats::VERSION_NAMESPACE::RawNanoSlice::getWordPointer(), PandAna.core.filesource.sourcewrapper::isproj(), isValidHex(), bp_utils::ListBlessedFilesInDir(), bp_utils::ListCaptionFilesInDir(), bp_utils::ListPlotsInDirForCaption(), dbutils::gui::ConfigDataTableModel::loadData(), art::TimeTracker::logToDestination_(), spectra_to_pyobj::main(), PandAna.utils.sadd_pandana::main(), main(), GetSpillData::main(), NNoiseSliceHitPerSRStudy::main(), OnMonTriggerRateStudy::main(), BeamWidthStudy::main(), garching_flux_to_genie_root::main(), PandAna.reco_validation.plot_pid_data_mc_cvn2020::main(), POTSpillRate::main(), PandAna.reco_validation.prod5_pid_validation::main(), run_unfold_genie_multiprocess::make_cmd(), run_unfold_ppfx_multiprocess::make_cmd(), run_unfold_systs_multiprocess::make_cmd(), runNovaSAM::makeDeCAF(), MCenterSpills::mc7_spills_between(), nova_uptime::mc7_spills_between(), build_tools::merge_all(), build_tools::merge_extraps(), build_tools::merge_jobs(), POTSpillRate::num_spills_between(), soup::old_soup_composition(), PandAna.reco_validation.prod5_pid_validation_data_mc::plot_data_mc(), PandAna.reco_validation.prod5_pid_validation::plot_ratio(), ddthelpers::print(), daqdataformats::VERSION_NAMESPACE::RawSummaryDCMData::print(), daqdataformats::VERSION_NAMESPACE::RawMicroBlock::print(), daqdataformats::VERSION_NAMESPACE::RawDataBlock::print(), daqdataformats::VERSION_NAMESPACE::RawEvent::print(), daqdataformats::VERSION_NAMESPACE::RawSummaryDCMDataHeader::print(), daqdataformats::RawDCMChan::print(), daqdataformats::VERSION_NAMESPACE::RawTriggerRange::print(), daqdataformats::VERSION_NAMESPACE::RawConfigurationName::print(), daqdataformats::VERSION_NAMESPACE::RawConfigurationSystemID::print(), daqdataformats::VERSION_NAMESPACE::RawMicroBlockHeader::print(), daqdataformats::VERSION_NAMESPACE::RawSummaryDroppedMicroblock::print(), daqdataformats::VERSION_NAMESPACE::RawMicroSliceHeader::print(), daqdataformats::VERSION_NAMESPACE::RawConfigurationTail::print(), daqdataformats::VERSION_NAMESPACE::RawSummaryDCMDataPoint::print(), daqdataformats::VERSION_NAMESPACE::RawTriggerTimingMarker::print(), daqdataformats::VERSION_NAMESPACE::RawEventTail::print(), daqdataformats::VERSION_NAMESPACE::RawTrigger::print(), daqdataformats::VERSION_NAMESPACE::RawTriggerMask::print(), daqdataformats::VERSION_NAMESPACE::RawTriggerTime::print(), daqdataformats::VERSION_NAMESPACE::RawDataBlockHeader::print(), daqdataformats::VERSION_NAMESPACE::RawTriggerHeader::print(), daqdataformats::VERSION_NAMESPACE::RawConfigurationHeader::print(), daqdataformats::VERSION_NAMESPACE::RawNanoSlice::print(), daqdataformats::VERSION_NAMESPACE::RawEventHeader::print(), daqdataformats::VERSION_NAMESPACE::RawNanoSliceHeader::print(), daqdataformats::VERSION_NAMESPACE::RawRunHeader::print(), util::print_composition(), daqdataformats::RawDAQData::printBuffer(), daqdataformats::RawTimingMarker::printStandard(), daqdataformats::RawMilliSlice::printStandard(), daqdataformats::RawMilliSliceHeader::printStandard(), evdb::PrintDialog::PrintToFile(), daqdataformats::RawDAQData::printWordHex(), PandAna.reco_validation.prod5_pid_validation_data_mc::prod5_pid_data_mc(), bp_utils::progressBar(), utilities::progressBar(), soup::radlength(), mjf_common::random_subruns(), regression::regression(), rootgINukeVal(), run_unfold_ppfx_multiprocess.Consumer::run(), run_unfold_systs_multiprocess.Consumer::run(), run_unfold_genie_multiprocess.Consumer::run(), nova_uptime::run_at(), run_unfold_ppfx_multiprocess::RunMultiProcess(), run_unfold_systs_multiprocess::RunMultiProcess(), run_unfold_genie_multiprocess::RunMultiProcess(), MCenterSpills::runs_for_period(), nova_uptime::runs_for_period(), ViewHTML::samFileInfoSummaryTable(), APDHVSetting_M150::settings(), NDAPDHVSetting::settings(), APDHVSetting::settings(), soup::soup_composition(), hadd_reco_validation::source_script(), submit_reco_validation::source_script(), pot-for-runs::spills_between(), nova_uptime::spills_between(), HexUtilTests::testFormat(), ViewHTML::tierConfigurationsTables(), soup::totalstoppingpower(), pvc::totalstopppingpower(), and genie::Spline::YCanBeNegative().
std::string novadaq::HexUtils::format | ( | const int64_t & | value, |
const int & | ndigits | ||
) |
Formats the specified 32-bit integer as a hex string with the specified number of hex digits.
Definition at line 26 of file HexUtils.cpp.
std::string novadaq::HexUtils::format | ( | const std::string & | decimalString, |
const int & | ndigits | ||
) |
Reformats the specified decimal number string into a hex string with the specified number of hex digits. (The maximum number of supported hex digits is 16, corresponding to a 64-bit number.)
an | exception of the parsing of the decimalString into an integer fails. |
Definition at line 42 of file HexUtils.cpp.
References format().
bool novadaq::HexUtils::isValidHex | ( | const std::string & | hexString | ) |
Tests whether the specified string contains a valid number in hex format.
Definition at line 74 of file HexUtils.cpp.
References format(), string, cet::trim_copy(), and unsafeParse().
Referenced by parse(), dbutils::gui::ConfigDataTreeModel::saveChanges(), and HexUtilTests::testValidity().
bool novadaq::HexUtils::parse | ( | const std::string & | hexString, |
int32_t & | decimalValue | ||
) |
Parses the specified hex string into a 32-bit decimal value. Returns true if the parsing succeeded, and false if not.
Definition at line 96 of file HexUtils.cpp.
References isValidHex().
Referenced by dbutils::gui::BitmapEditor::BitmapEditor(), dbutils::gui::ConfigDataTreeModel::saveChanges(), and HexUtilTests::testParse().
bool novadaq::HexUtils::parse | ( | const std::string & | hexString, |
int64_t & | decimalValue | ||
) |
Parses the specified hex string into a 64-bit decimal value. Returns true if the parsing succeeded, and false if not.
Definition at line 112 of file HexUtils.cpp.
References isValidHex().
int64_t novadaq::HexUtils::unsafeParse | ( | const std::string & | hexString | ) |
Parses the specified string into a 64-bit decimal value, assuming that the string contains a numeric value in hex, but does not do any checking that the hex string is valid.
NOTE that if the input string is not valid hex, the resulting integer value will essentially be a random number.
Definition at line 62 of file HexUtils.cpp.
Referenced by isValidHex().