GiNaC  1.6.2
Public Types | Public Member Functions | Protected Types | Protected Member Functions | Static Protected Member Functions | Private Member Functions
GiNaC::container< C > Class Template Reference

Wrapper template for making GiNaC classes out of STL containers. More...

#include <container.h>

Inheritance diagram for GiNaC::container< C >:
GiNaC::basic GiNaC::container_storage< C > GiNaC::refcounted GiNaC::function GiNaC::indexed GiNaC::ncmul GiNaC::fderivative GiNaC::clifford GiNaC::color

List of all members.

Public Types

typedef STLT::const_iterator const_iterator
typedef
STLT::const_reverse_iterator 
const_reverse_iterator

Public Member Functions

 container (STLT const &s, bool discardable=false)
 container (std::auto_ptr< STLT > vp)
 container (exvector::const_iterator b, exvector::const_iterator e)
 container (const ex &p1)
 container (const ex &p1, const ex &p2)
 container (const ex &p1, const ex &p2, const ex &p3)
 container (const ex &p1, const ex &p2, const ex &p3, const ex &p4)
 container (const ex &p1, const ex &p2, const ex &p3, const ex &p4, const ex &p5)
 container (const ex &p1, const ex &p2, const ex &p3, const ex &p4, const ex &p5, const ex &p6)
 container (const ex &p1, const ex &p2, const ex &p3, const ex &p4, const ex &p5, const ex &p6, const ex &p7)
 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)
 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)
 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)
 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)
 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)
 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, const ex &p13)
 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, const ex &p13, const ex &p14)
 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, const ex &p13, const ex &p14, const ex &p15)
 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, const ex &p13, const ex &p14, const ex &p15, const ex &p16)
container_init< ex, STLToperator= (const ex &x)
bool info (unsigned inf) const
 Information about the object.
unsigned precedence () const
 Return relative operator precedence (for parenthezing output).
size_t nops () const
 Number of operands/members.
ex op (size_t i) const
 Return operand/member at position i.
exlet_op (size_t i)
 Return modifyable operand/member at position i.
ex eval (int level=0) const
 Perform automatic non-interruptive term rewriting rules.
ex subs (const exmap &m, unsigned options=0) const
 Substitute a set of objects by arbitrary expressions.
void read_archive (const archive_node &n, lst &sym_lst)
 Load (deserialize) the object from an archive node.
void archive (archive_node &n) const
 Archive the object.
containerprepend (const ex &b)
 Add element at front.
containerappend (const ex &b)
 Add element at back.
containerremove_first ()
 Remove first element.
containerremove_last ()
 Remove last element.
containerremove_all ()
 Remove all elements.
containersort ()
 Sort elements.
containerunique ()
 Remove adjacent duplicate elements.
const_iterator begin () const
const_iterator end () const
const_reverse_iterator rbegin () const
const_reverse_iterator rend () const

Protected Types

typedef container_storage< C >
::STLT 
STLT

Protected Member Functions

ex conjugate () const
ex real_part () const
ex imag_part () const
bool is_equal_same_type (const basic &other) const
 Returns true if two objects of same type are equal.
virtual ex thiscontainer (const STLT &v) const
 Similar to duplicate(), but with a preset sequence.
virtual ex thiscontainer (std::auto_ptr< STLT > vp) const
 Similar to duplicate(), but with a preset sequence (which gets deleted).
virtual void printseq (const print_context &c, char openbracket, char delim, char closebracket, unsigned this_precedence, unsigned upper_precedence=0) const
 Print sequence of contained elements.
void do_print (const print_context &c, unsigned level) const
 Default output to stream.
void do_print_tree (const print_tree &c, unsigned level) const
 Tree output to stream.
void do_print_python (const print_python &c, unsigned level) const
void do_print_python_repr (const print_python_repr &c, unsigned level) const
 Python parsable output to stream.
STLT evalchildren (int level) const
std::auto_ptr< STLTsubschildren (const exmap &m, unsigned options=0) const

Static Protected Member Functions

static unsigned get_default_flags ()
 Specialization of container::get_default_flags() for lst.
static char get_open_delim ()
 Specialization of container::get_open_delim() for lst.
static char get_close_delim ()
 Specialization of container::get_close_delim() for lst.

Private Member Functions

void sort_ (std::random_access_iterator_tag)
void sort_ (std::input_iterator_tag)
void unique_ ()
template<>
void unique_ ()

Detailed Description

template<template< class T, class=std::allocator< T > > class C>
class GiNaC::container< C >

Wrapper template for making GiNaC classes out of STL containers.

Definition at line 128 of file container.h.


Member Typedef Documentation

template<template< class T, class=std::allocator< T > > class C>
typedef container_storage<C>::STLT GiNaC::container< C >::STLT [protected]

Reimplemented from GiNaC::container_storage< C >.

