00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00026 #ifndef HH_SENF_Packets_80221Bundle_MIHMessageRegistry_
00027 #define HH_SENF_Packets_80221Bundle_MIHMessageRegistry_ 1
00028
00029
00030 #include <boost/ptr_container/ptr_map.hpp>
00031 #include <senf/Utils/singleton.hh>
00032 #include <senf/Packets/Packets.hh>
00033
00034 #include "MIHMessageRegistry.ih"
00035
00036 namespace senf {
00037
00038 class MIHMessageRegistry
00039 : public senf::singleton<MIHMessageRegistry>
00040 {
00041 public:
00042 typedef boost::uint16_t key_t;
00043
00044 using senf::singleton<MIHMessageRegistry>::instance;
00045 friend class senf::singleton<MIHMessageRegistry>;
00046
00047 template <typename MIHPacket>
00048 struct RegistrationProxy {
00049 RegistrationProxy();
00050 };
00051
00052 template <typename MIHPacket>
00053 void registerMessageType();
00054
00055 void validate(key_t messageId, senf::Packet message);
00056
00057 private:
00058 typedef boost::ptr_map<key_t, detail::MIHMessageRegistry_EntryBase > Map;
00059 Map map_;
00060
00061 MIHMessageRegistry() {};
00062 };
00063
00064
00065 # define SENF_MIH_PACKET_REGISTRY_REGISTER( packet ) \
00066 SENF_PACKET_REGISTRY_REGISTER( \
00067 senf::MIHMessageRegistry, packet::type::MESSAGE_ID, packet ) \
00068 namespace { \
00069 senf::MIHMessageRegistry::RegistrationProxy< packet > \
00070 BOOST_PP_CAT(mihPacketRegistration_, __LINE__); \
00071 }
00072
00073 }
00074
00075
00076 #include "MIHMessageRegistry.ct"
00077
00078 #endif
00079
00080
00081
00082
00083
00084
00085
00086
00087
00088
00089
00090