CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_5_3_0/src/IOPool/Streamer/src/BufferArea.cc

Go to the documentation of this file.
00001 
00002 #include "IOPool/Streamer/interface/EventBuffer.h"
00003 
00004 #include <memory>
00005 #include <list>
00006 
00007 namespace edm {
00008 
00009 namespace 
00010  {
00011    // --------------------------------------------
00012    // keep the buffers around since there are intended to be used
00013    // by multiple threads
00014    
00015    struct BufHolder
00016    {
00017      BufHolder() { }
00018      ~BufHolder()
00019      {
00020        while(!v_.empty())
00021          { EventBuffer* b = v_.front(); delete b; v_.pop_front(); }
00022      }
00023      std::list<EventBuffer*> v_;
00024    };
00025    BufHolder holder;
00026  }
00027 
00028   EventBuffer* getEventBuffer(int es, int qd)
00029   {
00030     std::auto_ptr<EventBuffer> b(new EventBuffer(es,qd));
00031     holder.v_.push_front(b.get());
00032     return b.release();
00033   }
00034 
00035 }
00036 
00037