GiNaC 1.8.7
Classes | Namespaces | Macros | Typedefs | Functions
registrar.h File Reference

GiNaC's class registrar (for class basic and all classes derived from it). More...

#include "class_info.h"
#include "print.h"
#include <list>
#include <string>
#include <typeinfo>
#include <vector>

Go to the source code of this file.

Classes

struct  GiNaC::return_type_t
 To distinguish between different kinds of non-commutative objects. More...
 
class  GiNaC::registered_class_options
 This class stores information about a registered GiNaC class. More...
 

Namespaces

namespace  GiNaC
 

Macros

#define GINAC_DECLARE_REGISTERED_CLASS_COMMON(classname)
 Common part of GINAC_DECLARE_REGISTERED_CLASS_NO_CTORS and GINAC_DECLARE_REGISTERED_CLASS. More...
 
#define GINAC_DECLARE_REGISTERED_CLASS_NO_CTORS(classname, supername)
 Primary macro for inclusion in the declaration of each registered class. More...
 
#define GINAC_DECLARE_REGISTERED_CLASS(classname, supername)
 Macro for inclusion in the declaration of each registered class. More...
 
#define GINAC_IMPLEMENT_REGISTERED_CLASS(classname, supername)    GiNaC::registered_class_info classname::reg_info = GiNaC::registered_class_info(GiNaC::registered_class_options(#classname, #supername, typeid(classname)));
 Macro for inclusion in the implementation of each registered class. More...
 
#define GINAC_IMPLEMENT_REGISTERED_CLASS_OPT(classname, supername, options)    GiNaC::registered_class_info classname::reg_info = GiNaC::registered_class_info(GiNaC::registered_class_options(#classname, #supername, typeid(classname)).options);
 Macro for inclusion in the implementation of each registered class. More...
 
#define GINAC_IMPLEMENT_REGISTERED_CLASS_OPT_T(classname, supername, options)    GiNaC::registered_class_info classname::reg_info = GiNaC::registered_class_info(GiNaC::registered_class_options(#classname, #supername, typeid(classname)).options);
 Macro for inclusion in the implementation of each registered class. More...
 

Typedefs

typedef class_info< registered_class_options > GiNaC::registered_class_info
 

Functions

template<typename T >
return_type_t GiNaC::make_return_type_t (const unsigned rl=0)
 
template<class Alg , class Ctx , class T , class C >
void GiNaC::set_print_func (void f(const T &, const C &c, unsigned))
 Add or replace a print method. More...
 
template<class Alg , class Ctx , class T , class C >
void GiNaC::set_print_func (void(T::*f)(const C &, unsigned))
 Add or replace a print method. More...
 

Detailed Description

GiNaC's class registrar (for class basic and all classes derived from it).

Definition in file registrar.h.

Macro Definition Documentation

◆ GINAC_DECLARE_REGISTERED_CLASS_COMMON

#define GINAC_DECLARE_REGISTERED_CLASS_COMMON (   classname)
Value:
private: \
static GiNaC::registered_class_info reg_info; \
public: \
static GiNaC::registered_class_info &get_class_info_static() { return reg_info; } \
class visitor { \
public: \
virtual void visit(const classname &) = 0; \
virtual ~visitor() {}; \
};

Common part of GINAC_DECLARE_REGISTERED_CLASS_NO_CTORS and GINAC_DECLARE_REGISTERED_CLASS.

Definition at line 129 of file registrar.h.

◆ GINAC_DECLARE_REGISTERED_CLASS_NO_CTORS

#define GINAC_DECLARE_REGISTERED_CLASS_NO_CTORS (   classname,
  supername 
)
Value:
typedef supername inherited; \
virtual const GiNaC::registered_class_info &get_class_info() const { return classname::get_class_info_static(); } \
virtual GiNaC::registered_class_info &get_class_info() { return classname::get_class_info_static(); } \
virtual const char *class_name() const { return classname::get_class_info_static().options.get_name(); } \
private:
#define GINAC_DECLARE_REGISTERED_CLASS_COMMON(classname)
Common part of GINAC_DECLARE_REGISTERED_CLASS_NO_CTORS and GINAC_DECLARE_REGISTERED_CLASS.
Definition: registrar.h:129

Primary macro for inclusion in the declaration of each registered class.

Definition at line 141 of file registrar.h.

◆ GINAC_DECLARE_REGISTERED_CLASS

#define GINAC_DECLARE_REGISTERED_CLASS (   classname,
  supername 
)
Value:
template<class B, typename... Args> friend B & dynallocate(Args &&... args); \
typedef supername inherited; \
classname(); \
classname * duplicate() const override { \
classname * bp = new classname(*this); \
return bp; \
} \
\
void accept(GiNaC::visitor & v) const override \
{ \
if (visitor *p = dynamic_cast<visitor *>(&v)) \
p->visit(*this); \
else \
inherited::accept(v); \
} \
const GiNaC::registered_class_info &get_class_info() const override { return classname::get_class_info_static(); } \
GiNaC::registered_class_info &get_class_info() override { return classname::get_class_info_static(); } \
const char *class_name() const override { return classname::get_class_info_static().options.get_name(); } \
protected: \
int compare_same_type(const GiNaC::basic & other) const override; \
private:
This class is the ABC (abstract base class) of GiNaC's class hierarchy.
Definition: basic.h:105
@ dynallocated
heap-allocated (i.e. created by new if we want to be clever and bypass the stack,
Definition: flags.h:202
Degenerate base class for visitors.
Definition: basic.h:97
B & dynallocate(Args &&... args)
Constructs a new (class basic or derived) B object on the heap.
Definition: basic.h:334
class_info< registered_class_options > registered_class_info
Definition: registrar.h:126

Macro for inclusion in the declaration of each registered class.

It declares some functions that are common to all classes derived from 'basic' as well as all required stuff for the GiNaC class registry (mainly needed for archiving).

Definition at line 153 of file registrar.h.

◆ GINAC_IMPLEMENT_REGISTERED_CLASS

#define GINAC_IMPLEMENT_REGISTERED_CLASS (   classname,
  supername 
)     GiNaC::registered_class_info classname::reg_info = GiNaC::registered_class_info(GiNaC::registered_class_options(#classname, #supername, typeid(classname)));

Macro for inclusion in the implementation of each registered class.

Definition at line 180 of file registrar.h.

◆ GINAC_IMPLEMENT_REGISTERED_CLASS_OPT

#define GINAC_IMPLEMENT_REGISTERED_CLASS_OPT (   classname,
  supername,
  options 
)     GiNaC::registered_class_info classname::reg_info = GiNaC::registered_class_info(GiNaC::registered_class_options(#classname, #supername, typeid(classname)).options);

Macro for inclusion in the implementation of each registered class.

Additional options can be specified.

Definition at line 185 of file registrar.h.

◆ GINAC_IMPLEMENT_REGISTERED_CLASS_OPT_T

#define GINAC_IMPLEMENT_REGISTERED_CLASS_OPT_T (   classname,
  supername,
  options 
)     GiNaC::registered_class_info classname::reg_info = GiNaC::registered_class_info(GiNaC::registered_class_options(#classname, #supername, typeid(classname)).options);

Macro for inclusion in the implementation of each registered class.

Additional options can be specified.

Definition at line 190 of file registrar.h.


This page is part of the GiNaC developer's reference. It was generated automatically by doxygen. For an introduction, see the tutorial.