Commit a48606f5 authored by Jérôme Galtier's avatar Jérôme Galtier
Browse files

Prototype boolean graph implementation where weights are not stored.

parent bf5750fb
......@@ -49,7 +49,7 @@ namespace vcsn
// FIXME: these typedefs should be private
// BIG FAT WARNING: vertex_t (see listg)
typedef EdgeValue<vertex_t, label_t, identity_t> edge_value_t;
typedef EdgeValue<vertex_t, label_t, identity_t<weight_t> > edge_value_t;
// END FIXME
// Edges data holder.
......
......@@ -38,6 +38,7 @@ namespace vcsn
struct edge_h {};
// Tag for boolean automata.
template <typename W>
struct identity_t {};
// Edge holder.
......@@ -54,11 +55,11 @@ namespace vcsn
S to_;
};
template <typename S, typename T>
struct EdgeValue<S, T, identity_t>
template <typename S, typename T, typename W>
struct EdgeValue<S, T, identity_t<W> >
{
// FIXME: check if default value for l is usefull.
EdgeValue(const S& from, const T& label, const S& to);
EdgeValue(const S& from, const W& weight, const T& label, const S& to);
S from_;
T label_;
......@@ -235,7 +236,7 @@ namespace vcsn
hvertex_t dst_of(const hedge_t& h) const;
const label_t& label_of(const hedge_t& h) const;
const weight_t& weight_of(const hedge_t& h) const;
const weight_t weight_of(const hedge_t& h) const;
void update(const hedge_t& h, const label_t& l);
/** @} */
......
......@@ -31,8 +31,8 @@ namespace vcsn
: from_(from), weight_(weight), label_(label), to_(to)
{}
template <typename S, typename T>
EdgeValue<S, T, identity_t>::EdgeValue(const S& from, const T& label, const S& to)
template <typename S, typename T, typename W>
EdgeValue<S, T, identity_t<W> >::EdgeValue(const S& from, const W& weight, const T& label, const S& to)
: from_(from), label_(label), to_(to)
{}
......@@ -138,7 +138,7 @@ namespace vcsn
}
template <typename S>
const typename GraphBase<S>::weight_t&
const typename GraphBase<S>::weight_t
GraphBase<S>::weight_of(const hedge_t& h) const
{
return static_cast<const S*>(this)->op_weight_of(h);
......
......@@ -54,7 +54,7 @@ namespace vcsn
typename DeltaTransitionIterator<T>::weight_t
DeltaTransitionIterator<T>::op_weight() const
{
return this->graph_.weight_of(*i_);
return weight_t(1);
}
template <typename T>
......
......@@ -52,7 +52,7 @@ namespace vcsn
// BIG FAT WARNING: hvertex_t (see bmig)
// (it cannot work as we don't know hvertex here)
// FIXME: please remove the handler
typedef EdgeValue<hvertex_t, label_t, weight_t> edge_value_t;
typedef EdgeValue<hvertex_t, label_t, identity_t<weight_t> > edge_value_t;
// END FIXME
// Edges data holder.
......@@ -127,7 +127,7 @@ namespace vcsn
void op_del_edge(const hedge_t&);
bool op_has_edge(const hedge_t&) const;
const label_t& op_label_of(const hedge_t&) const;
const weight_t& op_weight_of(const hedge_t&) const;
const weight_t op_weight_of(const hedge_t&) const;
hvertex_t op_src_of(const hedge_t&) const;
hvertex_t op_dst_of(const hedge_t&) const;
......
......@@ -176,7 +176,6 @@ namespace vcsn
edges_[e].from_ = n1;
edges_[e].to_ = n2;
edges_[e].label_ = v;
edges_[e].weight_ = w;
}
vertices_[n1].output_edges.insert(e);
......@@ -224,11 +223,11 @@ namespace vcsn
}
template <typename Label, typename Weight, typename Tag, typename GeometryCoords>
const typename ListGraph<Label, Weight, Tag, GeometryCoords>::weight_t&
const typename ListGraph<Label, Weight, Tag, GeometryCoords>::weight_t
ListGraph<Label, Weight, Tag, GeometryCoords>::op_weight_of(const hedge_t& n) const
{
precondition(has_edge(n));
return edges_[n].weight_;
return weight_t(1);
}
template <typename Label, typename Weight, typename Tag, typename GeometryCoords>
......
......@@ -42,6 +42,8 @@ namespace vcsn {
template <typename St, typename auto_t>
void fsm_dump(St& out, const auto_t& a)
{
AUTOMATON_TYPES(auto_t);
if (a.states().size() == 0)
return;
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment