1 /********************************************************************************
2  *                              Nepenthes
3  *                        - finest collection -
4  *
5  *
6  *
7  * Copyright (C) 2005  Paul Baecher & Markus Koetter
8  *
9  * This program is free software; you can redistribute it and/or
10  * modify it under the terms of the GNU General Public License
11  * as published by the Free Software Foundation; either version 2
12  * of the License, or (at your option) any later version.
13  *
14  * This program is distributed in the hope that it will be useful,
15  * but WITHOUT ANY WARRANTY; without even the implied warranty of
16  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
17  * GNU General Public License for more details.
18  *
19  * You should have received a copy of the GNU General Public License
20  * along with this program; if not, write to the Free Software
21  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
22  *
23  *
24  *             contact nepenthesdev@users.sourceforge.net
25  *
26  *******************************************************************************/
27 
28 /* $Id: DialogueFactory.hpp 2043 2005-10-04 15:59:52Z common $ */
29 #ifndef HAVE_DIALOGUEFACTORY_HPP
30 #define HAVE_DIALOGUEFACTORY_HPP
31 
32 #include <string>
33 
34 using namespace std;
35 
36 namespace nepenthes
37 {
38 	class Socket;
39 	class Dialogue;
40 
41 	/**
42 	 * whenever we bind a Socket, we have to assign a DialogueFactory.
43 	 * the dialogueFactory will create Dialogues for accepted() connections
44 	 * and assign this fresh Dialogue to the new Socket
45 	 */
46 	class DialogueFactory
47     {
48     public:
~DialogueFactory()49         virtual ~DialogueFactory(){};
50         virtual Dialogue * createDialogue(Socket *socket) = 0;
51 
getFactoryName()52         string getFactoryName()
53 		{
54 			return m_DialogueFactoryName;
55 		}
getFactoryDescription()56         string getFactoryDescription()
57 		{
58 			return m_DialogueFactoryDescription;
59 		}
60 
socketClosed(Socket * socket)61 		virtual void socketClosed(Socket *socket)
62 		{
63 			return;
64 		}
65 
66     protected:
67         string m_DialogueFactoryName;
68         string m_DialogueFactoryDescription;
69 
70         Socket *m_Socket;
71     };
72 }
73 
74 #endif
75