/** @file exprseq.h
 *
 *  Definition of GiNaC's exprseq. */

/*
 *  This file was generated automatically by container.pl.
 *  Please do not modify it directly, edit the perl script instead!
 *  container.pl options: $CONTAINER=exprseq
 *                        $STLHEADER=vector
 *                        $reserve=1
 *                        $prepend=0
 *                        $let_op=0
 *                        $open_bracket=(
 *                        $close_bracket=)
 *                        $maxargs=15
 *
 *  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
 *  the Free Software Foundation; either version 2 of the License, or
 *  (at your option) any later version.
 *
 *  This program is distributed in the hope that it will be useful,
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *  GNU General Public License for more details.
 *
 *  You should have received a copy of the GNU General Public License
 *  along with this program; if not, write to the Free Software
 *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 */

#ifndef __GINAC_EXPRSEQ_H__
#define __GINAC_EXPRSEQ_H__

#include <vector>

// CINT needs <algorithm> to work properly with <vector> and <list> 
#include <algorithm>

#include "basic.h"
#include "ex.h"

namespace GiNaC {


// Cint does not like vector<..,default_alloc> but malloc_alloc is
// unstandardized and not supported by newer GCCs.
#if defined(__GNUC__) && ((__GNUC__ == 2) && (__GNUC_MINOR__ < 97))
typedef std::vector<ex,malloc_alloc> exvector;
#else
typedef std::vector<ex> exvector;
#endif

class exprseq : public basic
{
	GINAC_DECLARE_REGISTERED_CLASS(exprseq, basic)

public:
	exprseq(exvector const & s, bool discardable=0);
	exprseq(exvector * vp); // vp will be deleted
	explicit exprseq(const ex & param1);
	explicit exprseq(const ex & param1, const ex & param2);
	explicit exprseq(const ex & param1, const ex & param2, const ex & param3);
	explicit exprseq(const ex & param1, const ex & param2, const ex & param3, const ex & param4);
	explicit exprseq(const ex & param1, const ex & param2, const ex & param3, const ex & param4, const ex & param5);
	explicit exprseq(const ex & param1, const ex & param2, const ex & param3, const ex & param4, const ex & param5, const ex & param6);
	explicit exprseq(const ex & param1, const ex & param2, const ex & param3, const ex & param4, const ex & param5, const ex & param6, const ex & param7);
	explicit exprseq(const ex & param1, const ex & param2, const ex & param3, const ex & param4, const ex & param5, const ex & param6, const ex & param7, const ex & param8);
	explicit exprseq(const ex & param1, const ex & param2, const ex & param3, const ex & param4, const ex & param5, const ex & param6, const ex & param7, const ex & param8, const ex & param9);
	explicit exprseq(const ex & param1, const ex & param2, const ex & param3, const ex & param4, const ex & param5, const ex & param6, const ex & param7, const ex & param8, const ex & param9, const ex & param10);
	explicit exprseq(const ex & param1, const ex & param2, const ex & param3, const ex & param4, const ex & param5, const ex & param6, const ex & param7, const ex & param8, const ex & param9, const ex & param10, const ex & param11);
	explicit exprseq(const ex & param1, const ex & param2, const ex & param3, const ex & param4, const ex & param5, const ex & param6, const ex & param7, const ex & param8, const ex & param9, const ex & param10, const ex & param11, const ex & param12);
	explicit exprseq(const ex & param1, const ex & param2, const ex & param3, const ex & param4, const ex & param5, const ex & param6, const ex & param7, const ex & param8, const ex & param9, const ex & param10, const ex & param11, const ex & param12, const ex & param13);
	explicit exprseq(const ex & param1, const ex & param2, const ex & param3, const ex & param4, const ex & param5, const ex & param6, const ex & param7, const ex & param8, const ex & param9, const ex & param10, const ex & param11, const ex & param12, const ex & param13, const ex & param14);
	explicit exprseq(const ex & param1, const ex & param2, const ex & param3, const ex & param4, const ex & param5, const ex & param6, const ex & param7, const ex & param8, const ex & param9, const ex & param10, const ex & param11, const ex & param12, const ex & param13, const ex & param14, const ex & param15);


public:
	void print(const print_context & c, unsigned level = 0) const;
	bool info(unsigned inf) const;
	unsigned nops() const;
	ex & let_op(int i);
	ex expand(unsigned options=0) const;
	bool has(const ex & other) const;
	ex eval(int level=0) const;
	ex evalf(int level=0) const;
	ex normal(lst &sym_lst, lst &repl_lst, int level=0) const;
	ex derivative(const symbol & s) const;
	ex subs(const lst & ls, const lst & lr) const;
protected:
	bool is_equal_same_type(const basic & other) const;
	unsigned return_type(void) const;

	// new virtual functions which can be overridden by derived classes
public:
	virtual exprseq & append(const ex & b);
    // no prepend possible for exprseq
protected:
	virtual void printseq(const print_context & c, char openbracket, char delim,
	                      char closebracket, unsigned this_precedence,
	                      unsigned upper_precedence = 0) const;
	virtual ex thisexprseq(exvector const & v) const;
	virtual ex thisexprseq(exvector * vp) const;

protected:
	bool is_canonical() const;
	exvector evalchildren(int level) const;
	exvector evalfchildren(int level) const;
	exvector normalchildren(int level) const;
	exvector diffchildren(const symbol & s) const;
	exvector * subschildren(const lst & ls, const lst & lr) const;

protected:
	exvector seq;
	static unsigned precedence;
};

// utility functions
inline const exprseq &ex_to_exprseq(const ex &e)
{
	return static_cast<const exprseq &>(*e.bp);
}

inline exprseq &ex_to_nonconst_exprseq(const ex &e)
{
	return static_cast<exprseq &>(*e.bp);
}

} // namespace GiNaC

#endif // ndef __GINAC_EXPRSEQ_H__

