Drake
symbolic.h
Go to the documentation of this file.
1 #pragma once
2 /// @file
3 /// Provides public header files of Drake's symbolic library.
4 /// A user of the symbolic library should only include this header file.
5 /// Including other individual headers such as symbolic_expression.h will
6 /// generate a compile-time error.
7 ///
8 /// Many symbolic types are not closed under the defined operations. For
9 /// example, relational operations (i.e. <) over symbolic::Expression produce
10 /// symbolic::Formula. Another example is addition (+) over Monomial which gives
11 /// Polynomial. If a user does not include the necessary set of header files,
12 /// he/she will get either 1) incomprehensible c++ errors or 2) undefined
13 /// runtime behaviors. The problem is trickier if we use symbolic objects via
14 /// Eigen.
15 
16 // In each header included below, it asserts that this macro
17 // `DRAKE_COMMON_SYMBOLIC_HEADER` is defined. If the macro is not defined, it
18 // generates diagnostic error messages.
19 #define DRAKE_COMMON_SYMBOLIC_HEADER
20 
21 // Do not alpha-sort the following block of hard-coded #includes, which is
22 // protected by `clang-format on/off`.
23 //
24 // Rationale: We want to maximize the use of this header, `symbolic.h`, even
25 // inside of the symbolic library files to avoid any mistakes which might not be
26 // detected. By centralizing the list here, we make sure that everyone will see
27 // the correct order which respects the inter-dependencies of the symbolic
28 // headers. This shields us from triggering undefined behaviors due to
29 // order-of-specialization-includes-changed mistakes.
30 //
31 // clang-format off
42 // clang-format on
43 #undef DRAKE_COMMON_SYMBOLIC_HEADER