X-Git-Url: https://www.ginac.de/ginac.git//ginac.git?a=blobdiff_plain;f=ginac%2Fcoloridx.cpp;h=3e871fbe9fbf83dc140d008ceb818616aa4b2ab5;hb=083b0f50275a536be807fa2a34c1e278098e12f5;hp=be7768d7dfb75b93d5122b320471b586432d03e0;hpb=a8507b8af1c08d9b27d98d57f95c7ca1a8671e27;p=ginac.git diff --git a/ginac/coloridx.cpp b/ginac/coloridx.cpp index be7768d7..3e871fbe 100644 --- a/ginac/coloridx.cpp +++ b/ginac/coloridx.cpp @@ -1,8 +1,9 @@ /** @file coloridx.cpp * - * Implementation of GiNaC's color indices. - * - * GiNaC Copyright (C) 1999 Johannes Gutenberg University Mainz, Germany + * Implementation of GiNaC's color indices. */ + +/* + * GiNaC Copyright (C) 1999-2000 Johannes Gutenberg University Mainz, Germany * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -21,8 +22,16 @@ #include -#include "ginac.h" +#include "coloridx.h" +#include "archive.h" #include "utils.h" +#include "debugmsg.h" + +#ifndef NO_NAMESPACE_GINAC +namespace GiNaC { +#endif // ndef NO_NAMESPACE_GINAC + +GINAC_IMPLEMENT_REGISTERED_CLASS(coloridx, idx) ////////// // default constructor, destructor, copy constructor assignment operator and helpers @@ -35,7 +44,7 @@ coloridx::coloridx() debugmsg("coloridx default constructor",LOGLEVEL_CONSTRUCT); // serial is incremented in idx::idx() name="color"+ToString(serial); - tinfo_key=TINFO_COLORIDX; + tinfo_key=TINFO_coloridx; } coloridx::~coloridx() @@ -44,13 +53,13 @@ coloridx::~coloridx() destroy(0); } -coloridx::coloridx(coloridx const & other) +coloridx::coloridx(const coloridx & other) { debugmsg("coloridx copy constructor",LOGLEVEL_CONSTRUCT); copy(other); } -coloridx const & coloridx::operator=(coloridx const & other) +const coloridx & coloridx::operator=(const coloridx & other) { debugmsg("coloridx operator=",LOGLEVEL_ASSIGNMENT); if (this != &other) { @@ -62,14 +71,14 @@ coloridx const & coloridx::operator=(coloridx const & other) // protected -void coloridx::copy(coloridx const & other) +void coloridx::copy(const coloridx & other) { - idx::copy(other); + inherited::copy(other); } void coloridx::destroy(bool call_parent) { - if (call_parent) idx::destroy(call_parent); + if (call_parent) inherited::destroy(call_parent); } ////////// @@ -83,25 +92,47 @@ coloridx::coloridx(bool cov) : idx(cov) debugmsg("coloridx constructor from bool",LOGLEVEL_CONSTRUCT); // serial is incremented in idx::idx(bool) name="color"+ToString(serial); - tinfo_key=TINFO_COLORIDX; + tinfo_key=TINFO_coloridx; } -coloridx::coloridx(string const & n, bool cov) : idx(n,cov) +coloridx::coloridx(const string & n, bool cov) : idx(n,cov) { debugmsg("coloridx constructor from string,bool",LOGLEVEL_CONSTRUCT); - tinfo_key=TINFO_COLORIDX; + tinfo_key=TINFO_coloridx; } -coloridx::coloridx(char const * n, bool cov) : idx(n,cov) +coloridx::coloridx(const char * n, bool cov) : idx(n,cov) { debugmsg("coloridx constructor from char*,bool",LOGLEVEL_CONSTRUCT); - tinfo_key=TINFO_COLORIDX; + tinfo_key=TINFO_coloridx; } -coloridx::coloridx(unsigned const v, bool cov) : idx(v,cov) +coloridx::coloridx(unsigned v, bool cov) : idx(v,cov) { debugmsg("coloridx constructor from unsigned,bool",LOGLEVEL_CONSTRUCT); - tinfo_key=TINFO_COLORIDX; + tinfo_key=TINFO_coloridx; +} + +////////// +// archiving +////////// + +/** Construct object from archive_node. */ +coloridx::coloridx(const archive_node &n, const lst &sym_lst) : inherited(n, sym_lst) +{ + debugmsg("coloridx constructor from archive_node", LOGLEVEL_CONSTRUCT); +} + +/** Unarchive the object. */ +ex coloridx::unarchive(const archive_node &n, const lst &sym_lst) +{ + return (new coloridx(n, sym_lst))->setflag(status_flags::dynallocated); +} + +/** Archive the object. */ +void coloridx::archive(archive_node &n) const +{ + inherited::archive(n); } ////////// @@ -207,7 +238,8 @@ bool coloridx::info(unsigned inf) const ////////// const coloridx some_coloridx; -type_info const & typeid_coloridx=typeid(some_coloridx); - - +const type_info & typeid_coloridx=typeid(some_coloridx); +#ifndef NO_NAMESPACE_GINAC +} // namespace GiNaC +#endif // ndef NO_NAMESPACE_GINAC