GNU Radio 3.4.0 C++ API
data_handler.h
Go to the documentation of this file.
00001 /* -*- c++ -*- */
00002 /*
00003  * Copyright 2008 Free Software Foundation, Inc.
00004  * 
00005  * This file is part of GNU Radio
00006  * 
00007  * GNU Radio is free software; you can redistribute it and/or modify
00008  * it under the terms of the GNU General Public License as published by
00009  * the Free Software Foundation; either version 3, or (at your option)
00010  * any later version.
00011  * 
00012  * GNU Radio is distributed in the hope that it will be useful,
00013  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00014  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00015  * GNU General Public License for more details.
00016  * 
00017  * You should have received a copy of the GNU General Public License along
00018  * with this program; if not, write to the Free Software Foundation, Inc.,
00019  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
00020  */
00021 #ifndef INCLUDED_DATA_HANDLER_H
00022 #define INCLUDED_DATA_HANDLER_H
00023 
00024 #include <stdint.h>
00025 #include <stddef.h>
00026 
00027 namespace usrp2 {
00028 
00029   /*!
00030    * \brief Abstract function object called to handle received data blocks.
00031    */
00032   class data_handler 
00033   {
00034   public:
00035 
00036     enum result_bits {
00037       RELEASE   = 0x0000,       //< OK to release data (opposite of KEEP)
00038       KEEP      = 0x0001,       //< do not discard data
00039       DONE      = 0x0002,       //< do not call this object again
00040     };
00041     
00042     typedef int result;         //< bitmask of result_bits
00043 
00044     /*!
00045      * \param base points to the beginning of the data
00046      * \param len is the length in bytes of the data
00047      * \returns bitmask composed of DONE, KEEP
00048      */
00049     virtual result operator()(const void *base, size_t len) = 0;
00050     virtual ~data_handler();
00051   };
00052 
00053 } // namespace usrp2
00054 
00055 #endif /* INCLUDED_DATA_HANDLER_H */