Changeset 6006 for branches/newapi

Show
Ignore:
Timestamp:
01/11/08 02:04:32 (11 months ago)
Author:
erijo
Message:

Added EventPipe::empty() to check if the pipe is empty.

Location:
branches/newapi/licq/src/event
Files:
3 modified

Legend:

Unmodified
Added
Removed
  • branches/newapi/licq/src/event/eventpipe.cpp

    r5977 r6006  
    4545  assert(myPipeline.empty()); 
    4646  assert(myEventPosition.empty()); 
     47} 
     48 
     49bool LicqDaemon::EventPipe::empty() 
     50{ 
     51  Licq::MutexLocker locker(&myMutex); 
     52 
     53  // Don't count dummy element 
     54  return (myPipeline.size() <= 1); 
    4755} 
    4856 
  • branches/newapi/licq/src/event/eventpipe.h

    r5977 r6006  
    3535  EventPipe(const std::string& name); 
    3636  ~EventPipe(); 
     37 
     38  /** 
     39   * @returns True if the pipe is empty; otherwise false. 
     40   */ 
     41  bool empty(); 
    3742 
    3843  /** 
  • branches/newapi/licq/src/event/test/eventpipetest.cpp

    r5977 r6006  
    6363  LicqDaemon::EventPipe pipe("test"); 
    6464  MockEventQueue queue; 
     65 
     66  BOOST_CHECK(pipe.empty()); 
    6567  pipe.addQueue(&queue, 0); 
     68  BOOST_CHECK(!pipe.empty()); 
    6669 
    6770  boost::shared_ptr<Licq::Event> event = Licq::Event::create("test"); 
     
    7780  BOOST_CHECK(queue.empty()); 
    7881  pipe.removeQueue(&queue); 
     82  BOOST_CHECK(pipe.empty()); 
    7983} 
    8084