Vaucanson 1.4
handlers.hh
00001 // handlers.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, 2005, 2006 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_HANDLERS_HH
00018 # define VCSN_AUTOMATA_CONCEPT_HANDLERS_HH
00019 
00020 # include <iostream>
00021 # include <vaucanson/design_pattern/predecls.hh>
00022 
00023 namespace vcsn {
00024 
00025   struct state_h
00026   {};
00027 
00028   struct transition_h
00029   {};
00030 
00031   template<typename Tag, typename Type>
00032   class handler
00033   {
00034     public:
00035       typedef Tag kind;
00036       typedef handler<Tag, Type> self_t;
00037 
00038       handler();
00039 
00040       explicit handler(const Type& h);
00041 
00042       handler(const self_t& h);
00043 
00044       self_t& operator=(const self_t& h);
00045 
00046       Type value() const;
00047 
00048       operator unsigned() const;
00049 
00050       bool is_valid() const;
00051 
00052     protected:
00053       Type v_;
00054   };
00055 
00056 
00057   template<typename Tag, typename Type>
00058   bool operator==(const handler<Tag, Type>& h1,
00059                   const handler<Tag, Type>& h2);
00060 
00061   template<typename Tag, typename Type>
00062   bool operator!=(const handler<Tag, Type>& h1,
00063                   const handler<Tag, Type>& h2);
00064 
00065   template<typename Tag, typename Type>
00066   bool operator<(const handler<Tag, Type>& h1,
00067                  const handler<Tag, Type>& h2);
00068 
00069   template<typename Tag, typename Type>
00070   bool operator>(const handler<Tag, Type>& h1,
00071                  const handler<Tag, Type>& h2);
00072 
00073   template<typename Tag, typename Type>
00074   bool operator<=(const handler<Tag, Type>& h1,
00075                   const handler<Tag, Type>& h2);
00076 
00077   template<typename Tag, typename Type>
00078   bool operator>=(const handler<Tag, Type>& h1,
00079                   const handler<Tag, Type>& h2);
00080 
00081 } // vcsn
00082 
00083 namespace std {
00084 
00085   template <typename Tag, typename Type>
00086   std::ostream&
00087   operator<<(std::ostream& out, const vcsn::handler<Tag, Type>& h);
00088 
00089 } // std
00090 
00091 
00092 # if !defined VCSN_USE_INTERFACE_ONLY || defined VCSN_USE_LIB
00093 # include <vaucanson/automata/concept/handlers.hxx>
00094 #endif // VCSN_USE_INTERFACE_ONLY
00095 
00096 
00097 #endif // ! VCSN_AUTOMATA_CONCEPT_HANDLERS_HH