00001 
00002 
00003 
00004 
00005 
00006 
00007 
00008 
00009 
00010 
00011 
00012 
00013 
00014 
00015 
00016 
00017 
00018 #ifndef VCSN_AUTOMATA_IMPLEMENTATION_BMIG_GRAPHCONTAINER_HH_
00019 # define VCSN_AUTOMATA_IMPLEMENTATION_BMIG_GRAPHCONTAINER_HH_
00020 
00021 # include <vaucanson/misc/hash.hh>
00022 # include <vaucanson/automata/implementation/bmig/edge_value.hh>
00023 # include <boost/multi_index_container.hpp>
00024 # include <boost/multi_index/member.hpp>
00025 # include <boost/multi_index/ordered_index.hpp>
00026 # include <boost/multi_index/hashed_index.hpp>
00027 # include <boost/functional/hash/hash.hpp>
00028 # include <boost/multi_index/sequenced_index.hpp>
00029 # include <boost/tuple/tuple.hpp>
00030 # include <boost/multi_index/composite_key.hpp>
00031 
00032 namespace vcsn
00033 {
00034   namespace bmig
00035   {
00036     using ::boost::multi_index_container;
00037     using ::boost::multi_index::hashed_non_unique;
00038     using ::boost::multi_index::indexed_by;
00039     using ::boost::multi_index::composite_key;
00040     using ::boost::multi_index::hashed_non_unique;
00041     using ::boost::multi_index::tag;
00042     using ::boost::multi_index::member;
00043     using ::boost::multi_index::index_iterator;
00044     using ::boost::multi_index::get;
00045     using ::boost::multi_index::project;
00046     using ::boost::multi_index::composite_key_hash;
00047 
00048     
00049 
00050 
00051 
00052     
00053     struct succ {};
00054     struct pred {};
00055     struct src {};
00056     struct dst {};
00057 
00058     
00059     template<typename State, typename HLabel, typename EdgeValue>
00060     struct SuccessorKey : composite_key <
00061       EdgeValue,
00062       BOOST_MULTI_INDEX_MEMBER(EdgeValue, State, from_),
00063       BOOST_MULTI_INDEX_MEMBER(EdgeValue, HLabel, label_)
00064     > {};
00065 
00066     
00067     template<typename State, typename HLabel, typename EdgeValue>
00068     struct PredecessorKey : composite_key <
00069       EdgeValue,
00070       BOOST_MULTI_INDEX_MEMBER(EdgeValue, State, to_),
00071       BOOST_MULTI_INDEX_MEMBER(EdgeValue, HLabel, label_)
00072     > {};
00073 
00074     
00075     template<typename State, typename HLabel, typename EdgeValue>
00076     struct SourceAndLabel : public hashed_non_unique <
00077       tag<succ>,
00078       SuccessorKey<State, HLabel, EdgeValue>,
00079       composite_key_hash<
00080         vcsn::misc::hash_state_handler,
00081         vcsn::misc::hash_label<HLabel>
00082         
00083       >
00084     > {};
00085 
00086     template<typename State, typename HLabel, typename EdgeValue>
00087     struct DestinationAndLabel : public hashed_non_unique <
00088       tag<pred>,
00089       PredecessorKey<State, HLabel, EdgeValue>,
00090       composite_key_hash<
00091         vcsn::misc::hash_state_handler,
00092         vcsn::misc::hash_label<HLabel>
00093         
00094       >
00095     > {};
00096 
00097 
00098     
00099     template<typename State, typename EdgeValue>
00100     struct Source : public hashed_non_unique <
00101       tag<src>,
00102       BOOST_MULTI_INDEX_MEMBER(EdgeValue, State, from_),
00103       vcsn::misc::hash_state_handler
00104     > {};
00105 
00106 
00107     
00108     template<typename State, typename EdgeValue>
00109     struct Destination : public hashed_non_unique <
00110       tag<dst>,
00111       BOOST_MULTI_INDEX_MEMBER(EdgeValue, State, to_),
00112       vcsn::misc::hash_state_handler
00113     > {};
00114 
00115 
00129     template<typename State, typename HLabel, typename EdgeValue>
00130     struct GraphContainer
00131       : public multi_index_container
00132     <
00133       EdgeValue,
00134       indexed_by
00135       <
00136         SourceAndLabel<State, HLabel, EdgeValue>,
00137         DestinationAndLabel<State, HLabel, EdgeValue>,
00138         Source<State, EdgeValue>,
00139         Destination<State, EdgeValue>
00140       >
00141     > {};
00142 
00143   } 
00144 } 
00145 
00146 #endif // ! VCSN_AUTOMATA_IMPLEMENTATION_BMIG_GRAPHCONTAINER_HH_
00147