9 Commits

Author SHA1 Message Date
Andrew Dirksen
cbedbb7819 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>
2026-03-20 06:58:36 +01:00
Ricardo Rodriguez
12929849f5 Make MaeWriter to throw on errors. (#8297)
* allow MaeWriter to throw

* update tests

* throw ValueErrorException

* add note on backward incompatible change of behavior
2025-02-25 16:59:40 +01:00
Greg Landrum
da6cd73168 Run clang-format across everything (#7849)
* run clang-format-18 across Code/*.cpp and Code/*.h

* run clang-format-18 across External
2024-09-26 13:39:02 +02:00
Ricardo Rodriguez
9a9eacc8b6 MaeWriter: handle the R group label property and update the Maestro property prefixing (#7454)
* update prefix to _rdkit_, special treatment for group label prop

* update tests
2024-05-30 14:11:19 +02:00
Ricardo Rodriguez
a9b7881b8b Fixes #7153 (#7441)
* ignore ct stereo status, enh stereo status, atom type on read

* do not prefix maestro properties

* add a test
2024-05-16 19:42:46 +02:00
Ric
e605bf04ca Fixes #6973 (#6974)
* fix + tests

* do not read atoms with at_num 0, -1, 3
2023-12-10 06:03:08 +01:00
Rachel Walker
7e8c4ef1cc Add support for writing chirality and stereo in MaeWriter (#6810)
* Add support for writing atom numbering chirality and any double bond stereo in maewriter

* Dan's suggestions
2023-11-09 06:36:11 +01:00
Ric
8d50d3d27c Drop the s_m_color_rgb property from MaeWriter (#6511)
* do not write s_m_color_rgb

* Add tests
2023-07-14 07:53:42 +02:00
Ric
1e1ff0b084 Start a Maestro file (.mae) writer. (#6069)
* start MaeWriter class

* start Wrapping MaeWriter

* mol -> mae block conversion

* copy general properties, except stereo

* improve docstrings

* Fix property filtering

* fail if no atoms; do not write empty bond blocks

* update atom indexes in bond block

* Fixes in MaeMolSupplier: check for duplicate bond definitions, stip property prefixes.

* add some tests

* adjust access, make dp_writer unique_ptr

* make Mol Writers non copyable

* extract bond translation to mapBond

* add write overload with heavy atom color arg

* forward declare mae::Writer, reverse CMakeFile changes

* revert the property filtering "fix"

* add some Python tests

* fix the windows build

* implement getText() static method

* mark the close() method as override

* locally undefine RDK_BUILD_MAEPARSER_SUPPORT
2023-02-17 11:53:17 +01:00