add method to return map sizes#4294
Conversation
📝 WalkthroughWalkthroughThis PR adds four public const accessor methods to ChangesCDBTTree map size accessors and documentation
Warning There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure. 🔧 Infer (1.2.0)offline/database/cdbobjects/CDBTTree.ccoffline/database/cdbobjects/CDBTTree.cc:3:10: fatal error: 'phool/phool.h' file not found ... [truncated 1090 characters] ... clang/18/include" Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
Run ID: 00692e6b-a1c1-42b0-aa01-1f90d2902c2d
📒 Files selected for processing (2)
offline/database/cdbobjects/CDBTTree.ccoffline/database/cdbobjects/CDBTTree.h
| { | ||
| std::string fieldname = "g" + name; | ||
| // if (m_SingleUInt64EntryMap.contains(fieldname)) | ||
| // if (m_SingleUInt64EntryMap.contains(fieldname)) |
There was a problem hiding this comment.
Missing negation operator in commented contains() check.
The commented line should read if (!m_SingleUInt64EntryMap.contains(fieldname)) to match the active logic on line 292, which checks whether the key is not found. The other three setter methods (lines 233, 252, 271) correctly include the ! operator in their commented equivalents.
🔧 Proposed fix
- // if (m_SingleUInt64EntryMap.contains(fieldname))
+ // if (!m_SingleUInt64EntryMap.contains(fieldname))📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| // if (m_SingleUInt64EntryMap.contains(fieldname)) | |
| // if (!m_SingleUInt64EntryMap.contains(fieldname)) |
Build & test reportReport for commit bd113267254a3754b7718efe222573c69b054c81:
Automatically generated by sPHENIX Jenkins continuous integration |
|
jenkins seems stuck, merging this now |
3d98726
into
sPHENIX-Collaboration:master



Types of changes
What kind of change does this PR introduce? (Bug fix, feature, ...)
In some cases one needs the number of entries in the maps. This PR adds methods which return those.
TODOs (if applicable)
Links to other PRs in macros and calibration repositories (if applicable)
PR Summary: Map Size Accessor Methods for CDBTTree
Motivation & Context
This PR adds public accessor methods to the
CDBTTreeclass, which is part of the sPHENIX Collaboration's Conditions Database Objects system. The CDBTTree class manages calibration parameters organized in internal maps by channel and parameter name, supporting four data types: float, double, int, and uint64_t. These new methods provide direct access to the number of entries stored in each data type's map, enabling users to query map sizes for validation, diagnostics, and data completeness checks.Key Changes
size_t GetFloatMapSize() const— returns count of float channel entriessize_t GetDoubleMapSize() const— returns count of double channel entriessize_t GetIntMapSize() const— returns count of int channel entriessize_t GetUInt64MapSize() const— returns count of uint64_t channel entriesPotential Risk Areas
Context
The underlying maps (e.g.,
m_FloatEntryMap,m_DoubleEntryMap) are nested std::map structures where the outer map key is a channel ID and inner maps contain parameter names to values. The new accessors expose only the outer map sizes, providing a convenient way to check how many channels have calibration data without exposing implementation details.Note: As per collaboration guidelines, AI-generated analysis may contain inaccuracies; code review should verify implementation details directly.