Scheduler< Impl, ImplPtr >::SSocketWrapper Class Reference

#include <scheduler.h>

List of all members.


Detailed Description

template<typename Impl, typename ImplPtr = Impl*>
class Scheduler< Impl, ImplPtr >::SSocketWrapper

Wrapper object for scheduled socket, contains all the useful information we need, e.g.

score, frontend event handler, and underlying socket object. Used by requests to keep track of which socket the request belongs to. This object can and should be held on stack, since all members of this object are either cheap to copy, or use reference-counting.

Definition at line 507 of file scheduler.h.


Public Member Functions

 SSocketWrapper (ImplPtr s, HandlerFunc h=0, ScoreFunc f=0)
 Construct new socket wrapper.
void notify (EventType evt) const
 Pass event to frontend.
 SSocketWrapper ()
 Forbidden.
Accessors
ImplPtr getSocket () const
float getScore () const
HandlerFunc getHandler () const
boost::signals::connection getConn () const
void setConn (boost::signals::connection c)

Public Attributes

ImplPtr m_socket
 Underlying socket.
HandlerFunc m_handler
 Frontend event handler.
boost::signals::connection m_conn
 Backend event connection.
ScoreFunc m_scoreFunc
 Function to retrieve the score.
boost::shared_ptr< std::string > m_outBuffer
 Outgoing data buffer.
boost::shared_ptr< std::string > m_inBuffer
 Incoming data buffer.
boost::shared_ptr< std::deque<
AcceptType * > > 
m_accepted
 Accepted connections.

Friends

bool operator< (const SSocketWrapper &x, const SSocketWrapper &y)

Constructor & Destructor Documentation

template<typename Impl, typename ImplPtr = Impl*>
Scheduler< Impl, ImplPtr >::SSocketWrapper::SSocketWrapper ImplPtr  s,
HandlerFunc  h = 0,
ScoreFunc  f = 0
[inline]
 

Construct new socket wrapper.

Parameters:
s Implementation-defined pointer to underlying socket
h Frontend event handler for notifications
f Score function object to retrieve this socket's priority score

Definition at line 518 of file scheduler.h.

References Scheduler< Impl, ImplPtr >::SSocketWrapper::m_accepted, Scheduler< Impl, ImplPtr >::SSocketWrapper::m_handler, Scheduler< Impl, ImplPtr >::SSocketWrapper::m_inBuffer, Scheduler< Impl, ImplPtr >::SSocketWrapper::m_outBuffer, Scheduler< Impl, ImplPtr >::SSocketWrapper::m_scoreFunc, and Scheduler< Impl, ImplPtr >::SSocketWrapper::m_socket.

template<typename Impl, typename ImplPtr = Impl*>
Scheduler< Impl, ImplPtr >::SSocketWrapper::SSocketWrapper  ) 
 

Forbidden.


Member Function Documentation

template<typename Impl, typename ImplPtr = Impl*>
boost::signals::connection Scheduler< Impl, ImplPtr >::SSocketWrapper::getConn  )  const [inline]
 

Definition at line 528 of file scheduler.h.

References Scheduler< Impl, ImplPtr >::SSocketWrapper::m_conn.

Referenced by Scheduler< Impl, ImplPtr >::delSocket().

template<typename Impl, typename ImplPtr = Impl*>
HandlerFunc Scheduler< Impl, ImplPtr >::SSocketWrapper::getHandler  )  const [inline]
 

Definition at line 527 of file scheduler.h.

References Scheduler< Impl, ImplPtr >::SSocketWrapper::m_handler.

template<typename Impl, typename ImplPtr = Impl*>
float Scheduler< Impl, ImplPtr >::SSocketWrapper::getScore  )  const [inline]
 

Definition at line 526 of file scheduler.h.

References Scheduler< Impl, ImplPtr >::SSocketWrapper::m_scoreFunc, and Scheduler< Impl, ImplPtr >::SSocketWrapper::m_socket.

template<typename Impl, typename ImplPtr = Impl*>
ImplPtr Scheduler< Impl, ImplPtr >::SSocketWrapper::getSocket  )  const [inline]
 

Definition at line 525 of file scheduler.h.

References Scheduler< Impl, ImplPtr >::SSocketWrapper::m_socket.

Referenced by Scheduler< Impl, ImplPtr >::delSocket(), Scheduler< Impl, ImplPtr >::ConnReq::doConn(), Scheduler< Impl, ImplPtr >::AcceptReq::doConn(), Scheduler< Impl, ImplPtr >::DownloadReq::doRecv(), Scheduler< Impl, ImplPtr >::UploadReq::doSend(), Scheduler< Impl, ImplPtr >::AcceptReq::~AcceptReq(), Scheduler< Impl, ImplPtr >::ConnReq::~ConnReq(), Scheduler< Impl, ImplPtr >::DownloadReq::~DownloadReq(), and Scheduler< Impl, ImplPtr >::UploadReq::~UploadReq().

