00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017 #ifndef VCSN_AUTOMATA_CONCEPT_HISTORY_HH
00018 # define VCSN_AUTOMATA_CONCEPT_HISTORY_HH
00019
00020 # include <list>
00021 # include <map>
00022 # include <string>
00023
00024 # include <vaucanson/automata/concept/handlers.hh>
00025
00026
00027 namespace vcsn {
00028
00029 namespace history {
00030
00031 typedef std::string event_kind_t;
00032
00033 template <class T>
00034 class Event
00035 {
00036 public:
00037 Event(event_kind_t e);
00038
00039 virtual
00040 event_kind_t
00041 get_event_kind() const;
00042
00043 virtual ~Event();
00044 protected :
00045 event_kind_t kind_;
00046 };
00047
00048 template <class T>
00049 class BinaryEvent : public Event<T>
00050 {
00051 public:
00052 BinaryEvent(event_kind_t e, const T& first, const T& second);
00053
00054 const T&
00055 get_first() const;
00056
00057 const T&
00058 get_second() const;
00059
00060 protected :
00061 T first_, second_;
00062 };
00063
00064 template <class T>
00065 class UnaryEvent : public Event<T>
00066 {
00067 public:
00068 UnaryEvent(event_kind_t e, const T& first);
00069
00070 const T&
00071 get_first() const;
00072
00073 protected :
00074 T first_;
00075 };
00076
00077 template <class T>
00078 std::ostream&
00079 operator<<(std::ostream& out, const Event<T>& e);
00080
00081 template <class AutoType_>
00082 class AutomatonHistory
00083 {
00084 public :
00085 typedef typename AutoType_::hstate_t hstate_t;
00086 typedef typename AutoType_::htransition_t htransition_t;
00087 typedef std::list<Event<AutoType_> > auto_events_t;
00088 typedef std::list<Event<hstate_t> > state_events_t;
00089 typedef std::list<Event<htransition_t> > transition_events_t;
00090 typedef std::map<hstate_t, state_events_t> states_events_t;
00091 typedef std::map<htransition_t, transition_events_t> transitions_events_t;
00092
00093 bool
00094 set_state_event_about(event_kind_t, hstate_t);
00095 bool
00096 set_state_event_about(event_kind_t, hstate_t, hstate_t);
00097 bool
00098 set_state_event_about(event_kind_t, hstate_t, hstate_t, hstate_t);
00099 const Event<hstate_t>
00100 get_state_event_about(event_kind_t, hstate_t) const;
00101
00102 bool
00103 set_transition_event_about(event_kind_t, htransition_t);
00104 bool
00105 set_transition_event_about(event_kind_t, htransition_t, htransition_t);
00106 bool
00107 set_transition_event_about(event_kind_t, htransition_t, htransition_t,
00108 htransition_t);
00109 const Event<htransition_t>
00110 get_transition_event_about(event_kind_t, htransition_t) const;
00111
00112 bool
00113 set_auto_event_about(event_kind_t);
00114 bool
00115 set_auto_event_about(event_kind_t, AutoType_);
00116 bool
00117 set_auto_event_about(event_kind_t, AutoType_, AutoType_);
00118 const Event<AutoType_>
00119 get_auto_event_about(event_kind_t) const;
00120
00121 protected :
00122 states_events_t states_events_;
00123 transitions_events_t transitions_events_;
00124 auto_events_t auto_events_;
00125 };
00126
00127 }
00128
00129 }
00130
00131
00132 # if !defined VCSN_USE_INTERFACE_ONLY || defined VCSN_USE_LIB
00133 # include <vaucanson/automata/concept/history.hxx>
00134 #endif // VCSN_USE_INTERFACE_ONLY
00135
00136
00137 #endif // ! VCSN_AUTOMATA_CONCEPT_HISTORY_HH