Vault
4.1
|
00001 /* 00002 Copyright c1997-2014 Trygve Isaacson. All rights reserved. 00003 This file is part of the Code Vault version 4.1 00004 http://www.bombaydigital.com/ 00005 License: MIT. See LICENSE.md in the Vault top level directory. 00006 */ 00007 00008 #ifndef vsocketthread_h 00009 #define vsocketthread_h 00010 00013 #include "vthread.h" 00014 00015 class VSocket; 00016 class VListenerThread; 00017 00034 class VSocketThread : public VThread { 00035 public: 00036 00054 VSocketThread(const VString& threadBaseName, VSocket* socket, VListenerThread* ownerThread); 00058 virtual ~VSocketThread(); 00059 00064 VSocket* getSocket() const; 00069 VListenerThread* getOwnerThread() const; 00070 00074 void closeAndStop(); 00075 00076 protected: 00077 00078 VSocket* mSocket; 00079 VListenerThread* mOwnerThread; 00080 00081 private: 00082 00083 // Prevent copy construction and assignment since there is no provision for sharing the underlying thread. 00084 VSocketThread(const VSocketThread& other); 00085 VSocketThread& operator=(const VSocketThread& other); 00086 00087 friend class VListenerThread; // allow it to remove itself as our owner thread when it destructs 00088 }; 00089 00093 typedef std::vector<VSocketThread*> VSocketThreadPtrVector; 00094 00095 #endif /* vsocketthread_h */