Definition at line 131 of file container.h.

template<template< class T, class=std::allocator< T > > class C>
typedef STLT::const_iterator GiNaC::container< C >::const_iterator

Definition at line 134 of file container.h.

template<template< class T, class=std::allocator< T > > class C>
typedef STLT::const_reverse_iterator GiNaC::container< C >::const_reverse_iterator

Definition at line 135 of file container.h.


Constructor & Destructor Documentation

template<template< class T, class=std::allocator< T > > class C>
GiNaC::container< C >::container ( STLT const &  s,
bool  discardable = false 
) [inline]
template<template< class T, class=std::allocator< T > > class C>
GiNaC::container< C >::container ( std::auto_ptr< STLT vp) [inline, explicit]
template<template< class T, class=std::allocator< T > > class C>
GiNaC::container< C >::container ( exvector::const_iterator  b,
exvector::const_iterator  e 
) [inline]
template<template< class T, class=std::allocator< T > > class C>
GiNaC::container< C >::container ( const ex p1) [inline, explicit]
template<template< class T, class=std::allocator< T > > class C>
GiNaC::container< C >::container ( const ex p1,
const ex p2 
) [inline]
template<template< class T, class=std::allocator< T > > class C>
GiNaC::container< C >::container ( const ex p1,
const ex p2,
const ex p3 
) [inline]
template<template< class T, class=std::allocator< T > > class C>
GiNaC::container< C >::container ( const ex p1,
const ex p2,
const ex p3,
const ex p4 
) [inline]
template<template< class T, class=std::allocator< T > > class C>
GiNaC::container< C >::container ( const ex p1,
const ex p2,
const ex p3,
const ex p4,
const ex p5 
) [inline]
template<template< class T, class=std::allocator< T > > class C>
GiNaC::container< C >::container ( const ex p1,
const ex p2,
const ex p3,
const ex p4,
const ex p5,
const ex p6 
) [inline]
template<template< class T, class=std::allocator< T > > class C>
GiNaC::container< C >::container ( const ex p1,
const ex p2,
const ex p3,
const ex p4,
const ex p5,
const ex p6,
const ex p7 
) [inline]
template<template< class T, class=std::allocator< T > > class C>
GiNaC::container< C >::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 
) [inline]
template<template< class T, class=std::allocator< T > > class C>
GiNaC::container< C >::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 
) [inline]
template<template< class T, class=std::allocator< T > > class C>
GiNaC::container< C >::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 
) [inline]
template<template< class T, class=std::allocator< T > > class C>
GiNaC::container< C >::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 
) [inline]
template<template< class T, class=std::allocator< T > > class C>
GiNaC::container< C >::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 
) [inline]
template<template< class T, class=std::allocator< T > > class C>
GiNaC::container< C >::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,
const ex p13 
) [inline]
template<template< class T, class=std::allocator< T > > class C>
GiNaC::container< C >::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,
const ex p13,
const ex p14 
) [inline]
template<template< class T, class=std::allocator< T > > class C>
GiNaC::container< C >::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,
const ex p13,
const ex p14,
const ex p15 
) [inline]
template<template< class T, class=std::allocator< T > > class C>
GiNaC::container< C >::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,
const ex p13,
const ex p14,
const ex p15,
const ex p16 
) [inline]

Member Function Documentation

unsigned GiNaC::lst::get_default_flags ( ) [inline, static, protected]

Specialization of container::get_default_flags() for lst.

Definition at line 139 of file container.h.

Referenced by GiNaC::container< C >::container(), and GiNaC::container< C >::read_archive().

char GiNaC::lst::get_open_delim ( ) [inline, static, protected]

Specialization of container::get_open_delim() for lst.

Definition at line 140 of file container.h.

char GiNaC::lst::get_close_delim ( ) [inline, static, protected]

Specialization of container::get_close_delim() for lst.

Definition at line 141 of file container.h.

template<template< class T, class=std::allocator< T > > class C>
container_init<ex, STLT> GiNaC::container< C >::operator= ( const ex x) [inline]

Definition at line 351 of file container.h.

References GiNaC::container_storage< C >::seq.

bool GiNaC::lst::info ( unsigned  inf) const [inline, virtual]

Information about the object.

See also:
class info_flags

Reimplemented from GiNaC::basic.

Reimplemented in GiNaC::indexed, and GiNaC::ncmul.

Definition at line 359 of file container.h.

template<template< class T, class=std::allocator< T > > class C>
unsigned GiNaC::container< C >::precedence ( ) const [inline, virtual]

Return relative operator precedence (for parenthezing output).

Reimplemented from GiNaC::basic.

Reimplemented in GiNaC::function, GiNaC::indexed, GiNaC::ncmul, and GiNaC::clifford.

Definition at line 360 of file container.h.

