* Implementation of GiNaC's color indices. */
/*
- * GiNaC Copyright (C) 1999-2000 Johannes Gutenberg University Mainz, Germany
+ * GiNaC Copyright (C) 1999-2001 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
#include "utils.h"
#include "debugmsg.h"
-#ifndef NO_NAMESPACE_GINAC
namespace GiNaC {
-#endif // ndef NO_NAMESPACE_GINAC
GINAC_IMPLEMENT_REGISTERED_CLASS(coloridx, idx)
tinfo_key=TINFO_coloridx;
}
-coloridx::~coloridx()
-{
- debugmsg("coloridx destructor",LOGLEVEL_DESTRUCT);
- destroy(false);
-}
-
-coloridx::coloridx(const coloridx & other)
-{
- debugmsg("coloridx copy constructor",LOGLEVEL_CONSTRUCT);
- copy(other);
-}
-
-const coloridx & coloridx::operator=(const coloridx & other)
-{
- debugmsg("coloridx operator=",LOGLEVEL_ASSIGNMENT);
- if (this != &other) {
- destroy(true);
- copy(other);
- }
- return *this;
-}
-
// protected
void coloridx::copy(const coloridx & other)
// public
+/** Construct symbolic color index, using an automatically generated unique name.
+ *
+ * @param cov Index is covariant (contravariant otherwise)
+ * @return newly constructed index */
coloridx::coloridx(bool cov) : idx(cov)
{
debugmsg("coloridx constructor from bool",LOGLEVEL_CONSTRUCT);
tinfo_key=TINFO_coloridx;
}
+/** Construct symbolic color index with specified name.
+ *
+ * @param n Symbolic index name
+ * @param cov Index is covariant (contravariant otherwise)
+ * @return newly constructed index */
coloridx::coloridx(const std::string & n, bool cov) : idx(n,cov)
{
debugmsg("coloridx constructor from string,bool",LOGLEVEL_CONSTRUCT);
tinfo_key=TINFO_coloridx;
}
+/** Construct symbolic color index with specified name.
+ *
+ * @param n Symbolic index name
+ * @param cov Index is covariant (contravariant otherwise)
+ * @return newly constructed index */
coloridx::coloridx(const char * n, bool cov) : idx(n,cov)
{
debugmsg("coloridx constructor from char*,bool",LOGLEVEL_CONSTRUCT);
tinfo_key=TINFO_coloridx;
}
+/** Construct numeric color index with specified value.
+ *
+ * @param v Numeric index value
+ * @param cov Index is covariant (contravariant otherwise)
+ * @return newly constructed index */
coloridx::coloridx(unsigned v, bool cov) : idx(v,cov)
{
debugmsg("coloridx constructor from unsigned,bool",LOGLEVEL_CONSTRUCT);
// public
-basic * coloridx::duplicate() const
-{
- debugmsg("coloridx duplicate",LOGLEVEL_DUPLICATE);
- return new coloridx(*this);
-}
-
void coloridx::printraw(std::ostream & os) const
{
debugmsg("coloridx printraw",LOGLEVEL_PRINT);
return idx::info(inf);
}
-//////////
-// new virtual functions which can be overridden by derived classes
-//////////
-
-// none
-
-//////////
-// non-virtual functions in this class
-//////////
-
-// none
-
-//////////
-// static member variables
-//////////
-
-// none
-
-//////////
-// global constants
-//////////
-
-const coloridx some_coloridx;
-const std::type_info & typeid_coloridx = typeid(some_coloridx);
+int coloridx::compare_same_type(const basic & other) const
+{
+ return inherited::compare_same_type(other);
+}
-#ifndef NO_NAMESPACE_GINAC
} // namespace GiNaC
-#endif // ndef NO_NAMESPACE_GINAC