RDKit: RDValue-taggedunion.h Source File

| RDKit Open-source cheminformatics and machine learning.

Loading...
Searching...
No Matches
RDValue-taggedunion.h
Go to the documentation of this file.
1// Copyright (c) 2015, Novartis Institutes for BioMedical Research Inc.
2// All rights reserved.
3//
4// Redistribution and use in source and binary forms, with or without
5// modification, are permitted provided that the following conditions are
6// met:
7//
8// * Redistributions of source code must retain the above copyright
9// notice, this list of conditions and the following disclaimer.
10// * Redistributions in binary form must reproduce the above
11// copyright notice, this list of conditions and the following
12// disclaimer in the documentation and/or other materials provided
13// with the distribution.
14// * Neither the name of Novartis Institutes for BioMedical Research Inc.
15// nor the names of its contributors may be used to endorse or promote
16// products derived from this software without specific prior written
17// permission.
18//
19// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
20// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
21// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
22// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
23// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
24// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
25// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
26// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
27// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
28// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
29// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30//
31#include <RDGeneral/export.h>
32#ifndef RDKIT_RDVALUE_TAGGED_UNION_H
33#define RDKIT_RDVALUE_TAGGED_UNION_H
34
35#include <cassert>
36#include "Invariant.h"
37#include <iomanip>
38#include <sstream>
39#include <vector>
40#include <cstdint>
41#include <RDGeneral/BoostStartInclude.h>
42#include <cstdint>
43#include <any>
44#include <boost/utility.hpp>
45#include <boost/lexical_cast.hpp>
46#include <boost/numeric/conversion/cast.hpp>
47#include <boost/type_traits/is_floating_point.hpp>
48#include <RDGeneral/BoostEndInclude.h>
49#include "LocaleSwitcher.h"
50
51#define RDVALUE_HASBOOL
52
53namespace RDKit {
54
55// RDValue does not dynamically create POD types (kind of like
56// cdiggins::any) However, it doesn't use RTTI type info
57// directly, it uses a companion short valued type
58// to determine what to do.
59// For unregistered types, it falls back to std::any.
60// The Size of an RDAny is (sizeof(double) + sizeof(short) == 10 bytes
61// (aligned to actually 16 so hard to pass as value type)
62//
63// For the sake of compatibility, errors throw std::bad_any_cast
64//
65// Examples:
66//
67// RDAny v(2.);
68// v = 1;
69// std::vector<double> d;
70// v == d;
71// v.asDoubleVect().push_back(4.)
72// rdany_cast<std::vector<double>(v).push_back(4.)
73//
74// Falls back to std::any for non registered types
75// v = boost::shared_ptr<ROMol>(new ROMol(m));
76//
77
78// RDValue does not manange memory of non-pod data
79// this must be done externally (string, Any, vector...)
80// Tagged union
81
82namespace RDTypeTag {
83 const short EmptyTag = 0;
84const short IntTag = 1;
85const short DoubleTag = 2;
86const short StringTag = 3;
87const short FloatTag = 4;
88const short BoolTag = 5;
89const short UnsignedIntTag = 6;
90const short AnyTag = 7;
91const short VecDoubleTag = 8;
92const short VecFloatTag = 9;
93const short VecIntTag = 10;
94const short VecUnsignedIntTag = 11;
95const short VecStringTag = 12;
96template <class T>
97 inline short GetTag() {
98 return AnyTag;
99}
100template <>
101 inline short GetTag<double>() {
102 return DoubleTag;
103}
104template <>
105 inline short GetTag<float>() {
106 return FloatTag;
107}
108template <>
109 inline short GetTag<int>() {
110 return IntTag;
111}
112template <>
113 inline short GetTag<unsigned int>() {
114 return UnsignedIntTag;
115}
116template <>
117 inline short GetTag<bool>() {
118 return BoolTag;
119}
120template <>
121 inline short GetTag<std::string>() {
122 return StringTag;
123}
124template <>
125 inline short GetTag<std::vector<double>>() {
126 return VecDoubleTag;
127}
128template <>
129 inline short GetTag<std::vector<float>>() {
130 return VecFloatTag;
131}
132template <>
133 inline short GetTag<std::vector<int>>() {
134 return VecIntTag;
135}
136template <>
137 inline short GetTag<std::vector<unsigned int>>() {
138 return VecUnsignedIntTag;
139}
140template <>
141 inline short GetTag<std::vector<std::string>>() {
142 return VecStringTag;
143}
144template <>
145 inline short GetTag<std::any>() {
146 return AnyTag;
147}
148
149 namespace detail {
150 union Value {
151 double d;
152 float f;
153 int i;
154 unsigned u;
155 bool b;
156 std::string *s;
157 std::any *a;
158 std::vector<double> *vd;
159 std::vector<float> *vf;
160 std::vector<int> *vi;
161 std::vector<unsigned int> *vu;
162 std::vector<std::string> *vs;
163
164 inline Value() {}
165 inline Value(double v) : d(v) {}
166 inline Value(float v) : f(v) {}
167 inline Value(int v) : i(v) {}
168 inline Value(unsigned int v) : u(v) {}
169 inline Value(bool v) : b(v) {}
170 inline Value(std::string *v) : s(v) {}
171 inline Value(std::any *v) : a(v) {}
172 inline Value(std::vector<double> *v) : vd(v) {}
173 inline Value(std::vector<float> *v) : vf(v) {}
174 inline Value(std::vector<int> *v) : vi(v) {}
175 inline Value(std::vector<unsigned int> *v) : vu(v) {}
176 inline Value(std::vector<std::string> *v) : vs(v) {}
177};
178
179template <class T>
180 inline T *valuePtrCast(Value value) {
181 return std::any_cast<T *>(*value.a);
182}
183template <>
184 inline std::any *valuePtrCast<std::any>(Value value) {
185 return value.a;
186}
187
188template <>
189 inline std::string *valuePtrCast<std::string>(Value value) {
190 return value.s;
191}
192template <>
193inline std::vector<double> *valuePtrCast<std::vector<double>>(Value value) {
194 return value.vd;
195}
196template <>
197inline std::vector<float> *valuePtrCast<std::vector<float>>(Value value) {
198 return value.vf;
199}
200template <>
201inline std::vector<int> *valuePtrCast<std::vector<int>>(Value value) {
202 return value.vi;
203}
204template <>
205inline std::vector<unsigned int> *valuePtrCast<std::vector<unsigned int>>(
206 Value value) {
207 return value.vu;
208}
209template <>
210inline std::vector<std::string> *valuePtrCast<std::vector<std::string>>(
211 Value value) {
212 return value.vs;
213}
214} // namespace detail
215} // namespace RDTypeTag
216
217struct RDValue {
218 RDTypeTag::detail::Value value;
219 short type;
220 short reserved_tag = 0; // 16 bit alignment
221
222 inline RDValue() : value(0.0), type(RDTypeTag::EmptyTag) {}
223 // Pod Style (Direct storage)
224 inline RDValue(double v) : value(v), type(RDTypeTag::DoubleTag) {}
225 inline RDValue(float v) : value(v), type(RDTypeTag::FloatTag) {}
226 inline RDValue(int v) : value(v), type(RDTypeTag::IntTag) {}
227 inline RDValue(unsigned v) : value(v), type(RDTypeTag::UnsignedIntTag) {}
228 inline RDValue(bool v) : value(v), type(RDTypeTag::BoolTag) {}
229
230 inline RDValue(std::any *v) : value(v), type(RDTypeTag::AnyTag) {}
231
232 // Copies passed in pointers
233 inline RDValue(const std::any &v)
234 : value(new std::any(v)), type(RDTypeTag::AnyTag) {}
235 inline RDValue(const std::string &v)
236 : value(new std::string(v)), type(RDTypeTag::StringTag) {}
237 template <class T>
238 inline RDValue(const T &v)
239 : value(new std::any(v)), type(RDTypeTag::AnyTag) {}
240
241 inline RDValue(const std::vector<double> &v)
242 : value(new std::vector<double>(v)), type(RDTypeTag::VecDoubleTag) {}
243 inline RDValue(const std::vector<float> &v)
244 : value(new std::vector<float>(v)), type(RDTypeTag::VecFloatTag) {}
245 inline RDValue(const std::vector<int> &v)
246 : value(new std::vector<int>(v)), type(RDTypeTag::VecIntTag) {}
247 inline RDValue(const std::vector<unsigned int> &v)
248 : value(new std::vector<unsigned int>(v)),
249 type(RDTypeTag::VecUnsignedIntTag) {}
250 inline RDValue(const std::vector<std::string> &v)
251 : value(new std::vector<std::string>(v)), type(RDTypeTag::VecStringTag) {}
252
253 short getTag() const { return type; }
254
255 // ptrCast - unsafe, use rdvalue_cast instead.
256 template <class T>
257 inline T *ptrCast() const {
258 return RDTypeTag::detail::valuePtrCast<T>(value);
259 }
260
261 // RDValue doesn't have an explicit destructor, it must
262 // be wrapped in a container.
263 // The idea is that POD types don't need to be destroyed
264 // and this allows the container optimization possibilities.
265 void destroy() {
266 switch (type) {
267 case RDTypeTag::StringTag:
268 delete value.s;
269 break;
270 case RDTypeTag::AnyTag:
271 delete value.a;
272 break;
273 case RDTypeTag::VecDoubleTag:
274 delete value.vd;
275 break;
276 case RDTypeTag::VecFloatTag:
277 delete value.vf;
278 break;
279 case RDTypeTag::VecIntTag:
280 delete value.vi;
281 break;
282 case RDTypeTag::VecUnsignedIntTag:
283 delete value.vu;
284 break;
285 case RDTypeTag::VecStringTag:
286 delete value.vs;
287 break;
288 default:
289 break;
290 }
291 type = RDTypeTag::EmptyTag;
292 }
293
294 static // Given a type and an RDAnyValue - delete the appropriate structure
295 inline void
296 cleanup_rdvalue(RDValue &rdvalue) {
297 rdvalue.destroy();
298 }
299};
300
301/////////////////////////////////////////////////////////////////////////////////////
302// Given two RDValue::Values - copy the appropriate structure
303// RDValue doesn't have a copy constructor, the default
304// copy act's like a move for better value semantics.
305// Containers may need to copy though.
306inline void copy_rdvalue(RDValue &dest, const RDValue &src) {
307 if (&dest == &src) { // don't copy over yourself
308 return;
309 }
310 dest.destroy();
311 dest.type = src.type;
312 switch (src.type) {
313 case RDTypeTag::StringTag:
314 dest.value.s = new std::string(*src.value.s);
315 break;
316 case RDTypeTag::AnyTag:
317 dest.value.a = new std::any(*src.value.a);
318 break;
319 case RDTypeTag::VecDoubleTag:
320 dest.value.vd = new std::vector<double>(*src.value.vd);
321 break;
322 case RDTypeTag::VecFloatTag:
323 dest.value.vf = new std::vector<float>(*src.value.vf);
324 break;
325 case RDTypeTag::VecIntTag:
326 dest.value.vi = new std::vector<int>(*src.value.vi);
327 break;
328 case RDTypeTag::VecUnsignedIntTag:
329 dest.value.vu = new std::vector<unsigned int>(*src.value.vu);
330 break;
331 case RDTypeTag::VecStringTag:
332 dest.value.vs = new std::vector<std::string>(*src.value.vs);
333 break;
334 default:
335 dest = src;
336 }
337}
338
339#ifdef RDK_32BIT_BUILD
340// avoid register pressure and spilling on 32 bit systems
341typedef const RDValue &RDValue_cast_t;
342#else
343typedef RDValue RDValue_cast_t;
344#endif
345
346/////////////////////////////////////////////////////////////////////////////////////
347// rdvalue_is<T>
348
349template <class T>
350inline bool rdvalue_is(RDValue_cast_t v) {
351 const short tag =
352 RDTypeTag::GetTag<typename boost::remove_reference<T>::type>();
353
354 // If we are an Any tag, check the any type info
355 // see the template specialization below if we are
356 // looking for a boost any directly
357 if (v.getTag() == RDTypeTag::AnyTag) {
358 return v.value.a->type() == typeid(T);
359 }
360
361 if (v.getTag() == tag) {
362 return true;
363 }
364
365 return false;
366}
367
368template <>
369 inline bool rdvalue_is<std::any>(RDValue_cast_t v) {
370 // If we are explicitly looking for a std::any
371 // then just check the top level tag
372 const short tag = RDTypeTag::GetTag<std::any>();
373 return v.getTag() == tag;
374}
375/////////////////////////////////////////////////////////////////////////////////////
376// rdvalue_cast<T>
377//
378// POD types do not support reference semantics. Other types do.
379// rdvalue_cast<const std::vector<double> &>(RDValue); // ok
380// rdvalue_cast<const float &>(RDValue); // bad_any_cast
381
382// Get stuff stored in boost any
383template <class T>
384inline T rdvalue_cast(RDValue_cast_t v) {
385 // Disable reference and pointer casts to POD data.
386 BOOST_STATIC_ASSERT(!(
387 (boost::is_pointer<T>::value &&
388 (boost::is_integral<typename boost::remove_pointer<T>::type>::value ||
389 boost::is_floating_point<
390 typename boost::remove_pointer<T>::type>::value)) ||
391 (boost::is_reference<T>::value &&
392 (boost::is_integral<typename boost::remove_reference<T>::type>::value ||
393 boost::is_floating_point<
394 typename boost::remove_reference<T>::type>::value))));
395
396 if (rdvalue_is<std::any>(v)) {
397 return std::any_cast<T>(*v.ptrCast<std::any>());
398 }
399 throw std::bad_any_cast();
400}
401
402// POD casts
403template <>
404 inline double rdvalue_cast<double>(RDValue_cast_t v) {
405 if (rdvalue_is<double>(v)) {
406 return v.value.d;
407 }
408 if (rdvalue_is<float>(v)) {
409 return v.value.f;
410 }
411 throw std::bad_any_cast();
412}
413
414template <>
415 inline float rdvalue_cast<float>(RDValue_cast_t v) {
416 if (rdvalue_is<float>(v)) {
417 return v.value.f;
418 }
419 if (rdvalue_is<double>(v)) {
420 return boost::numeric_cast<float>(v.value.d);
421 }
422 throw std::bad_any_cast();
423}
424
425template <>
426 inline int rdvalue_cast<int>(RDValue_cast_t v) {
427 if (rdvalue_is<int>(v)) {
428 return v.value.i;
429 }
430 if (rdvalue_is<unsigned int>(v)) {
431 return boost::numeric_cast<int>(v.value.u);
432 }
433 throw std::bad_any_cast();
434}
435
436template <>
437 inline std::int8_t rdvalue_cast<std::int8_t>(RDValue_cast_t v) {
438 if (rdvalue_is<int>(v)) {
439 return boost::numeric_cast<std::int8_t>(v.value.i);
440 }
441 if (rdvalue_is<unsigned int>(v)) {
442 return boost::numeric_cast<std::int8_t>(v.value.u);
443 }
444 throw std::bad_any_cast();
445}
446
447template <>
448 inline std::int16_t rdvalue_cast<std::int16_t>(RDValue_cast_t v) {
449 if (rdvalue_is<int>(v)) {
450 return boost::numeric_cast<std::int16_t>(v.value.i);
451 }
452 if (rdvalue_is<unsigned int>(v)) {
453 return boost::numeric_cast<std::int16_t>(v.value.u);
454 }
455 throw std::bad_any_cast();
456}
457
458template <>
459 inline std::int64_t rdvalue_cast<std::int64_t>(RDValue_cast_t v) {
460 if (rdvalue_is<int>(v)) {
461 return static_cast<std::int64_t>(v.value.i);
462 }
463 if (rdvalue_is<unsigned int>(v)) {
464 return static_cast<std::int64_t>(v.value.u);
465 }
466 if (rdvalue_is<std::any>(v)) {
467 return std::any_cast<std::int64_t>(*v.ptrCast<std::any>());
468 }
469 throw std::bad_any_cast();
470}
471
472template <>
473 inline unsigned int rdvalue_cast<unsigned int>(RDValue_cast_t v) {
474 if (rdvalue_is<unsigned int>(v)) {
475 return v.value.u;
476 }
477 if (rdvalue_is<int>(v)) {
478 return boost::numeric_cast<unsigned int>(v.value.i);
479 }
480 throw std::bad_any_cast();
481}
482
483template <>
484 inline std::uint8_t rdvalue_cast<std::uint8_t>(RDValue_cast_t v) {
485 if (rdvalue_is<int>(v)) {
486 return boost::numeric_cast<std::uint8_t>(v.value.i);
487 }
488 if (rdvalue_is<unsigned int>(v)) {
489 return boost::numeric_cast<std::uint8_t>(v.value.u);
490 }
491 throw std::bad_any_cast();
492}
493
494template <>
495 inline std::uint16_t rdvalue_cast<std::uint16_t>(RDValue_cast_t v) {
496 if (rdvalue_is<int>(v)) {
497 return boost::numeric_cast<std::uint16_t>(v.value.i);
498 }
499 if (rdvalue_is<unsigned int>(v)) {
500 return boost::numeric_cast<std::uint16_t>(v.value.u);
501 }
502 throw std::bad_any_cast();
503}
504
505template <>
506 inline std::uint64_t rdvalue_cast<std::uint64_t>(RDValue_cast_t v) {
507 if (rdvalue_is<unsigned int>(v)) {
508 return static_cast<std::uint64_t>(v.value.u);
509 }
510 if (rdvalue_is<int>(v)) {
511 return boost::numeric_cast<std::uint64_t>(v.value.i);
512 }
513 if (rdvalue_is<std::any>(v)) {
514 return std::any_cast<std::uint64_t>(*v.ptrCast<std::any>());
515 }
516 throw std::bad_any_cast();
517}
518
519template <>
520 inline bool rdvalue_cast<bool>(RDValue_cast_t v) {
521 if (rdvalue_is<bool>(v)) {
522 return v.value.b;
523 }
524 throw std::bad_any_cast();
525}
526
527} // namespace RDKit
528#endif
BoostEndInclude.h
BoostStartInclude.h
Invariant.h
LocaleSwitcher.h
export.h
RDKit::RDTypeTag::detail
Definition RDValue-taggedunion.h:149
RDKit::RDTypeTag::detail::valuePtrCast< std::any >
std::any * valuePtrCast< std::any >(Value value)
Definition RDValue-taggedunion.h:184
RDKit::RDTypeTag::detail::valuePtrCast< std::string >
std::string * valuePtrCast< std::string >(Value value)
Definition RDValue-taggedunion.h:189
RDKit::RDTypeTag::detail::valuePtrCast
T * valuePtrCast(Value value)
Definition RDValue-taggedunion.h:180
RDKit::RDTypeTag
Definition RDValue-doublemagic.h:92
RDKit::RDTypeTag::GetTag< int >
boost::uint64_t GetTag< int >()
Definition RDValue-doublemagic.h:125
RDKit::RDTypeTag::EmptyTag
const short EmptyTag
Definition RDValue-taggedunion.h:83
RDKit::RDTypeTag::UnsignedIntTag
static const boost::uint64_t UnsignedIntTag
Definition RDValue-doublemagic.h:98
RDKit::RDTypeTag::StringTag
static const boost::uint64_t StringTag
Definition RDValue-doublemagic.h:103
RDKit::RDTypeTag::GetTag< std::string >
boost::uint64_t GetTag< std::string >()
Definition RDValue-doublemagic.h:137
RDKit::RDTypeTag::GetTag< bool >
boost::uint64_t GetTag< bool >()
Definition RDValue-doublemagic.h:133
RDKit::RDTypeTag::GetTag< unsigned int >
boost::uint64_t GetTag< unsigned int >()
Definition RDValue-doublemagic.h:129
RDKit::RDTypeTag::GetTag
boost::uint64_t GetTag()
Definition RDValue-doublemagic.h:113
RDKit::RDTypeTag::VecStringTag
static const boost::uint64_t VecStringTag
Definition RDValue-doublemagic.h:108
RDKit::RDTypeTag::GetTag< std::any >
boost::uint64_t GetTag< std::any >()
Definition RDValue-doublemagic.h:161
RDKit::RDTypeTag::VecIntTag
static const boost::uint64_t VecIntTag
Definition RDValue-doublemagic.h:106
RDKit::RDTypeTag::FloatTag
static const boost::uint64_t FloatTag
Definition RDValue-doublemagic.h:96
RDKit::RDTypeTag::VecUnsignedIntTag
static const boost::uint64_t VecUnsignedIntTag
Definition RDValue-doublemagic.h:107
RDKit::RDTypeTag::DoubleTag
static const boost::uint64_t DoubleTag
Definition RDValue-doublemagic.h:95
RDKit::RDTypeTag::GetTag< double >
boost::uint64_t GetTag< double >()
Definition RDValue-doublemagic.h:117
RDKit::RDTypeTag::IntTag
static const boost::uint64_t IntTag
Definition RDValue-doublemagic.h:97
RDKit::RDTypeTag::GetTag< float >
boost::uint64_t GetTag< float >()
Definition RDValue-doublemagic.h:121
RDKit::RDTypeTag::AnyTag
static const boost::uint64_t AnyTag
Definition RDValue-doublemagic.h:109
RDKit::RDTypeTag::VecFloatTag
static const boost::uint64_t VecFloatTag
Definition RDValue-doublemagic.h:105
RDKit::RDTypeTag::VecDoubleTag
static const boost::uint64_t VecDoubleTag
Definition RDValue-doublemagic.h:104
RDKit::RDTypeTag::BoolTag
static const boost::uint64_t BoolTag
Definition RDValue-doublemagic.h:99
RDKit
Std stuff.
Definition Abbreviations.h:19
RDKit::rdvalue_cast< std::int16_t >
std::int16_t rdvalue_cast< std::int16_t >(RDValue_cast_t v)
Definition RDValue-taggedunion.h:448
RDKit::rdvalue_cast< int >
int rdvalue_cast< int >(RDValue_cast_t v)
Definition RDValue-doublemagic.h:458
RDKit::rdvalue_cast< unsigned int >
unsigned int rdvalue_cast< unsigned int >(RDValue_cast_t v)
Definition RDValue-doublemagic.h:465
RDKit::rdvalue_cast< std::uint8_t >
std::uint8_t rdvalue_cast< std::uint8_t >(RDValue_cast_t v)
Definition RDValue-taggedunion.h:484
RDKit::rdvalue_is
bool rdvalue_is(const RDValue_cast_t)
Definition RDValue-doublemagic.h:372
RDKit::rdvalue_cast< std::int64_t >
std::int64_t rdvalue_cast< std::int64_t >(RDValue_cast_t v)
Definition RDValue-taggedunion.h:459
RDKit::rdvalue_cast< std::uint64_t >
std::uint64_t rdvalue_cast< std::uint64_t >(RDValue_cast_t v)
Definition RDValue-taggedunion.h:506
RDKit::rdvalue_cast< double >
double rdvalue_cast< double >(RDValue_cast_t v)
Definition RDValue-doublemagic.h:440
RDKit::copy_rdvalue
void copy_rdvalue(RDValue &dest, const RDValue &src)
Definition RDValue-doublemagic.h:339
RDKit::rdvalue_cast
T rdvalue_cast(RDValue_cast_t v)
Definition RDValue-doublemagic.h:420
RDKit::rdvalue_cast< std::int8_t >
std::int8_t rdvalue_cast< std::int8_t >(RDValue_cast_t v)
Definition RDValue-taggedunion.h:437
RDKit::rdvalue_cast< std::uint16_t >
std::uint16_t rdvalue_cast< std::uint16_t >(RDValue_cast_t v)
Definition RDValue-taggedunion.h:495
RDKit::RDValue_cast_t
RDValue RDValue_cast_t
Definition RDValue-doublemagic.h:417
RDKit::rdvalue_cast< bool >
bool rdvalue_cast< bool >(RDValue_cast_t v)
Definition RDValue-doublemagic.h:473
RDKit::rdvalue_cast< float >
float rdvalue_cast< float >(RDValue_cast_t v)
Definition RDValue-doublemagic.h:446
RDKit::rdvalue_is< std::any >
bool rdvalue_is< std::any >(RDValue_cast_t v)
Definition RDValue-taggedunion.h:369
RDKit::RDValue
Definition RDValue-doublemagic.h:166
RDKit::RDValue::RDValue
RDValue(const std::vector< int > &v)
Definition RDValue-taggedunion.h:245
RDKit::RDValue::getTag
short getTag() const
Definition RDValue-taggedunion.h:253
RDKit::RDValue::RDValue
RDValue(const std::vector< std::string > &v)
Definition RDValue-taggedunion.h:250
RDKit::RDValue::RDValue
RDValue(std::any *v)
Definition RDValue-taggedunion.h:230
RDKit::RDValue::RDValue
RDValue(const std::vector< double > &v)
Definition RDValue-taggedunion.h:241
RDKit::RDValue::RDValue
RDValue(const std::vector< unsigned int > &v)
Definition RDValue-taggedunion.h:247
RDKit::RDValue::getTag
boost::uint64_t getTag() const
Definition RDValue-doublemagic.h:282
RDKit::RDValue::type
short type
Definition RDValue-taggedunion.h:219
RDKit::RDValue::RDValue
RDValue(double v)
Definition RDValue-taggedunion.h:224
RDKit::RDValue::RDValue
RDValue(bool v)
Definition RDValue-taggedunion.h:228
RDKit::RDValue::value
RDTypeTag::detail::Value value
Definition RDValue-taggedunion.h:218
RDKit::RDValue::RDValue
RDValue(float v)
Definition RDValue-taggedunion.h:225
RDKit::RDValue::RDValue
RDValue(const std::string &v)
Definition RDValue-taggedunion.h:235
RDKit::RDValue::ptrCast
T * ptrCast() const
Definition RDValue-taggedunion.h:257
RDKit::RDValue::destroy
void destroy()
Definition RDValue-taggedunion.h:265
RDKit::RDValue::RDValue
RDValue(int v)
Definition RDValue-taggedunion.h:226
RDKit::RDValue::RDValue
RDValue(unsigned v)
Definition RDValue-taggedunion.h:227
RDKit::RDValue::reserved_tag
short reserved_tag
Definition RDValue-taggedunion.h:220
RDKit::RDValue::RDValue
RDValue(const std::vector< float > &v)
Definition RDValue-taggedunion.h:243
RDKit::RDValue::RDValue
RDValue(const T &v)
Definition RDValue-taggedunion.h:238
RDKit::RDValue::RDValue
RDValue()
Definition RDValue-taggedunion.h:222
RDKit::RDValue::RDValue
RDValue(const std::any &v)
Definition RDValue-taggedunion.h:233
RDKit::RDValue::cleanup_rdvalue
static void cleanup_rdvalue(RDValue &rdvalue)
Definition RDValue-taggedunion.h:296
RDKit::RDTypeTag::detail::Value
Definition RDValue-taggedunion.h:150
RDKit::RDTypeTag::detail::Value::Value
Value(int v)
Definition RDValue-taggedunion.h:167
RDKit::RDTypeTag::detail::Value::a
std::any * a
Definition RDValue-taggedunion.h:157
RDKit::RDTypeTag::detail::Value::Value
Value(std::any *v)
Definition RDValue-taggedunion.h:171
RDKit::RDTypeTag::detail::Value::b
bool b
Definition RDValue-taggedunion.h:155
RDKit::RDTypeTag::detail::Value::Value
Value(std::vector< std::string > *v)
Definition RDValue-taggedunion.h:176
RDKit::RDTypeTag::detail::Value::Value
Value(double v)
Definition RDValue-taggedunion.h:165
RDKit::RDTypeTag::detail::Value::vs
std::vector< std::string > * vs
Definition RDValue-taggedunion.h:162
RDKit::RDTypeTag::detail::Value::d
double d
Definition RDValue-taggedunion.h:151
RDKit::RDTypeTag::detail::Value::u
unsigned u
Definition RDValue-taggedunion.h:154
RDKit::RDTypeTag::detail::Value::Value
Value(std::vector< unsigned int > *v)
Definition RDValue-taggedunion.h:175
RDKit::RDTypeTag::detail::Value::i
int i
Definition RDValue-taggedunion.h:153
RDKit::RDTypeTag::detail::Value::s
std::string * s
Definition RDValue-taggedunion.h:156
RDKit::RDTypeTag::detail::Value::Value
Value(std::vector< double > *v)
Definition RDValue-taggedunion.h:172
RDKit::RDTypeTag::detail::Value::f
float f
Definition RDValue-taggedunion.h:152
RDKit::RDTypeTag::detail::Value::Value
Value(std::string *v)
Definition RDValue-taggedunion.h:170
RDKit::RDTypeTag::detail::Value::Value
Value()
Definition RDValue-taggedunion.h:164
RDKit::RDTypeTag::detail::Value::Value
Value(unsigned int v)
Definition RDValue-taggedunion.h:168
RDKit::RDTypeTag::detail::Value::Value
Value(std::vector< float > *v)
Definition RDValue-taggedunion.h:173
RDKit::RDTypeTag::detail::Value::Value
Value(bool v)
Definition RDValue-taggedunion.h:169
RDKit::RDTypeTag::detail::Value::vu
std::vector< unsigned int > * vu
Definition RDValue-taggedunion.h:161
RDKit::RDTypeTag::detail::Value::vf
std::vector< float > * vf
Definition RDValue-taggedunion.h:159
RDKit::RDTypeTag::detail::Value::vd
std::vector< double > * vd
Definition RDValue-taggedunion.h:158
RDKit::RDTypeTag::detail::Value::Value
Value(std::vector< int > *v)
Definition RDValue-taggedunion.h:174
RDKit::RDTypeTag::detail::Value::vi
std::vector< int > * vi
Definition RDValue-taggedunion.h:160
RDKit::RDTypeTag::detail::Value::Value
Value(float v)
Definition RDValue-taggedunion.h:166