summaryrefslogtreecommitdiff
path: root/i/simulotron/src/aiguillage/aiguillage.hh
blob: 8f7eaf15669c9542ede1276df11a3fb5c91e4292 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
#ifndef AIGUILLAGE_HH
#define AIGUILLAGE_HH
/* aiguillage.hh - Classe rajoutant les info de la source et de la dest d'un packet */
/* Simulotron - Programme de simulation de robot {{{
 *
 * Copyright (C) 2005 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 "gs/gs_transmitter.hh"
#include "utils/non_copyable.hh"

class Aiguillage : public NonCopyable
{
    private:
	static const unsigned int MAX_SIZE_NAME = 8;
    private:
	GSTransmitter gst_;
	std::string name_;
    public:
	/// Constructeur client
	Aiguillage(const std::string & address, int port, const std::string & name);
	/// Constructeur serveur
	Aiguillage(SocketServer & socket, const std::string & name);
	/// Envoie un paquet en rajoutant les infos de sources et de provenance
	void send(const GSMessage & gsm, const std::string & source, const std::string & dest);
	/// Re�oie un paquet du r�seau et supprime les infos src et dest du GSM
	bool receive(GSMessage & gsm, std::string & source, std::string & dest, bool bloquant);
    private:
	/// Set le nom de transmition
	void setName(const std::string & name);
};
#endif //AIGUILLAGE_HH