basix_doc 0.1
/Users/mourrain/Devel/mmx/basix/src/compound.cpp
Go to the documentation of this file.
00001 
00002 /******************************************************************************
00003 * MODULE     : compound.cpp
00004 * DESCRIPTION: Compound generic expressions
00005 * COPYRIGHT  : (C) 2005  Joris van der Hoeven
00006 *******************************************************************************
00007 * This software falls under the GNU general public license and comes WITHOUT
00008 * ANY WARRANTY WHATSOEVER. See the file $TEXMACS_PATH/LICENSE for more details.
00009 * If you don't have this file, write to the Free Software Foundation, Inc.,
00010 * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
00011 ******************************************************************************/
00012 
00013 #include <basix/compound.hpp>
00014 namespace mmx {
00015 
00016 vector<generic>
00017 compound_to_vector (const generic& g) {
00018   return as_vector (as<compound> (g));
00019 }
00020 
00021 generic
00022 vector_to_compound (const vector<generic>& v) {
00023   return as<generic> (compound (v));
00024 }
00025 
00026 syntactic
00027 flatten (const compound& c) {
00028   const vector<generic> v= as_vector (c);
00029   nat i, n= N(v);
00030   vector<generic> w= fill<generic> (n);
00031   for (i=0; i<n; i++)
00032     w[i]= as_generic (flatten (v[i]));
00033   return as_syntactic (vector_to_compound (w));
00034 }
00035 
00036 generic
00037 generic::operator () () const {
00038   return new generic_concrete_rep<compound> (vec<generic> (*this));
00039 }
00040 
00041 generic
00042 generic::operator () (const generic& g1) const {
00043   return new generic_concrete_rep<compound> (vec<generic> (*this, g1));
00044 }
00045 
00046 generic
00047 generic::operator () (const generic& g1, const generic& g2) const {
00048   return new generic_concrete_rep<compound> (vec<generic> (*this, g1, g2));
00049 }
00050 
00051 generic
00052 generic::operator () (const generic& g1, const generic& g2,
00053                       const generic& g3) const {
00054   return new generic_concrete_rep<compound> (vec<generic> (*this, g1, g2, g3));
00055 }
00056 
00057 generic
00058 gen (const generic& x1, const vector<generic>& v) {
00059   return as<generic> (compound (cons (x1, v)));
00060 }
00061 
00062 generic
00063 gen () {
00064   return as<generic> (compound (vec<generic> ()));
00065 }
00066 
00067 generic
00068 gen (const generic& x1) {
00069   return as<generic> (compound (vec<generic> (x1)));
00070 }
00071 
00072 generic
00073 gen (const generic& x1, const generic& x2) {
00074   return as<generic> (compound (vec<generic> (x1, x2)));
00075 }
00076 
00077 generic
00078 gen (const generic& x1, const string& x2) {
00079   return as<generic> (compound (vec<generic> (x1, generic (x2))));
00080 }
00081 
00082 generic
00083 gen (const generic& x1, const generic& x2, const generic& x3) {
00084   return as<generic> (compound (vec<generic> (x1, x2, x3)));
00085 }
00086 
00087 generic
00088 gen (const generic& x1, const generic& x2,
00089      const generic& x3, const generic& x4) {
00090   return as<generic> (compound (vec<generic> (x1, x2, x3, x4)));
00091 }
00092 
00093 generic
00094 gen (const generic& x1, const generic& x2,
00095      const generic& x3, const generic& x4, const generic& x5) {
00096   return as<generic> (compound (vec<generic> (x1, x2, x3, x4, x5)));
00097 }
00098 
00099 generic
00100 gen (const generic& x1, const generic& x2,
00101      const generic& x3, const generic& x4,
00102      const generic& x5, const generic& x6) {
00103   return as<generic> (compound (vec<generic> (x1, x2, x3, x4, x5, x6)));
00104 }
00105 
00106 } // namespace mmx
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines