File:  [CENS] / python / pyGiNaC / wrappers / wrap_classes.cpp
Revision 1.2: download - view: text, annotated - select for diffs - revision graph
Wed Apr 11 20:31:31 2001 UTC (16 years, 7 months ago) by pearu
Branches: MAIN
CVS tags: HEAD
Exposed lots of functions. Documented most important classes/functions. minor_version = 2

/*
# This file is part of the PyGiNaC package.
# http://cens.ioc.ee/projects/pyginac/
#
# $Revision: 1.2 $
# $Id: wrap_classes.cpp,v 1.2 2001-04-11 20:31:31 pearu Exp $
#
# Copyright 2001 Pearu Peterson all rights reserved,
# Pearu Peterson <pearu@cens.ioc.ee>
# Permission to use, modify, and distribute this software is given under the
# terms of the LGPL.  See http://www.fsf.org
#
# NO WARRANTY IS EXPRESSED OR IMPLIED.  USE AT YOUR OWN RISK.
#
*/

#define PYGINAC_WRAP(OBJ,CLASS) ((const wrap_##CLASS &)OBJ)

#ifdef GINAC_VERSION_0_8_0_OR_EARLIER
#define GINAC_python_str(e) e.print(os,level)
#define PYGINAC_FUNCTION_GETNAME(f) PYGINAC_WRAP(f,function).get_name()
#else
#define GINAC_python_str(e) e.print(print_context(os),level)
#define PYGINAC_FUNCTION_GETNAME(f) f.get_name()
#endif

#if 0
#define DEBUG_STR(o) cout << o << endl;
#else
#define DEBUG_STR(o)
#endif

#if 0
#define DEBUG_REPR(o) cout << o << endl;
#else
#define DEBUG_REPR(o)
#endif

const ex & _ex1_2(void);
const ex & _ex1(void);
const numeric & _num_1(void);
const numeric & _num1(void);

static void python_repr(std::ostream &, const ex &);
static void python_repr_ops(std::ostream &, const ex &);
static void python_repr(std::ostream &, const expair &);
static void python_repr(std::ostream &, const epvector &);
static void python_repr(std::ostream &, const exvector &);
static void python_repr(std::ostream &, const matrix &);
static void python_repr(std::ostream &, const pseries &);
static void python_repr(std::ostream &, const indexed &);
static void python_repr(std::ostream &, const function &);
static void python_str(std::ostream &, const expair &, unsigned level=0);
static void python_str(std::ostream &, const epvector &, unsigned level=0);
static void python_str(std::ostream &, const exvector &, unsigned level=0);
static void python_str(std::ostream &, const ex &, unsigned level=0);
static void python_str(std::ostream &, const matrix &, unsigned level=0);
static void python_str(std::ostream &, const lst &, unsigned level=0);
static void python_str(std::ostream &, const add &, unsigned level=0);
static void python_str(std::ostream &, const mul &, unsigned level=0);
static void python_str(std::ostream &, const relational &, unsigned level=0);
static void python_str(std::ostream &, const power &, unsigned level=0);
static void python_str(std::ostream &, const pseries &, unsigned level=0);
static void python_str(std::ostream &, const idx &, unsigned level=0);
static void python_str(std::ostream & os, const indexed & v, unsigned level=0);
static void python_str(std::ostream &, const ncmul &, unsigned level=0);
static void python_str(std::ostream &, const function &, unsigned level=0);

struct wrap_function: public function {
public:
  inline unsigned get_precedence(void) const { return this->precedence; }
  std::string get_name(void) const { return registered_functions()[serial].get_name(); }
};
class wrap_add: public add {
public:
  inline unsigned get_precedence(void) const { return this->precedence; }
  inline const epvector & get_seq(void) const { return this->seq; }
  inline const ex & get_overall_coeff(void) const { return this->overall_coeff; }
};
class wrap_mul: public mul {
public:
  inline unsigned get_precedence(void) const { return this->precedence; }
  inline const epvector & get_seq(void) const { return this->seq; }
  inline const ex & get_overall_coeff(void) const { return this->overall_coeff; }
};
class wrap_relational: public relational {
public:
  inline unsigned get_precedence(void) const { return this->precedence; }
  inline operators get_o(void) const { return this->o; }
};
class wrap_power: public power {
public:
  inline unsigned get_precedence(void) const { return this->precedence; }
};
class wrap_ncmul: public ncmul {
public:
  inline unsigned get_precedence(void) const { return this->precedence; }
};
class wrap_indexed: public indexed {
public:
  inline unsigned get_precedence(void) const { return this->precedence; }
  inline symmetry_type get_symmetry(void) const { return this->symmetry; }
  inline unsigned get_representation_label(void) const {
    return 0;
    //return ((const color &)(*this)).representation_label;
    // ask GiNaC people to make it protected
  }
};
class wrap_pseries: public pseries {
public:
  inline unsigned get_precedence(void) const { return this->precedence; }
  inline const epvector & get_seq(void) const { return this->seq; }
  inline const ex & get_var(void) const { return this->var; }
  inline const ex & get_point(void) const { return this->point; }
};
class wrap_matrix: public matrix {
public:
  inline unsigned get_precedence(void) const { return this->precedence; }
  inline const exvector & get_m(void) const { return this->m; }
};

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>