From c4aa2c083c7cb7ed9bafc49b5538c502c834fca1 Mon Sep 17 00:00:00 2001 From: galmes Date: Thu, 15 Jan 2004 19:10:43 +0000 Subject: test de la classe message --- i/siroco/src/pg_test/message.h | 69 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 69 insertions(+) create mode 100644 i/siroco/src/pg_test/message.h (limited to 'i/siroco/src/pg_test/message.h') diff --git a/i/siroco/src/pg_test/message.h b/i/siroco/src/pg_test/message.h new file mode 100644 index 0000000..0c6943b --- /dev/null +++ b/i/siroco/src/pg_test/message.h @@ -0,0 +1,69 @@ +#ifndef message_h +#define message_h +// message.h +// {{{ +// +// Copyright (C) 2003 Nicolas Schodet et Pierre-André Galmes +// +// Robot APB Team/Efrei 2004. +// Web: http://assos.efrei.fr/robot/ +// Email: robot AT efrei DOT fr +// +// This program is free software; you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation; either version 2 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +// +// }}} + +namespace Siroco +{ + +class Message +{ + // Type du message contenu. + enum Type + { + typeAsservissementData, + typeAsservissementControl, + typeAsservissementGetInfo, + typeAsservissementInfo, + typeMax + }; + private: + Type type_; + public: + // Constructeur. + Message (Type type); + // Destructeur et Big 3. + virtual ~Message (void); + // Récupère le type du message. + Type getType (void) const; + // Récupère le message. + template + const T &get (void) const; + private: + // Méthodes interdites. + Message (const Message &); + Message &operator= (const Message &); +}; + +// Récupère le message. +template +const T &Message::get (void) const +{ + return dynamic_cast (*this); +} + +} // namespace Siroco + +#endif // message_h -- cgit v1.2.3