mirror of
https://github.com/rdkit/rdkit.git
synced 2026-06-03 21:44:30 +08:00
Hide data representation inside RDKit::Dict (#9113)
* Remove Dict::getData() for a strict abstraction boundary Replace direct access to Dict's internal std::vector<Pair> with encapsulated methods: size(), empty(), const iteration via begin()/end(), appendPair(), markNonPOD(), and getRawVal(). This enables future changes to Dict's internal representation without breaking callers. Ref: rdkit/rdkit#9112 * Harden Dict::appendPair to take a populated Pair by move appendPair(Pair&&) now auto-detects non-POD status via RDValue::needsCleanup(), eliminating markNonPOD() and the risk of dangling references or uninitialized entries. needsCleanup() is placed next to destroy() on RDValue to keep the POD/non-POD distinction in one place. * Remove vestigial dictHasNonPOD param from streamReadProp Both callers ignored the output. Non-POD detection is now handled by Dict::appendPair via RDValue::needsCleanup(). * unbork java build * Address PR review: bulk append, rename getRawVal, add custom data test - Add Dict::append(vector<Pair>&&) for bulk insertion with reserve - Use bulk append in streamReadProps to restore pre-allocation - Rename getRawVal -> getRDValue per reviewer preference - Add test verifying custom AnyTag data is destroyed through Dict lifecycle * heed self-review * don't manually implement vec.insert * Add test: ExplicitBitVect round-trip through Dict serialization Exercises the full streamWriteProps/streamReadProps path with an ExplicitBitVect in an RDProps Dict, confirming the custom handler is invoked and no memory is leaked (verified under valgrind). * in anyTag test, assert destructors ran a specific number of times. --------- Co-authored-by: bddap (Coding Agent) <andrew+bot@dirksen.com>
This commit is contained in:
@@ -40,6 +40,11 @@
|
||||
|
||||
%ignore RDKit::Dict::Pair;
|
||||
%ignore RDKit::PairHolder;
|
||||
%ignore RDKit::Dict::extend;
|
||||
%ignore RDKit::Dict::getRDValue;
|
||||
%ignore RDKit::Dict::begin;
|
||||
%ignore RDKit::Dict::end;
|
||||
%ignore RDKit::Dict::const_iterator;
|
||||
%include <RDGeneral/Dict.h>
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user