00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028 #ifndef OLENA_MORPHO_SPLITSE_HH
00029 # define OLENA_MORPHO_SPLITSE_HH
00030
00031 # include <oln/basics.hh>
00032
00033 namespace oln {
00034 namespace morpho {
00035
00048 template<class E>
00049 mlc_exact_type(E)
00050 get_plus_se_only(const abstract::struct_elt<E>& se)
00051 {
00052 oln_iter_type(E) dp(se);
00053 E out;
00054
00055 for_all (dp)
00056 {
00057 unsigned n;
00058 for (n = 0; n < E::dim; ++n)
00059 if (dp.cur().nth(n) < 0) {
00060 out.add(dp);
00061 break;
00062 } else if (dp.cur().nth(n) > 0) {
00063 break;
00064 }
00065 }
00066 return out;
00067 }
00068
00082 template<class E>
00083 mlc_exact_type(E)
00084 get_plus_se_p(const abstract::struct_elt<E>& se)
00085 {
00086 oln_iter_type(E) dp(se);
00087 E out;
00088
00089 for_all (dp)
00090 {
00091 unsigned n;
00092 for (n = 0; n < E::dim; ++n)
00093 if (dp.cur().nth(n) < 0) {
00094 out.add(dp);
00095 break;
00096 } else if (dp.cur().nth(n) > 0) {
00097 break;
00098 }
00099
00100 if (n == E::dim)
00101 out.add(dp);
00102 }
00103 return out;
00104 }
00105
00118 template<class E>
00119 mlc_exact_type(E)
00120 get_minus_se_only(const abstract::struct_elt<E>& se)
00121 {
00122 oln_iter_type(E) dp(se);
00123 E out;
00124
00125 for_all (dp)
00126 {
00127 unsigned n;
00128 for (n = 0; n < E::dim; ++n)
00129 if (dp.cur().nth(n) > 0) {
00130 out.add(dp);
00131 break;
00132 } else if (dp.cur().nth(n) < 0) {
00133 break;
00134 }
00135 }
00136 return out;
00137 }
00138
00152 template<class E>
00153 mlc_exact_type(E)
00154 get_minus_se_p(const abstract::struct_elt<E>& se)
00155 {
00156 oln_iter_type(E) dp(se);
00157 E out;
00158
00159 for_all (dp)
00160 {
00161 unsigned n;
00162 for (n = 0; n < E::dim; ++n)
00163 if (dp.cur().nth(n) > 0) {
00164 out.add(dp);
00165 break;
00166 } else if (dp.cur().nth(n) < 0) {
00167 break;
00168 }
00169
00170 if (n == E::dim)
00171 out.add(dp);
00172 }
00173 return out;
00174 }
00175
00176 }
00177 }
00178
00179 #endif // OLENA_MORPHO_SPLITSE_HH