17 #ifndef VCSN_AUTOMATA_CONCEPT_HISTORY_HXX
18 # define VCSN_AUTOMATA_CONCEPT_HISTORY_HXX
23 # include <vaucanson/automata/concept/history.hh>
30 Event<T>::Event(event_kind_t e) : kind_(e)
39 Event<T>::get_event_kind()
const
45 BinaryEvent<T>::BinaryEvent(event_kind_t e,
const T& first,
54 BinaryEvent<T>::get_first()
const
61 BinaryEvent<T>::get_second()
const
67 UnaryEvent<T>::UnaryEvent(event_kind_t e,
const T& first) :
74 UnaryEvent<T>::get_first()
const
80 template <
class AutoType_>
82 AutomatonHistory<AutoType_>::set_state_event_about(event_kind_t e,
96 template <
class AutoType_>
98 AutomatonHistory<AutoType_>::set_state_event_about(event_kind_t e,
102 for (
typename state_events_t::const_iterator ev
103 = states_events_[s].begin();
104 ev != states_events_[s].end();
106 if (ev->get_event_kind() == e)
108 states_events_[s].push_front(UnaryEvent<hstate_t>(e, first));
112 template <
class AutoType_>
114 AutomatonHistory<AutoType_>::set_state_event_about(event_kind_t e,
119 for (
typename state_events_t::const_iterator ev =
120 states_events_[s].begin();
121 ev != states_events_[s].end();
123 if (ev->get_event_kind() == e)
125 states_events_[s].push_front(BinaryEvent<hstate_t>
130 template <
class AutoType_>
131 const Event<typename AutoType_::hstate_t>
132 AutomatonHistory<AutoType_>::get_state_event_about(event_kind_t e,
135 typename states_events_t::const_iterator se = states_events_.find(s);
136 if (se == states_events_.end())
138 for (
typename state_events_t::const_iterator ev = se->second.begin();
139 ev != se->second.end();
141 if (ev->get_event_kind() == e)
146 template <
class AutoType_>
148 AutomatonHistory<AutoType_>::set_transition_event_about(event_kind_t e,
149 htransition_t transition)
151 for (
typename transition_events_t::const_iterator ev
152 = transitions_events_[transition].begin();
153 ev != transitions_events_[transition].end();
155 if (ev->get_event_kind() == e)
157 transitions_events_[transition].push_front(Event<htransition_t>(e));
161 template <
class AutoType_>
163 AutomatonHistory<AutoType_>::set_transition_event_about(event_kind_t e,
164 htransition_t transition,
167 for (
typename transition_events_t::const_iterator ev
168 = transitions_events_[transition].begin();
169 ev != transitions_events_[transition].end();
171 if (ev->get_event_kind() == e)
173 transitions_events_[transition].push_front(UnaryEvent<htransition_t>(e, first));
177 template <
class AutoType_>
179 AutomatonHistory<AutoType_>::set_transition_event_about(event_kind_t e,
180 htransition_t transition,
182 htransition_t second)
184 for (
typename transition_events_t::const_iterator ev
185 = transitions_events_[transition].begin();
186 ev != transitions_events_[transition].end();
188 if (ev->get_event_kind() == e)
190 transitions_events_[transition].push_front
191 (BinaryEvent<htransition_t>(e, first, second));
195 template <
class AutoType_>
196 const Event<typename AutoType_::htransition_t>
197 AutomatonHistory<AutoType_>::get_transition_event_about(event_kind_t e,
198 htransition_t transition
201 typename transitions_events_t::const_iterator ee =
202 transitions_events_.find(transition);
203 if (ee == transitions_events_.end())
205 for (
typename transition_events_t::const_iterator ev = ee->second.begin();
206 ev != ee->second.end();
208 if (ev->get_event_kind() == e)
213 template <
class AutoType_>
215 AutomatonHistory<AutoType_>::set_auto_event_about(event_kind_t e)
217 for (
typename auto_events_t::const_iterator ev = auto_events_.begin();
218 ev != auto_events_.end();
220 if (ev->second->get_event_kind() == e)
222 auto_events_.push_front(Event<AutoType_>(e));
226 template <
class AutoType_>
228 AutomatonHistory<AutoType_>::set_auto_event_about(event_kind_t e,
231 for (
typename auto_events_t::const_iterator ev = auto_events_.begin();
232 ev != auto_events_.end();
234 if (ev->second->get_event_kind() == e)
236 auto_events_.push_front(Event<AutoType_>(e, first));
240 template <
class AutoType_>
242 AutomatonHistory<AutoType_>::set_auto_event_about(event_kind_t e,
246 for (
typename auto_events_t::const_iterator ev = auto_events_.begin();
247 ev != auto_events_.end();
249 if (ev->get_event_kind() == e)
251 auto_events_.push_front(BinaryEvent<AutoType_>(e, first, second));
255 template <
class AutoType_>
256 const Event<AutoType_>
257 AutomatonHistory<AutoType_>::get_auto_event_about(event_kind_t e)
const
259 for (
typename auto_events_t::const_iterator ev = auto_events_.begin();
260 ev != auto_events_.end();
262 if (ev->get_event_kind() == e)
269 operator<<(std::ostream& out, const Event<T>& e)
271 out << e.get_event_kind();
280 #endif // ! VCSN_AUTOMATA_CONCEPT_HISTORY_HXX