added function::get_name() to return a function's print name
authorChristian Bauer <Christian.Bauer@uni-mainz.de>
Sat, 7 Apr 2001 20:58:09 +0000 (20:58 +0000)
committerChristian Bauer <Christian.Bauer@uni-mainz.de>
Sat, 7 Apr 2001 20:58:09 +0000 (20:58 +0000)
ginac/function.pl

index 947830c4b1724c18487fffd537776efca84a1e15..b6c15814bb97e091f00044a0399a2ddd6ea69283 100755 (executable)
@@ -363,6 +363,7 @@ public:
        static unsigned register_new(function_options const & opt);
        static unsigned find_function(const std::string &name, unsigned nparams);
        unsigned getserial(void) const {return serial;}
+       std::string get_name(void) const;
        
 // member variables
 
@@ -957,6 +958,13 @@ unsigned function::find_function(const std::string &name, unsigned nparams)
        throw (std::runtime_error("no function '" + name + "' with " + ToString(nparams) + " parameters defined"));
 }
 
+/** Return the print name of the function. */
+std::string function::get_name(void) const
+{
+       GINAC_ASSERT(serial<registered_functions().size());
+       return registered_functions()[serial].name;
+}
+
 } // namespace GiNaC
 
 END_OF_IMPLEMENTATION