GNU Radio 3.6.5 C++ API

gr_tags.h

Go to the documentation of this file.
00001 /*
00002  * Copyright 2011 Free Software Foundation, Inc.
00003  *
00004  * This file is part of GNU Radio
00005  *
00006  * GNU Radio is free software; you can redistribute it and/or modify
00007  * it under the terms of the GNU General Public License as published by
00008  * the Free Software Foundation; either version 3, or (at your option)
00009  * any later version.
00010  *
00011  * GNU Radio is distributed in the hope that it will be useful,
00012  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00013  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00014  * GNU General Public License for more details.
00015  *
00016  * You should have received a copy of the GNU General Public License
00017  * along with GNU Radio; see the file COPYING.  If not, write to
00018  * the Free Software Foundation, Inc., 51 Franklin Street,
00019  * Boston, MA 02110-1301, USA.
00020  */
00021 
00022 #ifndef INCLUDED_GR_TAGS_H
00023 #define INCLUDED_GR_TAGS_H
00024 
00025 #include <gr_core_api.h>
00026 #include <gruel/pmt.h>
00027 
00028 struct GR_CORE_API gr_tag_t{
00029 
00030     //! the item \p tag occurred at (as a uint64_t)
00031     uint64_t offset;
00032 
00033     //! the key of \p tag (as a PMT symbol)
00034     pmt::pmt_t key;
00035 
00036     //! the value of \p tag (as a PMT)
00037     pmt::pmt_t value;
00038 
00039     //! the source ID of \p tag (as a PMT)
00040     pmt::pmt_t srcid;
00041 
00042     //! Used by gr_buffer to mark a tagged as deleted by a specific block. You can usually ignore this.
00043     std::vector<long> marked_deleted;
00044 
00045     //! Comparison function to test which tag, \p x or \p y, came first in time
00046     static inline bool offset_compare(
00047         const gr_tag_t &x, const gr_tag_t &y
00048     ){
00049         return x.offset < y.offset;
00050     }
00051 
00052     inline bool operator == (const gr_tag_t &t) const
00053     {
00054       return (t.key == key) && (t.value == value) && (t.srcid == srcid) && (t.offset == offset);
00055     }
00056 };
00057 
00058 #endif /*INCLUDED_GR_TAGS_H*/