X-Git-Url: https://www.ginac.de/ginac.git//ginac.git?p=ginac.git;a=blobdiff_plain;f=ginac%2Florentzidx.cpp;h=783316c48b9f173547abcdd16cc1d70ac5baf948;hp=ed6da8a2c65b47364bbd09efa0f3e8d82e0adef1;hb=dad107ff48f68d45e72469a8716df375ae145cf3;hpb=aac27f42467a94f0688964d5fc7db0c23d2486c0 diff --git a/ginac/lorentzidx.cpp b/ginac/lorentzidx.cpp index ed6da8a2..783316c4 100644 --- a/ginac/lorentzidx.cpp +++ b/ginac/lorentzidx.cpp @@ -29,9 +29,7 @@ #include "utils.h" #include "debugmsg.h" -#ifndef NO_NAMESPACE_GINAC namespace GiNaC { -#endif // ndef NO_NAMESPACE_GINAC GINAC_IMPLEMENT_REGISTERED_CLASS(lorentzidx, idx) @@ -49,28 +47,6 @@ lorentzidx::lorentzidx() : orthogonal_only(false), dim_parallel_space(0) tinfo_key = TINFO_lorentzidx; } -lorentzidx::~lorentzidx() -{ - debugmsg("lorentzidx destructor",LOGLEVEL_DESTRUCT); - destroy(false); -} - -lorentzidx::lorentzidx(const lorentzidx & other) -{ - debugmsg("lorentzidx copy constructor",LOGLEVEL_CONSTRUCT); - copy(other); -} - -const lorentzidx & lorentzidx::operator=(const lorentzidx & other) -{ - debugmsg("lorentzidx operator=",LOGLEVEL_ASSIGNMENT); - if (this != &other) { - destroy(true); - copy(other); - } - return *this; -} - // protected void lorentzidx::copy(const lorentzidx & other) @@ -193,12 +169,6 @@ void lorentzidx::archive(archive_node &n) const // public -basic * lorentzidx::duplicate() const -{ - debugmsg("lorentzidx duplicate",LOGLEVEL_DUPLICATE); - return new lorentzidx(*this); -} - void lorentzidx::printraw(std::ostream & os) const { debugmsg("lorentzidx printraw",LOGLEVEL_PRINT); @@ -282,11 +252,17 @@ bool lorentzidx::info(unsigned inf) const return inherited::info(inf); } -////////// -// new virtual functions which can be overridden by derived classes -////////// - -// none +int lorentzidx::compare_same_type(const basic & other) const +{ + GINAC_ASSERT(is_of_type(other, lorentzidx)); + const lorentzidx &o = static_cast(other); + + if (orthogonal_only != o.orthogonal_only) + return orthogonal_only ? -1 : 1; + if (dim_parallel_space != o.dim_parallel_space) + return dim_parallel_space < o.dim_parallel_space ? -1 : 1; + return inherited::compare_same_type(other); +} ////////// // non-virtual functions in this class @@ -307,12 +283,6 @@ lorentzidx lorentzidx::create_anonymous_representative(void) const return i_copy; } -////////// -// static member variables -////////// - -// none - ////////// // global functions ////////// @@ -324,13 +294,4 @@ ex Dim(void) return *d; } -////////// -// global constants -////////// - -const lorentzidx some_lorentzidx; -const std::type_info & typeid_lorentzidx = typeid(some_lorentzidx); - -#ifndef NO_NAMESPACE_GINAC } // namespace GiNaC -#endif // ndef NO_NAMESPACE_GINAC