17 #ifndef VCSN_ALGORITHMS_INTERNAL_PARTIAL_RAT_EXP_HH
18 # define VCSN_ALGORITHMS_INTERNAL_PARTIAL_RAT_EXP_HH
32 # include <vaucanson/algebra/implementation/series/krat_exp_pattern.hh>
34 # include <vaucanson/algebra/implementation/series/krat.hh>
43 template <
bool IsConst,
typename T>
48 struct reference_type<true, T>
49 {
typedef const T& ret; };
51 template <
bool IsConst,
typename T>
53 {
typedef typename T::iterator ret; };
56 struct iterator_type<true, T>
57 {
typedef typename T::const_iterator ret; };
64 template <
typename Series,
typename T>
68 typedef Element<Series, T> exp_t;
69 typedef Series series_set_t;
70 typedef T series_set_elt_value_t;
71 typedef typename T::node_t node_t;
72 typedef typename exp_t::semiring_elt_t semiring_elt_t;
78 typedef std::list<const node_t*> node_list_t;
79 typedef std::list<semiring_elt_t> semiring_elt_list_t;
83 PartialExp(
const exp_t &e);
84 PartialExp(
const exp_t &e,
const semiring_elt_t& w);
85 PartialExp(
const PartialExp &other);
88 template <
typename M,
typename W>
89 PartialExp& insert(
const rat::Node<M, W>* v);
92 semiring_elt_list_t& weights();
93 const semiring_elt_list_t& weights()
const;
95 const node_list_t& nodes()
const;
98 PartialExp& operator<<=(
const semiring_elt_t& w);
99 PartialExp& operator>>=(
const semiring_elt_t& w);
102 const exp_t& exp()
const;
103 const Series& exp_structure()
const;
104 const T& exp_value()
const;
108 const exp_t* rat_exp_;
109 semiring_elt_list_t semiring_elt_list_;
110 node_list_t node_list_;
114 template <
bool IsConst>
115 struct internal_iterator
119 reference_type<IsConst,semiring_elt_t>::ret semiring_elt_ref_t;
121 reference_type<IsConst,const node_t*>::ret node_ref_t;
123 iterator_type<IsConst,semiring_elt_list_t>::ret semiring_elts_iterator_t;
125 iterator_type<IsConst,node_list_t>::ret nodes_iterator_t;
127 internal_iterator(
const semiring_elts_iterator_t&,
128 const nodes_iterator_t&);
129 internal_iterator& operator++();
130 internal_iterator operator++(
int);
131 bool operator!=(
const internal_iterator& other);
132 bool operator==(
const internal_iterator& other);
133 semiring_elt_ref_t semiring_elt()
const;
134 node_ref_t node()
const;
135 bool on_node()
const;
137 semiring_elts_iterator_t semiring_elts_iterator_;
138 nodes_iterator_t nodes_iterator_;
143 typedef internal_iterator<false> iterator;
144 typedef internal_iterator<true> const_iterator;
149 const_iterator begin()
const;
150 const_iterator end()
const;
157 template <
typename S,
typename T>
158 std::ostream& operator<< (std::ostream& o, const PartialExp<S, T>& e);
161 template <
typename S,
typename T>
162 std::list<PartialExp<S, T> > prat_exp_convert(
const std::list<Element<S, T> >& exp);
164 template <
typename S,
typename T>
165 PartialExp<S, T> prat_exp_convert(
const Element<S, T>& exp);
167 template <
typename S,
typename T>
168 bool operator< (const PartialExp<S, T>& e1,
const PartialExp<S, T>& e2);
170 template <
typename S,
typename T>
171 bool operator== (
const PartialExp<S, T>& e1,
const PartialExp<S, T>& e2);
173 template <
typename S,
typename T>
174 bool unweighted_eq(
const PartialExp<S, T>& e1,
const PartialExp<S, T>& e2);
176 template <
typename S,
typename T>
177 bool unweighted_inf(
const PartialExp<S, T>& e1,
const PartialExp<S, T>& e2);
182 # if !defined VCSN_USE_INTERFACE_ONLY && !defined VCSN_USE_LIB
183 # include <vaucanson/algorithms/internal/partial_rat_exp.hxx>
184 #endif // VCSN_USE_INTERFACE_ONLY
187 #endif // ! VCSN_ALGORITHMS_INTERNAL_PARTIAL_RAT_EXP_HH