Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: orxonox.OLD/branches/network/src/lib/network/network_manager.h @ 5968

Last change on this file since 5968 was 5968, checked in by patrick, 18 years ago

network: merged the trunk into the network with the command svn merge -r5824:HEAD ../trunk network, changes changed… bla bla..

File size: 1.9 KB
Line 
1/*!
2 * @file network_manager.h
3  *  Main interface for the network module. Manages all the modules
4*/
5
6/* you will want to add such a a line at your header file also, since it will
7   prevent c++ from including your code twice*/
8#ifndef _NETWORK_MANGER
9#define _NETWORK_MANAGER
10
11/* include this file, it contains some default definitions */
12#include "netdefs.h"
13
14/* include base_object.h since all classes are derived from this one */
15#include "base_object.h"
16
17
18/* forward declarations for the header file (include the header via #include "bla.h" in the source file) */
19class NetworkStream;
20class Synchronizeable;
21template<typename>
22class tList;
23
24/* and here is the class itsself*/
25class NetworkManager : public BaseObject
26{
27
28  public:
29
30    inline static NetworkManager* getInstance() { if (!NetworkManager::singletonRef) NetworkManager::singletonRef = new NetworkManager();
31      return NetworkManager::singletonRef; }
32    ~NetworkManager();
33
34    void initialize();
35    void shutdown();
36
37    int establishConnection(const char* name, unsigned int port);
38    int createServer(unsigned int port);
39
40    NetworkStream& establishConnection(IPaddress& address, Synchronizeable& sync);
41    NetworkStream& createServer(Synchronizeable& sync, unsigned int port);
42    void shutdownConnection();
43
44
45    void connectSynchronizeable(Synchronizeable& sync);
46    void synchronize();
47   
48
49  private:
50    NetworkManager();
51
52
53  private:
54    const std::list<BaseObject*>*    netStreamList;            // list with refs to all network streams
55    const std::list<BaseObject*>*    syncList;                 // list of synchronizeables
56    static NetworkManager* singletonRef;           //!< Pointer to the only instance of this Class
57    NetworkStream*         tmpStream;              //!< FIXME: this is only for testing purposes
58
59};
60
61
62
63#endif /* _NETWORK_MANAGER */
Note: See TracBrowser for help on using the repository browser.