X-Git-Url: https://www.ginac.de/ginac.git//ginac.git?a=blobdiff_plain;f=ginac%2Fstructure.pl;h=6c5760f865d9f589a3bace7199314e1ef0444fcb;hb=6bf150d480d18b6734e412fef68157b7986f42be;hp=1455825c1ecc598097dfcf275f3213173d933d55;hpb=06eb6b761f4b9d9eed4decd8ed50d94b40b94a0e;p=ginac.git diff --git a/ginac/structure.pl b/ginac/structure.pl index 1455825c..6c5760f8 100755 --- a/ginac/structure.pl +++ b/ginac/structure.pl @@ -156,7 +156,7 @@ class ${STRUCTURE} : public structure { // member functions - // default ctor, dtor, copy ctor assignment operator and helpers + // default ctor, dtor, copy ctor, assignment operator and helpers public: ${STRUCTURE}(); ~${STRUCTURE}(); @@ -170,7 +170,7 @@ protected: public: ${STRUCTURE}(${constructor_arglist}); - // functions overriding virtual functions from bases classes + // functions overriding virtual functions from base classes public: basic * duplicate() const; void print(const print_context & c, unsigned level = 0) const; @@ -209,10 +209,6 @@ extern const ${STRUCTURE} some_${STRUCTURE}; extern const type_info & typeid_${STRUCTURE}; extern const unsigned tinfo_${STRUCTURE}; -// macros - -#define ex_to_${STRUCTURE}(X) (static_cast<${STRUCTURE} const &>(*(X).bp)) - } // namespace GiNaC #endif // ndef _${STRUCTURE_UC}_H_ @@ -249,6 +245,7 @@ $implementation=< +#include #include "${STRUCTURE}.h" #include "print.h" @@ -263,25 +260,21 @@ namespace GiNaC { ${STRUCTURE}::${STRUCTURE}() { - debugmsg("${STRUCTURE} default ctor",LOGLEVEL_CONSTRUCT); tinfo_key=tinfo_${STRUCTURE}; } ${STRUCTURE}::~${STRUCTURE}() { - debugmsg("${STRUCTURE} destructor",LOGLEVEL_DESTRUCT); destroy(false); } ${STRUCTURE}::${STRUCTURE}(${STRUCTURE} const & other) { - debugmsg("${STRUCTURE} copy ctor",LOGLEVEL_CONSTRUCT); copy(other); } ${STRUCTURE} const & ${STRUCTURE}::operator=(${STRUCTURE} const & other) { - debugmsg("${STRUCTURE} operator=",LOGLEVEL_ASSIGNMENT); if (this != &other) { destroy(true); copy(other); @@ -311,25 +304,22 @@ void ${STRUCTURE}::destroy(bool call_parent) ${STRUCTURE}::${STRUCTURE}(${constructor_arglist}) : ${constructor_statements} { - debugmsg("${STRUCTURE} ctor from children", LOGLEVEL_CONSTRUCT); tinfo_key=tinfo_${STRUCTURE}; } ////////// -// functions overriding virtual functions from bases classes +// functions overriding virtual functions from base classes ////////// // public basic * ${STRUCTURE}::duplicate() const { - debugmsg("${STRUCTURE} duplicate",LOGLEVEL_DUPLICATE); return new ${STRUCTURE}(*this); } void ${STRUCTURE}::print(const print_context & c, unsigned level) const { - debugmsg("${STRUCTURE} print", LOGLEVEL_PRINT); c.s << class_name() << "()"; } @@ -346,8 +336,7 @@ ex & ${STRUCTURE}::let_op(int i) switch (i) { ${let_op_statements} } - errormsg("${STRUCTURE}::let_op(): should not reach this point"); - return *new ex(fail()); + throw(std::runtime_error("${STRUCTURE}::let_op(): should not have reached this point")); } ex ${STRUCTURE}::expand(unsigned options) const @@ -437,8 +426,7 @@ ${subs_statements} int ${STRUCTURE}::compare_same_type(const basic & other) const { GINAC_ASSERT(is_of_type(other,${STRUCTURE})); - ${STRUCTURE} const & o=static_cast<${STRUCTURE} const &> - (const_cast(other)); + ${STRUCTURE} const &o = static_cast(other); int cmpval; ${compare_statements} return 0; @@ -447,8 +435,7 @@ ${compare_statements} bool ${STRUCTURE}::is_equal_same_type(const basic & other) const { GINAC_ASSERT(is_of_type(other,${STRUCTURE})); - ${STRUCTURE} const & o=static_cast<${STRUCTURE} const &> - (const_cast(other)); + ${STRUCTURE} const &o = static_cast(other); ${is_equal_statements} return true; }