/*! * @file network_manager.h * Main interface for the network module. Manages all the modules */ /* you will want to add such a a line at your header file also, since it will prevent c++ from including your code twice*/ #ifndef _NETWORK_MANAGER #define _NETWORK_MANAGER /* include this file, it contains some default definitions */ #include "netdefs.h" #include "shared_network_data.h" /* include base_object.h since all classes are derived from this one */ #include "base_object.h" class NetworkStream; class Synchronizeable; /* and here is the class itsself*/ class NetworkManager : public BaseObject { ObjectListDeclaration(NetworkManager); public: inline static NetworkManager* getInstance() { if (!NetworkManager::singletonRef) NetworkManager::singletonRef = new NetworkManager(); return NetworkManager::singletonRef; } virtual ~NetworkManager(); void initialize(); void shutdown(); int createClient( const std::string & name, unsigned int port); int createMasterServer( unsigned int port); int createProxyServer( unsigned int port); void reconnectToServer(IP address); void connectSynchronizeable(Synchronizeable& sync); void synchronize(float dtS); void debug(); void setRedirectionTest(); private: NetworkManager(); private: static NetworkManager* singletonRef; //!< Pointer to the only instance of this Class NetworkStream* networkStream; //!< pointer to network stream float elapsedTime; //!< elapsed time since the last network update }; #endif /* _NETWORK_MANAGER */