template<typename Impl, typename ImplPtr = Impl*>
void Scheduler< Impl, ImplPtr >::SSocketWrapper::notify EventType  evt  )  const [inline]
 

Pass event to frontend.

Parameters:
evt Event to be sent
Note:
If no handler is set, this function does nothing

Definition at line 539 of file scheduler.h.

References Scheduler< Impl, ImplPtr >::SSocketWrapper::m_handler, and Scheduler< Impl, ImplPtr >::SSocketWrapper::m_socket.

Referenced by Scheduler< Impl, ImplPtr >::ConnReq::notify(), Scheduler< Impl, ImplPtr >::AcceptReq::notify(), Scheduler< Impl, ImplPtr >::DownloadReq::notify(), and Scheduler< Impl, ImplPtr >::UploadReq::notify().

template<typename Impl, typename ImplPtr = Impl*>
void Scheduler< Impl, ImplPtr >::SSocketWrapper::setConn boost::signals::connection  c  )  [inline]
 

Definition at line 529 of file scheduler.h.

References Scheduler< Impl, ImplPtr >::SSocketWrapper::m_conn.

Referenced by Scheduler< Impl, ImplPtr >::addSocket().


Friends And Related Function Documentation

template<typename Impl, typename ImplPtr = Impl*>
bool operator< const SSocketWrapper x,
const SSocketWrapper y
[friend]
 

Definition at line 545 of file scheduler.h.


Member Data Documentation

template<typename Impl, typename ImplPtr = Impl*>
boost::shared_ptr<std::deque<AcceptType*> > Scheduler< Impl, ImplPtr >::SSocketWrapper::m_accepted
 

Accepted connections.

Definition at line 565 of file scheduler.h.

Referenced by Scheduler< Impl, ImplPtr >::AcceptReq::doConn(), and Scheduler< Impl, ImplPtr >::SSocketWrapper::SSocketWrapper().

template<typename Impl, typename ImplPtr = Impl*>
boost::signals::connection Scheduler< Impl, ImplPtr >::SSocketWrapper::m_conn
 

Backend event connection.

Definition at line 557 of file scheduler.h.

Referenced by Scheduler< Impl, ImplPtr >::SSocketWrapper::getConn(), and Scheduler< Impl, ImplPtr >::SSocketWrapper::setConn().

template<typename Impl, typename ImplPtr = Impl*>
HandlerFunc Scheduler< Impl, ImplPtr >::SSocketWrapper::m_handler
 

Frontend event handler.

Definition at line 556 of file scheduler.h.

Referenced by Scheduler< Impl, ImplPtr >::SSocketWrapper::getHandler(), Scheduler< Impl, ImplPtr >::SSocketWrapper::notify(), and Scheduler< Impl, ImplPtr >::SSocketWrapper::SSocketWrapper().

template<typename Impl, typename ImplPtr = Impl*>
boost::shared_ptr<std::string> Scheduler< Impl, ImplPtr >::SSocketWrapper::m_inBuffer
 

Incoming data buffer.

Definition at line 563 of file scheduler.h.

Referenced by Scheduler< Impl, ImplPtr >::DownloadReq::doRecv(), and Scheduler< Impl, ImplPtr >::SSocketWrapper::SSocketWrapper().

template<typename Impl, typename ImplPtr = Impl*>
boost::shared_ptr<std::string> Scheduler< Impl, ImplPtr >::SSocketWrapper::m_outBuffer
 

Outgoing data buffer.

Definition at line 561 of file scheduler.h.

Referenced by Scheduler< Impl, ImplPtr >::UploadReq::doSend(), Scheduler< Impl, ImplPtr >::UploadReq::getPending(), and Scheduler< Impl, ImplPtr >::SSocketWrapper::SSocketWrapper().

template<typename Impl, typename ImplPtr = Impl*>
ScoreFunc Scheduler< Impl, ImplPtr >::SSocketWrapper::m_scoreFunc
 

Function to retrieve the score.

Definition at line 558 of file scheduler.h.

Referenced by Scheduler< Impl, ImplPtr >::SSocketWrapper::getScore(), and Scheduler< Impl, ImplPtr >::SSocketWrapper::SSocketWrapper().

template<typename Impl, typename ImplPtr = Impl*>
ImplPtr Scheduler< Impl, ImplPtr >::SSocketWrapper::m_socket
 

Underlying socket.

Definition at line 555 of file scheduler.h.

Referenced by Scheduler< Impl, ImplPtr >::SSocketWrapper::getScore(), Scheduler< Impl, ImplPtr >::SSocketWrapper::getSocket(), Scheduler< Impl, ImplPtr >::SSocketWrapper::notify(), and Scheduler< Impl, ImplPtr >::SSocketWrapper::SSocketWrapper().


The documentation for this class was generated from the following file: