history.hh

00001 // history.hh: this file is part of the Vaucanson project.
00002 //
00003 // Vaucanson, a generic library for finite state machines.
00004 //
00005 // Copyright (C) 2001, 2002, 2003, 2004 The Vaucanson Group.
00006 //
00007 // This program is free software; you can redistribute it and/or
00008 // modify it under the terms of the GNU General Public License
00009 // as published by the Free Software Foundation; either version 2
00010 // of the License, or (at your option) any later version.
00011 //
00012 // The complete GNU General Public Licence Notice can be found as the
00013 // `COPYING' file in the root directory.
00014 //
00015 // The Vaucanson Group consists of people listed in the `AUTHORS' file.
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 // # include <vaucanson/misc/ref.hh>
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 std::list<Event<AutoType_> >                 auto_events_t;
00086         typedef std::list<Event<hstate_t> >                  state_events_t;
00087         typedef std::list<Event<htransition_t> >             transition_events_t;
00088         typedef std::map<hstate_t, state_events_t>           states_events_t;
00089         typedef std::map<htransition_t, transition_events_t> transitions_events_t;
00090 
00091         bool
00092         set_state_event_about(event_kind_t, hstate_t);
00093         bool
00094         set_state_event_about(event_kind_t, hstate_t, hstate_t);
00095         bool
00096         set_state_event_about(event_kind_t, hstate_t, hstate_t, hstate_t);
00097         const Event<hstate_t>
00098         get_state_event_about(event_kind_t, hstate_t) const;
00099 
00100         bool
00101         set_transition_event_about(event_kind_t, htransition_t);
00102         bool
00103         set_transition_event_about(event_kind_t, htransition_t, htransition_t);
00104         bool
00105         set_transition_event_about(event_kind_t, htransition_t, htransition_t,
00106                                    htransition_t);
00107         const Event<htransition_t>
00108         get_transition_event_about(event_kind_t, htransition_t) const;
00109 
00110         bool
00111         set_auto_event_about(event_kind_t);
00112         bool
00113         set_auto_event_about(event_kind_t, AutoType_);
00114         bool
00115         set_auto_event_about(event_kind_t, AutoType_, AutoType_);
00116         const Event<AutoType_>
00117         get_auto_event_about(event_kind_t) const;
00118 
00119       protected :
00120         states_events_t         states_events_;
00121         transitions_events_t            transitions_events_;
00122         auto_events_t                   auto_events_;
00123     };
00124 
00125   } // history
00126 
00127 } // vcsn
00128 
00129 
00130 #ifndef VCSN_USE_INTERFACE_ONLY
00131 # include <vaucanson/automata/concept/history.hxx>
00132 #endif // VCSN_USE_INTERFACE_ONLY
00133 
00134 
00135 #endif // ! VCSN_AUTOMATA_CONCEPT_HISTORY_HH

Generated on Sat Jul 29 17:13:00 2006 for Vaucanson by  doxygen 1.4.6