data_queue.hpp

Go to the documentation of this file.
00001 /*
00002  * Copyright (C) Sergey P. Derevyago, 2008-2009.
00003  *
00004  * Permission to copy, use, modify, sell and distribute this software is granted
00005  * provided this copyright notice appears in all copies.
00006  * This software is provided "as is" without express or implied warranty, and
00007  * with no claim as to its suitability for any purpose.
00008  *
00009  */
00010 
00017 #ifndef __DERS__DATA_QUEUE_HPP__
00018 #define __DERS__DATA_QUEUE_HPP__
00019 
00020 #include <ders/config.hpp>
00021 #include <ders/data_io.hpp>
00022 
00023 namespace ders {  // ::ders
00024 
00028 class object_io : virtual public destroyable {
00029  public:
00030       virtual bool read_from(data_in& in)=0;
00031       virtual void write_to(data_out& out) const=0;
00032 };
00033 
00037 class data_queue : virtual public destroyable {
00038  public:
00040       enum result { ok, empt, intr };
00041 
00042       virtual bool is_intr()=0;
00043       virtual void set_intr(bool val)=0;
00044 
00045       virtual result read_obj(object_io& rdr, bool wait=true)=0;
00046       virtual result write_obj(const object_io& wrtr)=0;
00047 };
00048 
00049 typedef sh_ptr<data_queue> sh_data_queue;
00050 
00057 sh_data_queue new_data_queue(mem_pool& mp, int rsrv=10*1024);
00058 
00064 sh_data_queue new_data_queue(sh_data_io dio);
00065 
00066 }  // namespace ::ders
00067 
00068 #endif  // __DERS__DATA_QUEUE_HPP__
00069 

Generated on Tue Dec 8 11:35:32 2009 for derslib by  doxygen 1.5.5