#ifndef COMH_HH #define COMH_HH /* comh.hh - Class ComC spéciale Hub */ /* Simulotron - Programme de simulation de robot {{{ * * Copyright (C) 2006 Nicolas Haller * * Robot APB Team/Efrei 2006. * 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. * * }}} */ #include "aiguillage/aiguillage.hh" #include "utils/non_copyable.hh" #include class SocketServer; class GSMessage; class ComH : public NonCopyable { private: /// Aiguillage SNCF Aiguillage aiguillage_; /// Nom du module distant std::string moduleName_; /// En attente d'un message bool waitingForMessage_; /// DL du wait long long int dlWaiting_; public: /// Constructeur serveur ComH (SocketServer & socket); /// Initialise la com avec le module void initCom(void); /// Récupère le nom du module const std::string & getModuleName(void); /// Reçoit un message du module bool receiveMsg(GSMessage & gsm, std::string & source, std::string & dest, int & msgId, bool bloquant); /// Envoie un message void send(const GSMessage & gsm, const std::string & source, const std::string & dest); /// Set un wait(si négatif, le wait est infini) void setWait(long long int DL, bool waitForMessage); /// Retourne si le module est en attente bool isWaiting (void); /// Retourne la fin de l'attente long long int getDLWait(void); /// Delock un module en fin d'attente void unlockWait (void); }; #endif //COMH_HH