fork download
  1. template<class M>
  2. struct Message_ : Message
  3. {
  4. Message_(void)
  5. {
  6. }
  7. static bool checkType(Message* message)
  8. {
  9. return Message_<M>::getID_static() == message->getID() ? true : false;
  10. }
  11. static M* convert(Message* message)
  12. {
  13. if (Message_<M>::getID_static() == message->getID())
  14. return (M*)message;
  15. return NULL;
  16. }
  17. virtual const int getID(void) const
  18. {
  19. return Message_<M>::getID_static();
  20. }
  21. static int getID_static(void)
  22. {
  23. if (Message_<M>::TypeIDRef_Custom == -1)
  24. return (int)&Message_<M>::TypeIDRef;
  25. return Message_<M>::TypeIDRef_Custom;
  26. }
  27. static void setID_static(int id)
  28. {
  29. Message_<M>::TypeIDRef_Custom = id;
  30. }
  31. private:
  32. static const int TypeIDRef;
  33. static int TypeIDRef_Custom;
  34. };
Not running #stdin #stdout 0s 0KB
stdin
Standard input is empty
stdout
Standard output is empty