- Main Page
- Related Pages
- Modules
- Namespaces
- Classes
- Files

- File List
- File Members

# bmig_handlers_op.hxx

    00001 // bmig_handlers_op.hxx: this file is part of the Vaucanson project.
    00002 //
    00003 // Vaucanson, a generic library for finite state machines.
    00004 //
    00005 // Copyright (C) 2007, 2008, 2009 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_IMPLEMENTATION_BMIG_BMIG_HANDLERS_OP_HXX
    00018 # define VCSN_AUTOMATA_IMPLEMENTATION_BMIG_BMIG_HANDLERS_OP_HXX
    00019
    00020 # include <vaucanson/misc/contract.hh>
    00021 # include <vaucanson/automata/concept/handlers.hh>
    00022
    00023
    00024 //Operator for htransition_t storing iterators
    00025 #define HOPERATOR(Op)                                   \
    00026 template<typename T, typename U>                        \
    00027 bool operator Op (const handler<transition_h, boost::multi_index::detail::hashed_index_iterator<T, U> >& h1,\
    00028                   const handler<transition_h, boost::multi_index::detail::hashed_index_iterator<T, U> >& h2)\
    00029 {                                                       \
    00030   if (h1.value()->from_ == h2.value()->from_)           \
    00031     if (h1.value()->to_ == h2.value()->to_)             \
    00032       return h1.value()->label_ Op h2.value()->label_;  \
    00033     else                                                \
    00034       return h1.value()->to_ Op h2.value()->to_;        \
    00035   else                                                  \
    00036     return h1.value()->from_ Op h2.value()->from_;      \
    00037 }
    00038
    00039 namespace vcsn
    00040 {
    00041   HOPERATOR(<);
    00042   HOPERATOR(>);
    00043   HOPERATOR(<=);
    00044   HOPERATOR(>=);
    00045 }
    00046 #undef HOPERATOR
    00047
    00048 #define HOPERATOR(Op)                                   \
    00049 template<typename T, typename U>                        \
    00050 bool operator Op (const handler<transition_h,           \
    00051                                 boost::multi_index::detail::hashed_index_iterator<T, U> >& h1,\
    00052                   const handler<transition_h,           \
    00053                                 boost::multi_index::detail::hashed_index_iterator<T, U> >& h2)\
    00054 {                                                       \
    00055   return h1.value() Op h2.value();                      \
    00056 }
    00057 namespace vcsn
    00058 {
    00059   HOPERATOR(==);
    00060   HOPERATOR(!=);
    00061 }
    00062 #undef HOPERATOR
    00063
    00064
    00065
    00066
    00067 #define HOPERATOR(Op)                                                           \
    00068 inline                                                                          \
    00069 bool operator Op (const handler<state_h, boost::shared_ptr<std::size_t> >& h1,  \
    00070                   const handler<state_h, boost::shared_ptr<std::size_t> >& h2)  \
    00071 {                                                                               \
    00072   return h1.value() Op h2.value();                                              \
    00073 }
    00074
    00075 namespace vcsn
    00076 {
    00077   HOPERATOR(==);
    00078   HOPERATOR(!=);
    00079   HOPERATOR(<);
    00080
    00081   inline
    00082   bool operator> (const handler<state_h, boost::shared_ptr<std::size_t> >& h1,
    00083                   const handler<state_h, boost::shared_ptr<std::size_t> >& h2)
    00084   {
    00085     return h2 > h1;
    00086   }
    00087
    00088   inline
    00089   bool operator<= (const handler<state_h, boost::shared_ptr<std::size_t> >& h1,
    00090                    const handler<state_h, boost::shared_ptr<std::size_t> >& h2)
    00091   {
    00092     return h1 < h2 || h1 == h2;
    00093   }
    00094
    00095   inline
    00096   bool operator>= (const handler<state_h, boost::shared_ptr<std::size_t> >& h1,
    00097                    const handler<state_h, boost::shared_ptr<std::size_t> >& h2)
    00098   {
    00099     return !(h1 < h2);
    00100   }
    00101 }
    00102 #undef HOPERATOR
    00103
    00104 #endif // ! VCSN_AUTOMATA_IMPLEMENTATION_BMIG_BMIG_HANDLERS_OP_HXX
    00105