GNU Radio 3.7.1 C++ API
tags.h
Go to the documentation of this file.
00001 /* -*- c++ -*- */
00002 /*
00003  * Copyright 2011,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_H
00024 #define INCLUDED_GR_TAGS_H
00025 
00026 #include <gnuradio/api.h>
00027 #include <pmt/pmt.h>
00028 
00029 namespace gr {
00030   
00031   struct GR_RUNTIME_API tag_t
00032   {
00033     //! the item \p tag occurred at (as a uint64_t)
00034     uint64_t offset;
00035 
00036     //! the key of \p tag (as a PMT symbol)
00037     pmt::pmt_t key;
00038 
00039     //! the value of \p tag (as a PMT)
00040     pmt::pmt_t value;
00041 
00042     //! the source ID of \p tag (as a PMT)
00043     pmt::pmt_t srcid;
00044 
00045     //! Used by gr_buffer to mark a tagged as deleted by a specific block. You can usually ignore this.
00046     std::vector<long> marked_deleted;
00047 
00048     /*!
00049      * Comparison function to test which tag, \p x or \p y, came
00050      * first in time
00051      */
00052     static inline bool offset_compare(const tag_t &x,
00053                                       const tag_t &y)
00054     {
00055       return x.offset < y.offset;
00056     }
00057 
00058     inline bool operator == (const tag_t &t) const
00059     {
00060       return (t.key == key) && (t.value == value) && \
00061       (t.srcid == srcid) && (t.offset == offset);
00062     }
00063   };
00064 
00065 } /* namespace gr */
00066 
00067 #endif /*INCLUDED_GR_TAGS_H*/