reSIProcate/stack  9694
Public Member Functions | Protected Attributes
SipStackAndThread Class Reference
Collaboration diagram for SipStackAndThread:
Collaboration graph
[legend]

List of all members.

Public Member Functions

 SipStackAndThread (const char *tType, AsyncProcessHandler *notifyDn=0, AsyncProcessHandler *notifyUp=0)
 ~SipStackAndThread ()
SipStackgetStack () const
SipStackoperator* () const
SipStackoperator-> () const
void setCongestionManager (CongestionManager *cm)
void run ()
void shutdown ()
void join ()
void destroy ()
SipStackAndThreadoperator= (SipStackAndThread &)

Protected Attributes

SipStackmStack
ThreadIfmThread
SelectInterruptormSelIntr
FdPollGrpmPollGrp
EventThreadInterruptormEventIntr
bool mMultiThreadedStack

Detailed Description

Definition at line 153 of file testStack.cxx.


Constructor & Destructor Documentation

SipStackAndThread::SipStackAndThread ( const char *  tType,
AsyncProcessHandler notifyDn = 0,
AsyncProcessHandler notifyUp = 0 
)

Definition at line 205 of file testStack.cxx.

References CritLog, resip::SipStackOptions::mAsyncProcessHandler, mEventIntr, mMultiThreadedStack, resip::SipStackOptions::mPollGrp, mPollGrp, mSelIntr, mStack, mThread, and resip::SipStack::setFallbackPostNotify().

  : mStack(0), 
      mThread(0), 
      mSelIntr(0), 
      mPollGrp(0), 
      mEventIntr(0), 
      mMultiThreadedStack(false)
{
   bool doStd = false;

   assert( tType );

   if (strcmp(tType,"intr")==0) 
   {
      mSelIntr = new SelectInterruptor();
   }
   else if ( strcmp(tType,"event")==0
          || strcmp(tType,"epoll")==0
          || strcmp(tType,"fdset")==0 )
   {
      mPollGrp = FdPollGrp::create(tType);
      mEventIntr = new EventThreadInterruptor(*mPollGrp);
   }
   else if ( strcmp(tType,"std")==0 ) 
   {
      doStd = true;
   } 
   else if ( strcmp(tType,"none")==0 ) 
   {
   }
   else if ( strcmp(tType,"multithreadedstack")==0 )
   {
      mMultiThreadedStack=true;
      mPollGrp = FdPollGrp::create("event");
      mEventIntr = new EventThreadInterruptor(*mPollGrp);
   }
   else 
   {
      CritLog(<<"Bad thread-type: "<<tType);
      exit(1);
   }
   SipStackOptions options;
   options.mAsyncProcessHandler = mEventIntr?mEventIntr
      :(mSelIntr?mSelIntr:notifyDn);
   options.mPollGrp = mPollGrp;
   mStack = new SipStack(options);
   
   mStack->setFallbackPostNotify(notifyUp);
   if (mEventIntr) 
   {
      mThread = new EventStackThread(*mStack, *mEventIntr, *mPollGrp);
   } 
   else 
   if (mSelIntr) 
   {
      mThread = new InterruptableStackThread(*mStack, *mSelIntr);
   } 
   else if (doStd) 
   {
      mThread = new StackThread(*mStack);
   }
}

Here is the call graph for this function:

SipStackAndThread::~SipStackAndThread ( ) [inline]

Definition at line 159 of file testStack.cxx.

                              {
         destroy();
      }

Member Function Documentation

void SipStackAndThread::destroy ( )

Definition at line 270 of file testStack.cxx.

References mEventIntr, mPollGrp, mSelIntr, mStack, and mThread.

Referenced by main().

{
   if ( mThread )
   {
      delete mThread;
      mThread = 0;
   }
   if ( mStack )
   {
      delete mStack;
      mStack = 0;
   }
   if ( mSelIntr )
   {
      delete mSelIntr;
      mSelIntr = 0;
   }
   if ( mEventIntr )
   {
      delete mEventIntr;
      mEventIntr = 0;
   }
   if ( mPollGrp )
   {
      delete mPollGrp;
      mPollGrp = 0;
   }
}
SipStack& SipStackAndThread::getStack ( ) const [inline]

Definition at line 163 of file testStack.cxx.

Referenced by main(), and StackThreadPair::wait().

{ assert(mStack); return *mStack; }
void SipStackAndThread::join ( ) [inline]

Definition at line 183 of file testStack.cxx.

Referenced by main().

SipStack& SipStackAndThread::operator* ( ) const [inline]

Definition at line 166 of file testStack.cxx.

{ assert(mStack); return *mStack; }
SipStack* SipStackAndThread::operator-> ( ) const [inline]

Definition at line 167 of file testStack.cxx.

{ return mStack; }
SipStackAndThread& SipStackAndThread::operator= ( SipStackAndThread )
void SipStackAndThread::run ( ) [inline]

Definition at line 174 of file testStack.cxx.

Referenced by main().

      {
         if ( mThread ) mThread->run();
         if ( mMultiThreadedStack ) mStack->run();
      }
void SipStackAndThread::setCongestionManager ( CongestionManager cm) [inline]

Definition at line 169 of file testStack.cxx.

References resip::SipStack::setCongestionManager().

Referenced by main().

Here is the call graph for this function:

void SipStackAndThread::shutdown ( ) [inline]

Definition at line 179 of file testStack.cxx.

Referenced by main().

      {
         if ( mThread ) mThread->shutdown();
      }

Member Data Documentation

Definition at line 200 of file testStack.cxx.

Referenced by destroy(), and SipStackAndThread().

Definition at line 201 of file testStack.cxx.

Referenced by SipStackAndThread().

Definition at line 199 of file testStack.cxx.

Referenced by destroy(), and SipStackAndThread().

Definition at line 198 of file testStack.cxx.

Referenced by destroy(), and SipStackAndThread().

Definition at line 196 of file testStack.cxx.

Referenced by destroy(), and SipStackAndThread().

Definition at line 197 of file testStack.cxx.

Referenced by destroy(), and SipStackAndThread().


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