Go to the documentation of this file.
63 #define GINAC_DECLARE_PRINT_CONTEXT_COMMON(classname) \
65 friend class function_options; \
66 friend class registered_class_options; \
67 static const GiNaC::print_context_class_info &get_class_info_static(); \
70 #define GINAC_DECLARE_PRINT_CONTEXT_BASE(classname) \
71 GINAC_DECLARE_PRINT_CONTEXT_COMMON(classname) \
72 virtual const GiNaC::print_context_class_info &get_class_info() const { return classname::get_class_info_static(); } \
73 virtual const char *class_name() const { return classname::get_class_info_static().options.get_name(); } \
74 virtual classname * duplicate() const { return new classname(*this); } \
81 #define GINAC_DECLARE_PRINT_CONTEXT(classname, supername) \
82 GINAC_DECLARE_PRINT_CONTEXT_COMMON(classname) \
83 typedef supername inherited; \
84 const GiNaC::print_context_class_info &get_class_info() const override { return classname::get_class_info_static(); } \
85 const char *class_name() const override { return classname::get_class_info_static().options.get_name(); } \
86 classname * duplicate() const override { return new classname(*this); } \
90 #define GINAC_IMPLEMENT_PRINT_CONTEXT(classname, supername) \
91 const GiNaC::print_context_class_info &classname::get_class_info_static() \
93 static GiNaC::print_context_class_info reg_info = GiNaC::print_context_class_info(GiNaC::print_context_options(#classname, #supername, GiNaC::next_print_context_id++)); \
191 {
return dynamic_cast<const T *
>(&obj) !=
nullptr; }
205 template <
class T,
class C>
208 typedef void (*
F)(
const T &,
const C &, unsigned);
216 f(
dynamic_cast<const T &
>(obj),
dynamic_cast<const C &
>(
c), level);
224 template <
class T,
class C>
227 typedef void (T::*
F)(
const C &
c,
unsigned level)
const;
235 return (
dynamic_cast<const T &
>(obj).*
f)(
dynamic_cast<const C &
>(
c), level);
254 template <
class T,
class C>
257 template <
class T,
class C>
262 if (
this != &other) {
264 impl.reset(p ? other.
impl->duplicate() :
nullptr);
271 (*impl)(obj,
c, level);
277 std::unique_ptr<print_functor_impl>
impl;
283 #endif // ndef GINAC_BASIC_H
Context for default (ginsh-parsable) output.
bool is_a(const basic &obj)
Check if obj is a T, including base classes.
Context for python-parsable output.
print_ptrfun_handler * duplicate() const override
Helper templates to provide per-class information for class hierarchies.
print_context(std::ostream &, unsigned options=0)
@ print_index_dimensions
print the dimensions of indices
print_csrc_cl_N(std::ostream &, unsigned options=0)
Context for C source output using float precision.
Base class for print_contexts.
void(T::* F)(const C &c, unsigned level) const
Base context for C source output.
Flags to control the behavior of a print_context.
print_dflt(std::ostream &, unsigned options=0)
#define GINAC_DECLARE_PRINT_CONTEXT(classname, supername)
Macro for inclusion in the declaration of a print_context class.
#define GINAC_DECLARE_PRINT_CONTEXT_BASE(classname)
print_functor handler for pointer-to-functions of class T, context type C
print_ptrfun_handler(F f_)
print_functor(std::unique_ptr< print_functor_impl > impl_)
unsigned id
ID number (assigned automatically).
class_info< print_context_options > print_context_class_info
virtual void operator()(const basic &obj, const print_context &c, unsigned level) const =0
const char * name
Class name.
Base class for print_functor handlers.
const unsigned delta_indent
size of indentation step
void operator()(const basic &obj, const print_context &c, unsigned level) const override
print_functor(const print_functor &other)
print_functor & operator=(const print_functor &other)
print_csrc_double(std::ostream &, unsigned options=0)
Context for python pretty-print output.
const char * parent_name
Name of superclass.
virtual print_functor_impl * duplicate() const =0
void operator()(const basic &obj, const print_context &c, unsigned level) const override
Context for latex-parsable output.
print_functor(void f(const T &, const C &, unsigned))
This class stores information about a registered print_context class.
unsigned next_print_context_id
Next free ID for print_context types.
const char * get_parent_name() const
Context for C source output using double precision.
Context for tree-like output for debugging.
virtual ~print_functor_impl()
print_context_options(const char *n, const char *p, unsigned i)
void(* F)(const T &, const C &, unsigned)
void operator()(const basic &obj, const print_context &c, unsigned level) const
print_memfun_handler * duplicate() const override
print_csrc(std::ostream &, unsigned options=0)
std::ostream & s
stream to output to
print_latex(std::ostream &, unsigned options=0)
This class is the ABC (abstract base class) of GiNaC's class hierarchy.
Context for C source output using CLN numbers.
unsigned options
option flags
std::unique_ptr< print_functor_impl > impl
print_functor handler for member functions of class T, context type C
print_functor(void(T::*f)(const C &, unsigned) const)
print_python(std::ostream &, unsigned options=0)
print_csrc_float(std::ostream &, unsigned options=0)
This class represents a print method for a certain algebraic class and print_context type.
print_python_repr(std::ostream &, unsigned options=0)
const char * get_name() const
print_memfun_handler(F f_)
This page is part of the GiNaC
developer's reference. It was generated automatically by doxygen. For
an introduction, see the tutorial.