Custom RTTI considered harmful, final part.
print_func<print_context>(&mystring::do_print))
// ctors
-mystring::mystring() : inherited(&mystring::tinfo_static) { }
-mystring::mystring(const string &s) : inherited(&mystring::tinfo_static), str(s) { }
-mystring::mystring(const char *s) : inherited(&mystring::tinfo_static), str(s) { }
+mystring::mystring() { }
+mystring::mystring(const string &s) : str(s) { }
+mystring::mystring(const char *s) : str(s) { }
// comparison
int mystring::compare_same_type(const basic &other) const
add::add()
{
- tinfo_key = &add::tinfo_static;
}
//////////
add::add(const ex & lh, const ex & rh)
{
- tinfo_key = &add::tinfo_static;
overall_coeff = _ex0;
construct_from_2_ex(lh,rh);
GINAC_ASSERT(is_canonical());
add::add(const exvector & v)
{
- tinfo_key = &add::tinfo_static;
overall_coeff = _ex0;
construct_from_exvector(v);
GINAC_ASSERT(is_canonical());
add::add(const epvector & v)
{
- tinfo_key = &add::tinfo_static;
overall_coeff = _ex0;
construct_from_epvector(v);
GINAC_ASSERT(is_canonical());
add::add(const epvector & v, const ex & oc)
{
- tinfo_key = &add::tinfo_static;
overall_coeff = oc;
construct_from_epvector(v);
GINAC_ASSERT(is_canonical());
add::add(std::auto_ptr<epvector> vp, const ex & oc)
{
- tinfo_key = &add::tinfo_static;
GINAC_ASSERT(vp.get()!=0);
overall_coeff = oc;
construct_from_epvector(*vp);
/** basic copy constructor: implicitly assumes that the other class is of
* the exact same type (as it's used by duplicate()), so it can copy the
* tinfo_key and the hash value. */
-basic::basic(const basic & other) : tinfo_key(other.tinfo_key), flags(other.flags & ~status_flags::dynallocated), hashvalue(other.hashvalue)
+basic::basic(const basic & other) : flags(other.flags & ~status_flags::dynallocated), hashvalue(other.hashvalue)
{
}
{
// Reconstruct tinfo_key from class name
std::string class_name;
- if (n.find_string("class", class_name))
- tinfo_key = find_tinfo_key(class_name);
- else
+ if (!n.find_string("class", class_name))
throw (std::runtime_error("archive node contains no class name"));
}
// default constructor, destructor, copy constructor and assignment operator
protected:
- basic() : tinfo_key(&tinfo_static), flags(0) {}
+ basic() : flags(0) {}
public:
/** basic destructor, virtual because class ex will delete objects of
const basic & operator=(const basic & other);
protected:
- /** Constructor with specified tinfo_key (used by derived classes instead
- * of the default constructor to avoid assigning tinfo_key twice). */
- basic(tinfo_t ti) : tinfo_key(ti), flags(0) {}
-
// new virtual functions which can be overridden by derived classes
public: // only const functions please (may break reference counting)
}
}
- tinfo_t tinfo() const {return tinfo_key;}
-
/** Set some status_flags. */
const basic & setflag(unsigned f) const {flags |= f; return *this;}
// member variables
protected:
- tinfo_t tinfo_key; ///< type info
mutable unsigned flags; ///< of type status_flags
mutable unsigned hashvalue; ///< hash value
};
clifford::clifford() : representation_label(0), metric(0), commutator_sign(-1)
{
- tinfo_key = &clifford::tinfo_static;
}
DEFAULT_CTOR(diracone)
* @see dirac_ONE */
clifford::clifford(const ex & b, unsigned char rl) : inherited(b), representation_label(rl), metric(0), commutator_sign(-1)
{
- tinfo_key = &clifford::tinfo_static;
}
/** Construct object with one Lorentz index. This constructor is for internal
clifford::clifford(const ex & b, const ex & mu, const ex & metr, unsigned char rl, int comm_sign) : inherited(b, mu), representation_label(rl), metric(metr), commutator_sign(comm_sign)
{
GINAC_ASSERT(is_a<varidx>(mu));
- tinfo_key = &clifford::tinfo_static;
}
clifford::clifford(unsigned char rl, const ex & metr, int comm_sign, const exvector & v, bool discardable) : inherited(not_symmetric(), v, discardable), representation_label(rl), metric(metr), commutator_sign(comm_sign)
{
- tinfo_key = &clifford::tinfo_static;
}
clifford::clifford(unsigned char rl, const ex & metr, int comm_sign, std::auto_ptr<exvector> vp) : inherited(not_symmetric(), vp), representation_label(rl), metric(metr), commutator_sign(comm_sign)
{
- tinfo_key = &clifford::tinfo_static;
}
return_type_t clifford::return_type_tinfo() const
{
GINAC_DECLARE_REGISTERED_CLASS(cliffordunit, tensor)
- // other constructors
-protected:
- cliffordunit(tinfo_t ti) : inherited(ti) {}
-
// functions overriding virtual functions from base classes
public:
bool contract_with(exvector::iterator self, exvector::iterator other, exvector & v) const;
color::color() : representation_label(0)
{
- tinfo_key = &color::tinfo_static;
}
DEFAULT_CTOR(su3one)
* @see color_ONE */
color::color(const ex & b, unsigned char rl) : inherited(b), representation_label(rl)
{
- tinfo_key = &color::tinfo_static;
}
/** Construct object with one color index. This constructor is for internal
* @see color_T */
color::color(const ex & b, const ex & i1, unsigned char rl) : inherited(b, i1), representation_label(rl)
{
- tinfo_key = &color::tinfo_static;
}
color::color(unsigned char rl, const exvector & v, bool discardable) : inherited(not_symmetric(), v, discardable), representation_label(rl)
{
- tinfo_key = &color::tinfo_static;
}
color::color(unsigned char rl, std::auto_ptr<exvector> vp) : inherited(not_symmetric(), vp), representation_label(rl)
{
- tinfo_key = &color::tinfo_static;
}
return_type_t color::return_type_tinfo() const
// public
-constant::constant() : basic(&constant::tinfo_static), ef(0), serial(next_serial++), domain(domain::complex)
+constant::constant() : ef(0), serial(next_serial++), domain(domain::complex)
{
setflag(status_flags::evaluated | status_flags::expanded);
}
// public
constant::constant(const std::string & initname, evalffunctype efun, const std::string & texname, unsigned dm)
- : basic(&constant::tinfo_static), name(initname), ef(efun), serial(next_serial++), domain(dm)
+ : name(initname), ef(efun), serial(next_serial++), domain(dm)
{
if (texname.empty())
TeX_name = "\\mbox{" + name + "}";
}
constant::constant(const std::string & initname, const numeric & initnumber, const std::string & texname, unsigned dm)
- : basic(&constant::tinfo_static), name(initname), ef(0), number(initnumber), serial(next_serial++), domain(dm)
+ : name(initname), ef(0), number(initnumber), serial(next_serial++), domain(dm)
{
if (texname.empty())
TeX_name = "\\mbox{" + name + "}";
protected:
// helpers
- static tinfo_t get_tinfo() { return NULL; }
static unsigned get_default_flags() { return 0; }
static char get_open_delim() { return '('; }
static char get_close_delim() { return ')'; }
// constructors
public:
- container(STLT const & s, bool discardable = false) : inherited(get_tinfo())
+ container(STLT const & s, bool discardable = false)
{
setflag(get_default_flags());
this->seq = s;
}
- explicit container(std::auto_ptr<STLT> vp) : inherited(get_tinfo())
+ explicit container(std::auto_ptr<STLT> vp)
{
setflag(get_default_flags());
this->seq.swap(*vp);
}
container(exvector::const_iterator b, exvector::const_iterator e)
- : inherited(get_tinfo()), container_storage<C>(b, e)
+ : container_storage<C>(b, e)
{
setflag(get_default_flags());
}
explicit container(const ex & p1)
- : inherited(get_tinfo()), container_storage<C>(1, p1)
+ : container_storage<C>(1, p1)
{
setflag(get_default_flags());
}
- container(const ex & p1, const ex & p2) : inherited(get_tinfo())
+ container(const ex & p1, const ex & p2)
{
setflag(get_default_flags());
reserve(this->seq, 2);
this->seq.push_back(p1); this->seq.push_back(p2);
}
- container(const ex & p1, const ex & p2, const ex & p3) : inherited(get_tinfo())
+ container(const ex & p1, const ex & p2, const ex & p3)
{
setflag(get_default_flags());
reserve(this->seq, 3);
}
container(const ex & p1, const ex & p2, const ex & p3,
- const ex & p4) : inherited(get_tinfo())
+ const ex & p4)
{
setflag(get_default_flags());
reserve(this->seq, 4);
}
container(const ex & p1, const ex & p2, const ex & p3,
- const ex & p4, const ex & p5) : inherited(get_tinfo())
+ const ex & p4, const ex & p5)
{
setflag(get_default_flags());
reserve(this->seq, 5);
}
container(const ex & p1, const ex & p2, const ex & p3,
- const ex & p4, const ex & p5, const ex & p6) : inherited(get_tinfo())
+ const ex & p4, const ex & p5, const ex & p6)
{
setflag(get_default_flags());
reserve(this->seq, 6);
container(const ex & p1, const ex & p2, const ex & p3,
const ex & p4, const ex & p5, const ex & p6,
- const ex & p7) : inherited(get_tinfo())
+ const ex & p7)
{
setflag(get_default_flags());
reserve(this->seq, 7);
container(const ex & p1, const ex & p2, const ex & p3,
const ex & p4, const ex & p5, const ex & p6,
- const ex & p7, const ex & p8) : inherited(get_tinfo())
+ const ex & p7, const ex & p8)
{
setflag(get_default_flags());
reserve(this->seq, 8);
container(const ex & p1, const ex & p2, const ex & p3,
const ex & p4, const ex & p5, const ex & p6,
- const ex & p7, const ex & p8, const ex & p9) : inherited(get_tinfo())
+ const ex & p7, const ex & p8, const ex & p9)
{
setflag(get_default_flags());
reserve(this->seq, 9);
container(const ex & p1, const ex & p2, const ex & p3,
const ex & p4, const ex & p5, const ex & p6,
const ex & p7, const ex & p8, const ex & p9,
- const ex & p10) : inherited(get_tinfo())
+ const ex & p10)
{
setflag(get_default_flags());
reserve(this->seq, 10);
container(const ex & p1, const ex & p2, const ex & p3,
const ex & p4, const ex & p5, const ex & p6,
const ex & p7, const ex & p8, const ex & p9,
- const ex & p10, const ex & p11) : inherited(get_tinfo())
+ const ex & p10, const ex & p11)
{
setflag(get_default_flags());
reserve(this->seq, 11);
container(const ex & p1, const ex & p2, const ex & p3,
const ex & p4, const ex & p5, const ex & p6,
const ex & p7, const ex & p8, const ex & p9,
- const ex & p10, const ex & p11, const ex & p12) : inherited(get_tinfo())
+ const ex & p10, const ex & p11, const ex & p12)
{
setflag(get_default_flags());
reserve(this->seq, 12);
const ex & p4, const ex & p5, const ex & p6,
const ex & p7, const ex & p8, const ex & p9,
const ex & p10, const ex & p11, const ex & p12,
- const ex & p13) : inherited(get_tinfo())
+ const ex & p13)
{
setflag(get_default_flags());
reserve(this->seq, 13);
const ex & p4, const ex & p5, const ex & p6,
const ex & p7, const ex & p8, const ex & p9,
const ex & p10, const ex & p11, const ex & p12,
- const ex & p13, const ex & p14) : inherited(get_tinfo())
+ const ex & p13, const ex & p14)
{
setflag(get_default_flags());
reserve(this->seq, 14);
const ex & p4, const ex & p5, const ex & p6,
const ex & p7, const ex & p8, const ex & p9,
const ex & p10, const ex & p11, const ex & p12,
- const ex & p13, const ex & p14, const ex & p15) : inherited(get_tinfo())
+ const ex & p13, const ex & p14, const ex & p15)
{
setflag(get_default_flags());
reserve(this->seq, 15);
const ex & p7, const ex & p8, const ex & p9,
const ex & p10, const ex & p11, const ex & p12,
const ex & p13, const ex & p14, const ex & p15,
- const ex & p16) : inherited(get_tinfo())
+ const ex & p16)
{
setflag(get_default_flags());
reserve(this->seq, 16);
/** Default constructor */
template <template <class T, class = std::allocator<T> > class C>
-container<C>::container() : inherited(get_tinfo())
+container<C>::container()
{
setflag(get_default_flags());
}
// public
-expairseq::expairseq() : inherited(&expairseq::tinfo_static)
+expairseq::expairseq()
#if EXPAIRSEQ_USE_HASHTAB
- , hashtabsize(0)
+ : hashtabsize(0)
#endif // EXPAIRSEQ_USE_HASHTAB
{}
// other constructors
//////////
-expairseq::expairseq(const ex &lh, const ex &rh) : inherited(&expairseq::tinfo_static)
+expairseq::expairseq(const ex &lh, const ex &rh)
{
construct_from_2_ex(lh,rh);
GINAC_ASSERT(is_canonical());
}
-expairseq::expairseq(const exvector &v) : inherited(&expairseq::tinfo_static)
+expairseq::expairseq(const exvector &v)
{
construct_from_exvector(v);
GINAC_ASSERT(is_canonical());
}
expairseq::expairseq(const epvector &v, const ex &oc, bool do_index_renaming)
- : inherited(&expairseq::tinfo_static), overall_coeff(oc)
+ : overall_coeff(oc)
{
GINAC_ASSERT(is_a<numeric>(oc));
construct_from_epvector(v, do_index_renaming);
}
expairseq::expairseq(std::auto_ptr<epvector> vp, const ex &oc, bool do_index_renaming)
- : inherited(&expairseq::tinfo_static), overall_coeff(oc)
+ : overall_coeff(oc)
{
GINAC_ASSERT(vp.get()!=0);
GINAC_ASSERT(is_a<numeric>(oc));
typedef container<std::vector> exprseq;
-/** Specialization of container::get_tinfo() for exprseq. */
-template<> inline tinfo_t exprseq::get_tinfo() { return &exprseq::tinfo_static; }
-
// defined in exprseq.cpp
template<> bool exprseq::info(unsigned inf) const;
fderivative::fderivative()
{
- tinfo_key = &fderivative::tinfo_static;
}
//////////
fderivative::fderivative(unsigned ser, unsigned param, const exvector & args) : function(ser, args)
{
parameter_set.insert(param);
- tinfo_key = &fderivative::tinfo_static;
}
fderivative::fderivative(unsigned ser, const paramset & params, const exvector & args) : function(ser, args), parameter_set(params)
{
- tinfo_key = &fderivative::tinfo_static;
}
fderivative::fderivative(unsigned ser, const paramset & params, std::auto_ptr<exvector> vp) : function(ser, vp), parameter_set(params)
{
- tinfo_key = &fderivative::tinfo_static;
}
//////////
function::function(unsigned ser, ${SEQ1})
: exprseq(${SEQ2}), serial(ser)
{
- tinfo_key = &function::tinfo_static;
}
END_OF_CONSTRUCTORS_IMPLEMENTATION
function::function() : serial(0)
{
- tinfo_key = &function::tinfo_static;
}
//////////
function::function(unsigned ser) : serial(ser)
{
- tinfo_key = &function::tinfo_static;
}
// the following lines have been generated for max. ${maxargs} parameters
function::function(unsigned ser, const exprseq & es) : exprseq(es), serial(ser)
{
- tinfo_key = &function::tinfo_static;
// Force re-evaluation even if the exprseq was already evaluated
// (the exprseq copy constructor copies the flags)
function::function(unsigned ser, const exvector & v, bool discardable)
: exprseq(v,discardable), serial(ser)
{
- tinfo_key = &function::tinfo_static;
}
function::function(unsigned ser, std::auto_ptr<exvector> vp)
: exprseq(vp), serial(ser)
{
- tinfo_key = &function::tinfo_static;
}
//////////
// default constructor
//////////
-idx::idx() : inherited(&idx::tinfo_static) {}
+idx::idx() {}
varidx::varidx() : covariant(false)
{
- tinfo_key = &varidx::tinfo_static;
}
spinidx::spinidx() : dotted(false)
{
- tinfo_key = &spinidx::tinfo_static;
}
//////////
// other constructors
//////////
-idx::idx(const ex & v, const ex & d) : inherited(&idx::tinfo_static), value(v), dim(d)
+idx::idx(const ex & v, const ex & d) : value(v), dim(d)
{
if (is_dim_numeric())
if (!dim.info(info_flags::posint))
varidx::varidx(const ex & v, const ex & d, bool cov) : inherited(v, d), covariant(cov)
{
- tinfo_key = &varidx::tinfo_static;
}
spinidx::spinidx(const ex & v, const ex & d, bool cov, bool dot) : inherited(v, d, cov), dotted(dot)
{
- tinfo_key = &spinidx::tinfo_static;
}
//////////
indexed::indexed() : symtree(not_symmetric())
{
- tinfo_key = &indexed::tinfo_static;
}
//////////
indexed::indexed(const ex & b) : inherited(b), symtree(not_symmetric())
{
- tinfo_key = &indexed::tinfo_static;
validate();
}
indexed::indexed(const ex & b, const ex & i1) : inherited(b, i1), symtree(not_symmetric())
{
- tinfo_key = &indexed::tinfo_static;
validate();
}
indexed::indexed(const ex & b, const ex & i1, const ex & i2) : inherited(b, i1, i2), symtree(not_symmetric())
{
- tinfo_key = &indexed::tinfo_static;
validate();
}
indexed::indexed(const ex & b, const ex & i1, const ex & i2, const ex & i3) : inherited(b, i1, i2, i3), symtree(not_symmetric())
{
- tinfo_key = &indexed::tinfo_static;
validate();
}
indexed::indexed(const ex & b, const ex & i1, const ex & i2, const ex & i3, const ex & i4) : inherited(b, i1, i2, i3, i4), symtree(not_symmetric())
{
- tinfo_key = &indexed::tinfo_static;
validate();
}
indexed::indexed(const ex & b, const symmetry & symm, const ex & i1, const ex & i2) : inherited(b, i1, i2), symtree(symm)
{
- tinfo_key = &indexed::tinfo_static;
validate();
}
indexed::indexed(const ex & b, const symmetry & symm, const ex & i1, const ex & i2, const ex & i3) : inherited(b, i1, i2, i3), symtree(symm)
{
- tinfo_key = &indexed::tinfo_static;
validate();
}
indexed::indexed(const ex & b, const symmetry & symm, const ex & i1, const ex & i2, const ex & i3, const ex & i4) : inherited(b, i1, i2, i3, i4), symtree(symm)
{
- tinfo_key = &indexed::tinfo_static;
validate();
}
indexed::indexed(const ex & b, const exvector & v) : inherited(b), symtree(not_symmetric())
{
seq.insert(seq.end(), v.begin(), v.end());
- tinfo_key = &indexed::tinfo_static;
validate();
}
indexed::indexed(const ex & b, const symmetry & symm, const exvector & v) : inherited(b), symtree(symm)
{
seq.insert(seq.end(), v.begin(), v.end());
- tinfo_key = &indexed::tinfo_static;
validate();
}
indexed::indexed(const symmetry & symm, const exprseq & es) : inherited(es), symtree(symm)
{
- tinfo_key = &indexed::tinfo_static;
}
indexed::indexed(const symmetry & symm, const exvector & v, bool discardable) : inherited(v, discardable), symtree(symm)
{
- tinfo_key = &indexed::tinfo_static;
}
indexed::indexed(const symmetry & symm, std::auto_ptr<exvector> vp) : inherited(vp), symtree(symm)
{
- tinfo_key = &indexed::tinfo_static;
}
//////////
//////////
integral::integral()
- : inherited(&integral::tinfo_static),
+ :
x((new symbol())->setflag(status_flags::dynallocated))
{}
// public
integral::integral(const ex & x_, const ex & a_, const ex & b_, const ex & f_)
- : inherited(&integral::tinfo_static), x(x_), a(a_), b(b_), f(f_)
+ : x(x_), a(a_), b(b_), f(f_)
{
if (!is_a<symbol>(x)) {
throw(std::invalid_argument("first argument of integral must be of type symbol"));
typedef container<std::list> lst;
-/** Specialization of container::get_tinfo() for lst. */
-template<> inline tinfo_t lst::get_tinfo() { return &lst::tinfo_static; }
-
/** Specialization of container::get_default_flags() for lst. */
template<> inline unsigned lst::get_default_flags() { return status_flags::not_shareable; }
//////////
/** Default ctor. Initializes to 1 x 1-dimensional zero-matrix. */
-matrix::matrix() : inherited(&matrix::tinfo_static), row(1), col(1), m(1, _ex0)
+matrix::matrix() : row(1), col(1), m(1, _ex0)
{
setflag(status_flags::not_shareable);
}
*
* @param r number of rows
* @param c number of cols */
-matrix::matrix(unsigned r, unsigned c)
- : inherited(&matrix::tinfo_static), row(r), col(c), m(r*c, _ex0)
+matrix::matrix(unsigned r, unsigned c) : row(r), col(c), m(r*c, _ex0)
{
setflag(status_flags::not_shareable);
}
/** Ctor from representation, for internal use only. */
matrix::matrix(unsigned r, unsigned c, const exvector & m2)
- : inherited(&matrix::tinfo_static), row(r), col(c), m(m2)
+ : row(r), col(c), m(m2)
{
setflag(status_flags::not_shareable);
}
* If the list has more elements than the matrix, the excessive elements are
* thrown away. */
matrix::matrix(unsigned r, unsigned c, const lst & l)
- : inherited(&matrix::tinfo_static), row(r), col(c), m(r*c, _ex0)
+ : row(r), col(c), m(r*c, _ex0)
{
setflag(status_flags::not_shareable);
mul::mul()
{
- tinfo_key = &mul::tinfo_static;
}
//////////
mul::mul(const ex & lh, const ex & rh)
{
- tinfo_key = &mul::tinfo_static;
overall_coeff = _ex1;
construct_from_2_ex(lh,rh);
GINAC_ASSERT(is_canonical());
mul::mul(const exvector & v)
{
- tinfo_key = &mul::tinfo_static;
overall_coeff = _ex1;
construct_from_exvector(v);
GINAC_ASSERT(is_canonical());
mul::mul(const epvector & v)
{
- tinfo_key = &mul::tinfo_static;
overall_coeff = _ex1;
construct_from_epvector(v);
GINAC_ASSERT(is_canonical());
mul::mul(const epvector & v, const ex & oc, bool do_index_renaming)
{
- tinfo_key = &mul::tinfo_static;
overall_coeff = oc;
construct_from_epvector(v, do_index_renaming);
GINAC_ASSERT(is_canonical());
mul::mul(std::auto_ptr<epvector> vp, const ex & oc, bool do_index_renaming)
{
- tinfo_key = &mul::tinfo_static;
GINAC_ASSERT(vp.get()!=0);
overall_coeff = oc;
construct_from_epvector(*vp, do_index_renaming);
mul::mul(const ex & lh, const ex & mh, const ex & rh)
{
- tinfo_key = &mul::tinfo_static;
exvector factors;
factors.reserve(3);
factors.push_back(lh);
ncmul::ncmul()
{
- tinfo_key = &ncmul::tinfo_static;
}
//////////
ncmul::ncmul(const ex & lh, const ex & rh) : inherited(lh,rh)
{
- tinfo_key = &ncmul::tinfo_static;
}
ncmul::ncmul(const ex & f1, const ex & f2, const ex & f3) : inherited(f1,f2,f3)
{
- tinfo_key = &ncmul::tinfo_static;
}
ncmul::ncmul(const ex & f1, const ex & f2, const ex & f3,
const ex & f4) : inherited(f1,f2,f3,f4)
{
- tinfo_key = &ncmul::tinfo_static;
}
ncmul::ncmul(const ex & f1, const ex & f2, const ex & f3,
const ex & f4, const ex & f5) : inherited(f1,f2,f3,f4,f5)
{
- tinfo_key = &ncmul::tinfo_static;
}
ncmul::ncmul(const ex & f1, const ex & f2, const ex & f3,
const ex & f4, const ex & f5, const ex & f6) : inherited(f1,f2,f3,f4,f5,f6)
{
- tinfo_key = &ncmul::tinfo_static;
}
ncmul::ncmul(const exvector & v, bool discardable) : inherited(v,discardable)
{
- tinfo_key = &ncmul::tinfo_static;
}
ncmul::ncmul(std::auto_ptr<exvector> vp) : inherited(vp)
{
- tinfo_key = &ncmul::tinfo_static;
}
//////////
//////////
/** default ctor. Numerically it initializes to an integer zero. */
-numeric::numeric() : basic(&numeric::tinfo_static)
+numeric::numeric()
{
value = cln::cl_I(0);
setflag(status_flags::evaluated | status_flags::expanded);
// public
-numeric::numeric(int i) : basic(&numeric::tinfo_static)
+numeric::numeric(int i)
{
// Not the whole int-range is available if we don't cast to long
// first. This is due to the behaviour of the cl_I-ctor, which
}
-numeric::numeric(unsigned int i) : basic(&numeric::tinfo_static)
+numeric::numeric(unsigned int i)
{
// Not the whole uint-range is available if we don't cast to ulong
// first. This is due to the behaviour of the cl_I-ctor, which
}
-numeric::numeric(long i) : basic(&numeric::tinfo_static)
+numeric::numeric(long i)
{
value = cln::cl_I(i);
setflag(status_flags::evaluated | status_flags::expanded);
}
-numeric::numeric(unsigned long i) : basic(&numeric::tinfo_static)
+numeric::numeric(unsigned long i)
{
value = cln::cl_I(i);
setflag(status_flags::evaluated | status_flags::expanded);
/** Constructor for rational numerics a/b.
*
* @exception overflow_error (division by zero) */
-numeric::numeric(long numer, long denom) : basic(&numeric::tinfo_static)
+numeric::numeric(long numer, long denom)
{
if (!denom)
throw std::overflow_error("division by zero");
}
-numeric::numeric(double d) : basic(&numeric::tinfo_static)
+numeric::numeric(double d)
{
// We really want to explicitly use the type cl_LF instead of the
// more general cl_F, since that would give us a cl_DF only which
/** ctor from C-style string. It also accepts complex numbers in GiNaC
* notation like "2+5*I". */
-numeric::numeric(const char *s) : basic(&numeric::tinfo_static)
+numeric::numeric(const char *s)
{
cln::cl_N ctorval = 0;
// parse complex numbers (functional but not completely safe, unfortunately
/** Ctor from CLN types. This is for the initiated user or internal use
* only. */
-numeric::numeric(const cln::cl_N &z) : basic(&numeric::tinfo_static)
+numeric::numeric(const cln::cl_N &z)
{
value = z;
setflag(status_flags::evaluated | status_flags::expanded);
// default constructor
//////////
-power::power() : inherited(&power::tinfo_static) { }
+power::power() { }
//////////
// other constructors
// other constructors
public:
- power(const ex & lh, const ex & rh) : inherited(&power::tinfo_static), basis(lh), exponent(rh) {}
- template<typename T> power(const ex & lh, const T & rh) : inherited(&power::tinfo_static), basis(lh), exponent(rh) {}
+ power(const ex & lh, const ex & rh) : basis(lh), exponent(rh) {}
+ template<typename T> power(const ex & lh, const T & rh) : basis(lh), exponent(rh) {}
// functions overriding virtual functions from base classes
public:
* Default constructor
*/
-pseries::pseries() : inherited(&pseries::tinfo_static) { }
+pseries::pseries() { }
/*
* @param rel_ expansion variable and point (must hold a relational)
* @param ops_ vector of {coefficient, power} pairs (coefficient must not be zero)
* @return newly constructed pseries */
-pseries::pseries(const ex &rel_, const epvector &ops_) : basic(&pseries::tinfo_static), seq(ops_)
+pseries::pseries(const ex &rel_, const epvector &ops_) : seq(ops_)
{
GINAC_ASSERT(is_a<relational>(rel_));
GINAC_ASSERT(is_a<symbol>(rel_.lhs()));
return ret;
}
-/** Definitions for the tinfo mechanism. */
-typedef const void * tinfo_t;
-struct tinfo_static_t {};
-
/** Unarchiving function (static member function of every GiNaC class). */
typedef ex (*unarch_func)(const archive_node &n, lst &sym_lst);
#define GINAC_DECLARE_REGISTERED_CLASS_NO_CTORS(classname, supername) \
public: \
typedef supername inherited; \
- static const GiNaC::tinfo_static_t tinfo_static; \
private: \
static GiNaC::registered_class_info reg_info; \
public: \
/** Macro for inclusion in the implementation of each 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), &classname::unarchive)); \
- const GiNaC::tinfo_static_t classname::tinfo_static = {};
+ GiNaC::registered_class_info classname::reg_info = GiNaC::registered_class_info(GiNaC::registered_class_options(#classname, #supername, typeid(classname), &classname::unarchive));
/** Macro for inclusion in the implementation of each registered class.
* Additional options can be specified. */
#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), &classname::unarchive).options); \
- const GiNaC::tinfo_static_t classname::tinfo_static = {};
+ GiNaC::registered_class_info classname::reg_info = GiNaC::registered_class_info(GiNaC::registered_class_options(#classname, #supername, typeid(classname), &classname::unarchive).options);
/** Macro for inclusion in the implementation of each registered class.
* Additional options can be specified. */
#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), &classname::unarchive).options); \
- template<> const GiNaC::tinfo_static_t classname::tinfo_static = {};
+ GiNaC::registered_class_info classname::reg_info = GiNaC::registered_class_info(GiNaC::registered_class_options(#classname, #supername, typeid(classname), &classname::unarchive).options);
/** Find type information key by class name. */
// default constructor
//////////
-relational::relational() : basic(&relational::tinfo_static) {}
+relational::relational() { }
//////////
// other constructors
// public
-relational::relational(const ex & lhs, const ex & rhs, operators oper) : basic(&relational::tinfo_static), lh(lhs), rh(rhs), o(oper) {}
+relational::relational(const ex & lhs, const ex & rhs, operators oper) :
+ lh(lhs), rh(rhs), o(oper) { }
//////////
// archiving
GINAC_DECLARE_REGISTERED_CLASS(structure, basic)
// helpers
- static tinfo_t get_tinfo() { return reg_info.options.get_id(); }
static const char *get_class_name() { return "structure"; }
// constructors
public:
/** Construct structure as a copy of a given C++ structure. */
- structure(const T & t) : inherited(get_tinfo()), obj(t) { }
+ structure(const T & t) : obj(t) { }
// functions overriding virtual functions from base classes
// All these are just defaults that can be specialized by the user
/** Default constructor */
template <class T, template <class> class CP>
-structure<T, CP>::structure() : inherited(get_tinfo()) { }
+structure<T, CP>::structure() { }
/** Construct object from archive_node. */
template <class T, template <class> class CP>
// symbol
symbol::symbol()
- : inherited(&symbol::tinfo_static), serial(next_serial++), name(autoname_prefix() + ToString(serial)), TeX_name(name), domain(domain::complex), ret_type(return_types::commutative), ret_type_tinfo(make_return_type_t<symbol>())
+ : serial(next_serial++), name(autoname_prefix() + ToString(serial)), TeX_name(name), domain(domain::complex), ret_type(return_types::commutative), ret_type_tinfo(make_return_type_t<symbol>())
{
setflag(status_flags::evaluated | status_flags::expanded);
}
// symbol
-symbol::symbol(const std::string & initname, unsigned domain)
- : inherited(&symbol::tinfo_static), serial(next_serial++), name(initname), TeX_name(default_TeX_name()), domain(domain), ret_type(return_types::commutative), ret_type_tinfo(make_return_type_t<symbol>())
+symbol::symbol(const std::string & initname, unsigned domain) :
+ serial(next_serial++), name(initname), TeX_name(default_TeX_name()),
+ domain(domain), ret_type(return_types::commutative),
+ ret_type_tinfo(make_return_type_t<symbol>())
{
setflag(status_flags::evaluated | status_flags::expanded);
}
-symbol::symbol(const std::string & initname, unsigned rt, const return_type_t& rtt, unsigned domain)
- : inherited(&symbol::tinfo_static), serial(next_serial++), name(initname), TeX_name(default_TeX_name()), domain(domain), ret_type(rt), ret_type_tinfo(rtt)
+symbol::symbol(const std::string & initname, unsigned rt, const return_type_t& rtt, unsigned domain) :
+ serial(next_serial++), name(initname), TeX_name(default_TeX_name()),
+ domain(domain), ret_type(rt), ret_type_tinfo(rtt)
{
setflag(status_flags::evaluated | status_flags::expanded);
}
-symbol::symbol(const std::string & initname, const std::string & texname, unsigned domain)
- : inherited(&symbol::tinfo_static), serial(next_serial++), name(initname), TeX_name(texname), domain(domain), ret_type(return_types::commutative), ret_type_tinfo(make_return_type_t<symbol>())
+symbol::symbol(const std::string & initname, const std::string & texname, unsigned domain) :
+ serial(next_serial++), name(initname), TeX_name(texname), domain(domain),
+ ret_type(return_types::commutative), ret_type_tinfo(make_return_type_t<symbol>())
{
setflag(status_flags::evaluated | status_flags::expanded);
}
-symbol::symbol(const std::string & initname, const std::string & texname, unsigned rt, const return_type_t& rtt, unsigned domain)
- : inherited(&symbol::tinfo_static), serial(next_serial++), name(initname), TeX_name(texname), domain(domain), ret_type(rt), ret_type_tinfo(rtt)
+symbol::symbol(const std::string & initname, const std::string & texname,
+ unsigned rt, const return_type_t& rtt, unsigned domain) :
+ serial(next_serial++), name(initname), TeX_name(texname),
+ domain(domain), ret_type(rt), ret_type_tinfo(rtt)
{
setflag(status_flags::evaluated | status_flags::expanded);
}
// default constructor
//////////
-symmetry::symmetry() : inherited(&symmetry::tinfo_static), type(none)
+symmetry::symmetry() : type(none)
{
setflag(status_flags::evaluated | status_flags::expanded);
}
// other constructors
//////////
-symmetry::symmetry(unsigned i) : inherited(&symmetry::tinfo_static), type(none)
+symmetry::symmetry(unsigned i) : type(none)
{
indices.insert(i);
setflag(status_flags::evaluated | status_flags::expanded);
}
-symmetry::symmetry(symmetry_type t, const symmetry &c1, const symmetry &c2) : inherited(&symmetry::tinfo_static), type(t)
+symmetry::symmetry(symmetry_type t, const symmetry &c1, const symmetry &c2) : type(t)
{
add(c1); add(c2);
setflag(status_flags::evaluated | status_flags::expanded);
// constructors
//////////
-tensor::tensor() : inherited(&tensor::tinfo_static)
+tensor::tensor()
{
setflag(status_flags::evaluated | status_flags::expanded);
}
minkmetric::minkmetric() : pos_sig(false)
{
- tinfo_key = &minkmetric::tinfo_static;
}
spinmetric::spinmetric()
{
- tinfo_key = &spinmetric::tinfo_static;
}
minkmetric::minkmetric(bool ps) : pos_sig(ps)
{
- tinfo_key = &minkmetric::tinfo_static;
}
tensepsilon::tensepsilon() : minkowski(false), pos_sig(false)
{
- tinfo_key = &tensepsilon::tinfo_static;
}
tensepsilon::tensepsilon(bool mink, bool ps) : minkowski(mink), pos_sig(ps)
{
- tinfo_key = &tensepsilon::tinfo_static;
}
//////////
{
GINAC_DECLARE_REGISTERED_CLASS(tensor, basic)
- // other constructors
-protected:
- tensor(tinfo_t ti) : inherited(ti) {}
-
// functions overriding virtual functions from base classes
protected:
unsigned return_type() const { return return_types::noncommutative_composite; }
// Helper macros for class implementations (mostly useful for trivial classes)
#define DEFAULT_CTOR(classname) \
-classname::classname() : inherited(&classname::tinfo_static) { setflag(status_flags::evaluated | status_flags::expanded); }
+classname::classname() { setflag(status_flags::evaluated | status_flags::expanded); }
#define DEFAULT_UNARCHIVE(classname) \
ex classname::unarchive(const archive_node &n, lst &sym_lst) \
// default constructor
//////////
-wildcard::wildcard() : inherited(&wildcard::tinfo_static), label(0)
+wildcard::wildcard() : label(0)
{
setflag(status_flags::evaluated | status_flags::expanded);
}
// other constructors
//////////
-wildcard::wildcard(unsigned l) : inherited(&wildcard::tinfo_static), label(l)
+wildcard::wildcard(unsigned l) : label(l)
{
setflag(status_flags::evaluated | status_flags::expanded);
}