GNU Radio 3.7.1 C++ API
tagged_file_sink.h
Go to the documentation of this file.
00001 /* -*- c++ -*- */
00002 /*
00003  * Copyright 2010,2013 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
00018  * along with GNU Radio; see the file COPYING.  If not, write to
00019  * the Free Software Foundation, Inc., 51 Franklin Street,
00020  * Boston, MA 02110-1301, USA.
00021  */
00022 
00023 #ifndef INCLUDED_GR_TAGGED_FILE_SINK_H
00024 #define INCLUDED_GR_TAGGED_FILE_SINK_H
00025 
00026 #include <gnuradio/blocks/api.h>
00027 #include <gnuradio/sync_block.h>
00028 
00029 namespace gr {
00030   namespace blocks {
00031 
00032     /*!
00033      * \brief A file sink that uses tags to save files.
00034      * \ingroup file_operators_blk
00035      * \ingroup stream_tag_tools_blk
00036      *
00037      * \details
00038      * The sink uses a tag with the key 'burst' to trigger the saving
00039      * of the burst data to a new file. If the value of this tag is
00040      * True, it will open a new file and start writing all incoming
00041      * data to it. If the tag is False, it will close the file (if
00042      * already opened). The file names are based on the time when the
00043      * burst tag was seen. If there is an 'rx_time' tag (standard with
00044      * UHD sources), that is used as the time. If no 'rx_time' tag is
00045      * found, the new time is calculated based off the sample rate of
00046      * the block.
00047      */
00048     class BLOCKS_API tagged_file_sink : virtual public sync_block
00049     {
00050     public:
00051       // gr::blocks::tagged_file_sink::sptr
00052       typedef boost::shared_ptr<tagged_file_sink> sptr;
00053       
00054       /*!
00055        * \brief Build a tagged_file_sink block.
00056        *
00057        * \param itemsize The item size of the input data stream.
00058        * \param samp_rate The sample rate used to determine the time
00059        *                  difference between bursts
00060        */
00061       static sptr make(size_t itemsize, double samp_rate);
00062     };
00063 
00064   } /* namespace blocks */
00065 } /* namespace gr */
00066 
00067 #endif /* INCLUDED_GR_TAGGED_FILE_SINK_H */