Referenced by GiNaC::fderivative::do_print(), GiNaC::fderivative::do_print_csrc(), and GiNaC::function::print().

template<template< class T, class=std::allocator< T > > class C>
size_t GiNaC::container< C >::nops ( ) const [inline, virtual]
template<template< class T, class=std::allocator< T > > class C>
ex GiNaC::container< C >::op ( size_t  i) const [virtual]
template<template< class T, class=std::allocator< T > > class C>
ex & GiNaC::container< C >::let_op ( size_t  i) [virtual]

Return modifyable operand/member at position i.

Reimplemented from GiNaC::basic.

Reimplemented in GiNaC::clifford.

Definition at line 555 of file container.h.

References GINAC_ASSERT, and GiNaC::nops().

Referenced by GiNaC::H_evalf().

template<template< class T, class=std::allocator< T > > class C>
ex GiNaC::container< C >::eval ( int  level = 0) const [virtual]

Perform automatic non-interruptive term rewriting rules.

Reimplemented from GiNaC::basic.

Reimplemented in GiNaC::function, GiNaC::indexed, GiNaC::fderivative, and GiNaC::ncmul.

Definition at line 566 of file container.h.

template<template< class T, class=std::allocator< T > > class C>
ex GiNaC::container< C >::subs ( const exmap m,
unsigned  options = 0 
) const [virtual]

Substitute a set of objects by arbitrary expressions.

The ex returned will already be evaluated.

Reimplemented from GiNaC::basic.

Reimplemented in GiNaC::clifford.

Definition at line 575 of file container.h.

References GiNaC::is_a().

template<template< class T, class=std::allocator< T > > class C>
void GiNaC::container< C >::read_archive ( const archive_node n,
lst syms 
) [inline, virtual]

Load (deserialize) the object from an archive node.

Construct object from archive_node.

Note:
This method is essentially a constructor. However, constructors can't be virtual. So, if unarchiving routines are implemented as constructors one would need to define such a constructor in every class, even if all it does is simply calling constructor of a superclass.

Reimplemented from GiNaC::basic.

Reimplemented in GiNaC::function, GiNaC::indexed, GiNaC::fderivative, GiNaC::clifford, and GiNaC::color.

Definition at line 367 of file container.h.

References GiNaC::archive_node::find_ex_by_loc(), GiNaC::archive_node::find_first(), GiNaC::archive_node::find_last(), GiNaC::container< C >::get_default_flags(), last, GiNaC::container_storage< C >::reserve(), GiNaC::container_storage< C >::seq, and GiNaC::basic::setflag().

template<template< class T, class=std::allocator< T > > class C>
void GiNaC::container< C >::archive ( archive_node n) const [inline, virtual]
template<template< class T, class=std::allocator< T > > class C>
ex GiNaC::container< C >::conjugate ( ) const [inline, protected, virtual]
template<template< class T, class=std::allocator< T > > class C>
ex GiNaC::container< C >::real_part ( ) const [inline, protected, virtual]
template<template< class T, class=std::allocator< T > > class C>
ex GiNaC::container< C >::imag_part ( ) const [inline, protected, virtual]
template<template< class T, class=std::allocator< T > > class C>
bool GiNaC::container< C >::is_equal_same_type ( const basic other) const [protected, virtual]

Returns true if two objects of same type are equal.

Normally needs not be reimplemented as long as it wasn't overwritten by some parent class, since it just calls compare_same_type(). The reason why this function exists is that sometimes it is easier to determine equality than an order relation and then it can be overridden.

Reimplemented from GiNaC::basic.

Reimplemented in GiNaC::function, and GiNaC::fderivative.

Definition at line 621 of file container.h.

References GINAC_ASSERT, and GiNaC::container_storage< C >::seq.

template<template< class T, class=std::allocator< T > > class C>
virtual ex GiNaC::container< C >::thiscontainer ( const STLT v) const [inline, protected, virtual]

Similar to duplicate(), but with a preset sequence.

Must be overridden by derived classes.

Definition at line 450 of file container.h.

References GiNaC::container< C >::container().

Referenced by GiNaC::container< C >::conjugate(), GiNaC::container< C >::imag_part(), and GiNaC::container< C >::real_part().

template<template< class T, class=std::allocator< T > > class C>
virtual ex GiNaC::container< C >::thiscontainer ( std::auto_ptr< STLT vp) const [inline, protected, virtual]

Similar to duplicate(), but with a preset sequence (which gets deleted).

Must be overridden by derived classes.

Definition at line 454 of file container.h.

References GiNaC::container< C >::container().

