template <template <class T, class = std::allocator<T> > class C>
class container : public basic, public container_storage<C> {
GINAC_DECLARE_REGISTERED_CLASS(container, basic)
-
protected:
typedef typename container_storage<C>::STLT STLT;
protected:
// helpers
- static tinfo_t get_tinfo() { return NULL; }
static unsigned get_default_flags() { return 0; }
static char get_open_delim() { return '('; }
static char get_close_delim() { return ')'; }
// constructors
public:
- container(STLT const & s, bool discardable = false) : inherited(get_tinfo())
+ container(STLT const & s, bool discardable = false)
{
setflag(get_default_flags());
this->seq = s;
}
- explicit container(std::auto_ptr<STLT> vp) : inherited(get_tinfo())
+ explicit container(std::auto_ptr<STLT> vp)
{
setflag(get_default_flags());
this->seq.swap(*vp);
}
container(exvector::const_iterator b, exvector::const_iterator e)
- : inherited(get_tinfo()), container_storage<C>(b, e)
+ : container_storage<C>(b, e)
{
setflag(get_default_flags());
}
explicit container(const ex & p1)
- : inherited(get_tinfo()), container_storage<C>(1, p1)
+ : container_storage<C>(1, p1)
{
setflag(get_default_flags());
}
- container(const ex & p1, const ex & p2) : inherited(get_tinfo())
+ container(const ex & p1, const ex & p2)
{
setflag(get_default_flags());
reserve(this->seq, 2);
this->seq.push_back(p1); this->seq.push_back(p2);
}
- container(const ex & p1, const ex & p2, const ex & p3) : inherited(get_tinfo())
+ container(const ex & p1, const ex & p2, const ex & p3)
{
setflag(get_default_flags());
reserve(this->seq, 3);
}
container(const ex & p1, const ex & p2, const ex & p3,
- const ex & p4) : inherited(get_tinfo())
+ const ex & p4)
{
setflag(get_default_flags());
reserve(this->seq, 4);
}
container(const ex & p1, const ex & p2, const ex & p3,
- const ex & p4, const ex & p5) : inherited(get_tinfo())
+ const ex & p4, const ex & p5)
{
setflag(get_default_flags());
reserve(this->seq, 5);
}
container(const ex & p1, const ex & p2, const ex & p3,
- const ex & p4, const ex & p5, const ex & p6) : inherited(get_tinfo())
+ const ex & p4, const ex & p5, const ex & p6)
{
setflag(get_default_flags());
reserve(this->seq, 6);
container(const ex & p1, const ex & p2, const ex & p3,
const ex & p4, const ex & p5, const ex & p6,
- const ex & p7) : inherited(get_tinfo())
+ const ex & p7)
{
setflag(get_default_flags());
reserve(this->seq, 7);
container(const ex & p1, const ex & p2, const ex & p3,
const ex & p4, const ex & p5, const ex & p6,
- const ex & p7, const ex & p8) : inherited(get_tinfo())
+ const ex & p7, const ex & p8)
{
setflag(get_default_flags());
reserve(this->seq, 8);
container(const ex & p1, const ex & p2, const ex & p3,
const ex & p4, const ex & p5, const ex & p6,
- const ex & p7, const ex & p8, const ex & p9) : inherited(get_tinfo())
+ const ex & p7, const ex & p8, const ex & p9)
{
setflag(get_default_flags());
reserve(this->seq, 9);
container(const ex & p1, const ex & p2, const ex & p3,
const ex & p4, const ex & p5, const ex & p6,
const ex & p7, const ex & p8, const ex & p9,
- const ex & p10) : inherited(get_tinfo())
+ const ex & p10)
{
setflag(get_default_flags());
reserve(this->seq, 10);
container(const ex & p1, const ex & p2, const ex & p3,
const ex & p4, const ex & p5, const ex & p6,
const ex & p7, const ex & p8, const ex & p9,
- const ex & p10, const ex & p11) : inherited(get_tinfo())
+ const ex & p10, const ex & p11)
{
setflag(get_default_flags());
reserve(this->seq, 11);
container(const ex & p1, const ex & p2, const ex & p3,
const ex & p4, const ex & p5, const ex & p6,
const ex & p7, const ex & p8, const ex & p9,
- const ex & p10, const ex & p11, const ex & p12) : inherited(get_tinfo())
+ const ex & p10, const ex & p11, const ex & p12)
{
setflag(get_default_flags());
reserve(this->seq, 12);
const ex & p4, const ex & p5, const ex & p6,
const ex & p7, const ex & p8, const ex & p9,
const ex & p10, const ex & p11, const ex & p12,
- const ex & p13) : inherited(get_tinfo())
+ const ex & p13)
{
setflag(get_default_flags());
reserve(this->seq, 13);
const ex & p4, const ex & p5, const ex & p6,
const ex & p7, const ex & p8, const ex & p9,
const ex & p10, const ex & p11, const ex & p12,
- const ex & p13, const ex & p14) : inherited(get_tinfo())
+ const ex & p13, const ex & p14)
{
setflag(get_default_flags());
reserve(this->seq, 14);
const ex & p4, const ex & p5, const ex & p6,
const ex & p7, const ex & p8, const ex & p9,
const ex & p10, const ex & p11, const ex & p12,
- const ex & p13, const ex & p14, const ex & p15) : inherited(get_tinfo())
+ const ex & p13, const ex & p14, const ex & p15)
{
setflag(get_default_flags());
reserve(this->seq, 15);
const ex & p7, const ex & p8, const ex & p9,
const ex & p10, const ex & p11, const ex & p12,
const ex & p13, const ex & p14, const ex & p15,
- const ex & p16) : inherited(get_tinfo())
+ const ex & p16)
{
setflag(get_default_flags());
reserve(this->seq, 16);
ex eval(int level = 0) const;
ex subs(const exmap & m, unsigned options = 0) const;
+ void read_archive(const archive_node &n, lst &sym_lst)
+ {
+ inherited::read_archive(n, sym_lst);
+ setflag(get_default_flags());
+
+ archive_node::archive_node_cit first = n.find_first("seq");
+ archive_node::archive_node_cit last = n.find_last("seq");
+ ++last;
+ reserve(this->seq, last - first);
+ for (archive_node::archive_node_cit i=first; i<last; ++i) {
+ ex e;
+ n.find_ex_by_loc(i, e, sym_lst);
+ this->seq.push_back(e);
+ }
+ }
+
+ /** Archive the object. */
+ void archive(archive_node &n) const
+ {
+ inherited::archive(n);
+ const_iterator i = this->seq.begin(), end = this->seq.end();
+ while (i != end) {
+ n.add_ex("seq", *i);
+ ++i;
+ }
+ }
+
protected:
ex conjugate() const
{
/** Default constructor */
template <template <class T, class = std::allocator<T> > class C>
-container<C>::container() : inherited(get_tinfo())
+container<C>::container()
{
setflag(get_default_flags());
}
-/** Construct object from archive_node. */
-template <template <class T, class = std::allocator<T> > class C>
-container<C>::container(const archive_node &n, lst &sym_lst) : inherited(n, sym_lst)
-{
- setflag(get_default_flags());
-
- archive_node::archive_node_cit first = n.find_first("seq");
- archive_node::archive_node_cit last = n.find_last("seq");
- ++last;
- reserve(this->seq, last - first);
- for (archive_node::archive_node_cit i=first; i<last; ++i) {
- ex e;
- n.find_ex_by_loc(i, e, sym_lst);
- this->seq.push_back(e);
- }
-}
-
-/** Unarchive the object. */
-template <template <class T, class = std::allocator<T> > class C>
-ex container<C>::unarchive(const archive_node &n, lst &sym_lst)
-{
- return (new container(n, sym_lst))->setflag(status_flags::dynallocated);
-}
-
-/** Archive the object. */
-template <template <class T, class = std::allocator<T> > class C>
-void container<C>::archive(archive_node &n) const
-{
- inherited::archive(n);
- const_iterator i = this->seq.begin(), end = this->seq.end();
- while (i != end) {
- n.add_ex("seq", *i);
- ++i;
- }
-}
template <template <class T, class = std::allocator<T> > class C>
void container<C>::do_print(const print_context & c, unsigned level) const