MFXEventQue.cpp

Go to the documentation of this file.
00001 /****************************************************************************/
00007 // missing_desc
00008 /****************************************************************************/
00009 // SUMO, Simulation of Urban MObility; see http://sumo.sourceforge.net/
00010 // Copyright 2001-2010 DLR (http://www.dlr.de/) and contributors
00011 /****************************************************************************/
00012 //
00013 //   This program is free software; you can redistribute it and/or modify
00014 //   it under the terms of the GNU General Public License as published by
00015 //   the Free Software Foundation; either version 2 of the License, or
00016 //   (at your option) any later version.
00017 //
00018 /****************************************************************************/
00019 
00020 
00021 // ===========================================================================
00022 // included modules
00023 // ===========================================================================
00024 #ifdef _MSC_VER
00025 #include <windows_config.h>
00026 #else
00027 #include <config.h>
00028 #endif
00029 
00030 #include "MFXEventQue.h"
00031 #include <cassert>
00032 
00033 #ifdef CHECK_MEMORY_LEAKS
00034 #include <foreign/nvwa/debug_new.h>
00035 #endif // CHECK_MEMORY_LEAKS
00036 
00037 void *
00038 MFXEventQue::top() {
00039     assert(size()!=0);
00040     myMutex.lock();
00041     void *ret = *(myEvents.begin());
00042     myMutex.unlock();
00043     return ret;
00044 }
00045 
00046 
00047 void
00048 MFXEventQue::pop() {
00049     myMutex.lock();
00050     myEvents.erase(myEvents.begin());
00051     myMutex.unlock();
00052 }
00053 
00054 
00055 void
00056 MFXEventQue::add(void *what) {
00057     myMutex.lock();
00058     myEvents.push_back(what);
00059     myMutex.unlock();
00060 }
00061 
00062 
00063 size_t
00064 MFXEventQue::size() {
00065     myMutex.lock();
00066     size_t msize = myEvents.size();
00067     myMutex.unlock();
00068     return msize;
00069 }
00070 
00071 
00072 bool
00073 MFXEventQue::empty() {
00074     myMutex.lock();
00075     bool ret = size()==0;
00076     myMutex.unlock();
00077     return ret;
00078 }
00079 
00080 
00081 
00082 /****************************************************************************/
00083 

Generated on Wed May 5 00:06:30 2010 for Sumo - Simulation of Urban MObility by  doxygen 1.5.6