Panda3D

baseincomingset.h

00001 #ifndef __BASEINCOMINGSET_H__
00002 #define __BASEINCOMINGSET_H__
00003 
00004 #include <list>
00005 #include "socket_base.h"
00006 
00007 enum CloseState 
00008 {
00009     ConnectionDoNotClose,
00010     ConnectionDoClose
00011 };
00012 // RHH
00013 ////////////////////////////////////////////////////////////////////
00014 //   Template :BaseIncomingSet
00015 //
00016 // Description :  A base structre for a listening socket and a
00017 //        set of connection that have been received with there read functions..
00018 //
00019 //  Think of this like a web server with 1 listening socket and 0-n open reacting conections..
00020 //
00021 //  The general operation if get connection..
00022 //      do you have a message
00023 //      process message 
00024 //      go back to do you have a message or close connection
00025 //
00026 //
00027 ////////////////////////////////////////////////////////////////////
00028 template < class _INCLASS1,class _IN_LISTEN, class MESSAGE_READER_BUF, class MESSAGE_READER_UPPASS> class BaseIncomingSet : public  std::list<_INCLASS1 *>
00029 {
00030         typedef std::list<_INCLASS1 *> BaseClass;
00031         typedef TYPENAME BaseClass::iterator iterator;
00032   _IN_LISTEN          _Listener;
00033 
00034   inline void AddFromListener(void);
00035   inline int PumpReader(Time_Clock  &currentTime);
00036   inline void AddAConection(_INCLASS1 * newt);
00037 
00038 public:
00039 
00040 //  typedef typename BaseIncomingSet<_INCLASS1, _IN_LISTEN, MESSAGE_READER_BUF, MESSAGE_READER_UPPASS>::LinkNode LinkNode;
00041 
00042 //  typedef SentDblLinkListNode_Gm   SentDblLinkListNode_Gm; 
00043   inline BaseIncomingSet(void);
00044   inline BaseIncomingSet(BaseIncomingSet &in);
00045   virtual ~BaseIncomingSet();
00046 
00047   inline _IN_LISTEN & GetListener(void);
00048   inline bool init(Socket_Address &WhereFrom);
00049   inline void PumpAll(Time_Clock  &currentTime);
00050   virtual CloseState ProcessNewConnection(SOCKET  socket);
00051   inline  void AddToFDSet(Socket_fdset &set);
00052 
00053     
00054 
00055 
00056 
00057 //  inline  LinkNode *          GetRoot(void) {  return &this->sentenal; };
00058   BaseIncomingSet &operator=( BaseIncomingSet &inval);
00059     void Reset();
00060 };
00061 
00062 #include "baseincomingset.i"
00063 
00064 #endif //__BASEINCOMINGSET_H__
00065 
00066 
00067 
 All Classes Functions Variables Enumerations