GNU Radio 3.7.1 C++ API
tags_strobe.h
Go to the documentation of this file.
00001 /* -*- c++ -*- */
00002 /*
00003  * Copyright 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_TAGS_STROBE_H
00024 #define INCLUDED_GR_TAGS_STROBE_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 Send tags at defined interval
00034      * \ingroup debug_blk
00035      *
00036      * \details
00037      * Sends a tag with key 'strobe' and a user-defined value (as a
00038      * PMT) every \p nsamps number of samples. Useful for
00039      * testing/debugging the tags system.
00040      *
00041      * Because tags are sent with a data stream, this is a source
00042      * block that acts identical to a null_source block.
00043      */
00044     class BLOCKS_API tags_strobe : virtual public sync_block
00045     {
00046     public:
00047       // gr::blocks::tags_strobe::sptr
00048       typedef boost::shared_ptr<tags_strobe> sptr;
00049 
00050       /*!
00051        * Make a tags stobe block to send tags with value \p value
00052        * every \p nsamps number of samples.
00053        *
00054        * \param sizeof_stream_item size of the stream items in bytes.
00055        * \param value The value of the tags to send, as a PMT.
00056        * \param nsamps the number of samples between each tag.
00057        */
00058       static sptr make(size_t sizeof_stream_item,
00059                        pmt::pmt_t value, uint64_t nsamps);
00060 
00061       /*!
00062        * Reset the value of the tags being sent.
00063        * \param value The value of the tags to send as a PMT.
00064        */
00065       virtual void set_value(pmt::pmt_t value) = 0;
00066 
00067       /*!
00068        * Get the value of the tags being sent.
00069        */
00070       virtual pmt::pmt_t value() const = 0;
00071 
00072       /*!
00073        * Reset the sending interval.
00074        * \param nsamps the number of samples between each tag
00075        */
00076       virtual void set_nsamps(uint64_t nsamps) = 0;
00077 
00078       /*!
00079        * Get the number of samples between the tag strobe.
00080        */
00081       virtual uint64_t nsamps() const = 0;
00082     };
00083 
00084   } /* namespace blocks */
00085 } /* namespace gr */
00086 
00087 #endif /* INCLUDED_GR_TAGS_STROBE_H */