template<template< class T, class=std::allocator< T > > class C>
void GiNaC::container< C >::printseq ( const print_context c,
char  openbracket,
char  delim,
char  closebracket,
unsigned  this_precedence,
unsigned  upper_precedence = 0 
) const [protected, virtual]
template<template< class T, class=std::allocator< T > > class C>
void GiNaC::container< C >::sort_ ( std::random_access_iterator_tag  ) [inline, private]
template<template< class T, class=std::allocator< T > > class C>
void GiNaC::container< C >::sort_ ( std::input_iterator_tag  ) [inline, private]

Definition at line 467 of file container.h.

References GiNaC::container_storage< C >::seq.

template<template< class T, class=std::allocator< T > > class C>
void GiNaC::container< C >::unique_ ( ) [inline, private]
template<template< class T, class=std::allocator< T > > class C>
container< C > & GiNaC::container< C >::prepend ( const ex b)

Add element at front.

Definition at line 641 of file container.h.

template<template< class T, class=std::allocator< T > > class C>
container< C > & GiNaC::container< C >::append ( const ex b)
template<template< class T, class=std::allocator< T > > class C>
container< C > & GiNaC::container< C >::remove_first ( )

Remove first element.

Definition at line 659 of file container.h.

Referenced by GiNaC::H_deriv(), GiNaC::sqrfree(), and GiNaC::symmetrize_cyclic().

template<template< class T, class=std::allocator< T > > class C>
container< C > & GiNaC::container< C >::remove_last ( )

Remove last element.

Definition at line 668 of file container.h.

template<template< class T, class=std::allocator< T > > class C>
container< C > & GiNaC::container< C >::remove_all ( )

Remove all elements.

Definition at line 677 of file container.h.

Referenced by GiNaC::ex::to_polynomial(), and GiNaC::ex::to_rational().

template<template< class T, class=std::allocator< T > > class C>
container< C > & GiNaC::container< C >::sort ( )

Sort elements.

Definition at line 686 of file container.h.

Referenced by GiNaC::container< C >::sort_().

template<template< class T, class=std::allocator< T > > class C>
container< C > & GiNaC::container< C >::unique ( )

Remove adjacent duplicate elements.

Definition at line 701 of file container.h.

Referenced by GiNaC::container< C >::unique_().

template<template< class T, class=std::allocator< T > > class C>
const_iterator GiNaC::container< C >::begin ( ) const [inline]
template<template< class T, class=std::allocator< T > > class C>
const_iterator GiNaC::container< C >::end ( ) const [inline]
template<template< class T, class=std::allocator< T > > class C>
const_reverse_iterator GiNaC::container< C >::rbegin ( ) const [inline]

Definition at line 489 of file container.h.

References GiNaC::container_storage< C >::seq.

template<template< class T, class=std::allocator< T > > class C>
const_reverse_iterator GiNaC::container< C >::rend ( ) const [inline]

Definition at line 490 of file container.h.

References GiNaC::container_storage< C >::seq.

template<template< class T, class=std::allocator< T > > class C>
void GiNaC::container< C >::do_print ( const print_context c,
unsigned  level 
) const [protected]

Default output to stream.

Reimplemented from GiNaC::basic.

Reimplemented in GiNaC::indexed, GiNaC::ncmul, and GiNaC::fderivative.

Definition at line 510 of file container.h.

template<template< class T, class=std::allocator< T > > class C>
void GiNaC::container< C >::do_print_tree ( const print_tree c,
unsigned  level 
) const [protected]

Tree output to stream.

Reimplemented from GiNaC::basic.

Reimplemented in GiNaC::indexed, and GiNaC::fderivative.

Definition at line 517 of file container.h.

References GiNaC::print_tree::delta_indent, GiNaC::nops(), and GiNaC::print_context::s.

template<template< class T, class=std::allocator< T > > class C>
void GiNaC::container< C >::do_print_python ( const print_python c,
unsigned  level 
) const [protected]

Definition at line 532 of file container.h.

template<template< class T, class=std::allocator< T > > class C>
void GiNaC::container< C >::do_print_python_repr ( const print_python_repr c,
unsigned  level 
) const [protected]

Python parsable output to stream.

Reimplemented from GiNaC::basic.

Definition at line 538 of file container.h.

References GiNaC::print_context::s.

template<template< class T, class=std::allocator< T > > class C>
container< C >::STLT GiNaC::container< C >::evalchildren ( int  level) const [protected]
template<template< class T, class=std::allocator< T > > class C>
std::auto_ptr< typename container< C >::STLT > GiNaC::container< C >::subschildren ( const exmap m,
unsigned  options = 0 
) const [protected]

Definition at line 754 of file container.h.

References GiNaC::are_ex_trivially_equal(), and GiNaC::ex::subs().

template<>
void GiNaC::container< std::list >::unique_ ( ) [inline, private]

Definition at line 694 of file container.h.


The documentation for this class was generated from the following files:

This page is part of the GiNaC developer's reference. It was generated automatically by doxygen. For an introduction, see the tutorial.