# Skiphead block with reset

**URL:** <https://www.ruby-forum.com/t/skiphead-block-with-reset/232796>\
**Category:** GNU Radio\
**Created:** [October 28, 2014, 6:55pm UTC](https://www.ruby-forum.com/t/skiphead-block-with-reset/232796 "2014-10-28T18:55:57Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![addis\_a](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/c4cdca/32.png) [@addis\_a](https://www.ruby-forum.com/u/addis_a)\
**Post date:** [October 28, 2014, 6:55pm UTC](https://www.ruby-forum.com/t/skiphead-block-with-reset/232796/1 "2014-10-28T18:55:57Z")

</div>

Hi all,

I was looking into the possibility of adding a reset ability (ala the  
head block) to skiphead.

In my search to find out if it had already been done, I came up with  
this commit message:

commit 9aabbe0601919c9fecd46e4e418e5c94183fca45  
Author: Tom R. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)  
Date: Thu Jul 5 22:01:45 2012 -0400

```
core: adding ability to change and reset skiphead parameters.

```

But I couldn’t find that capability or commit in the current github  
code.

Does anyone have a hint at where I could find that modification or,  
barring that, any hints on how to accomplish it myself? I’m hoping it  
will be as straightforward as pull the reset bits from the head block.

-Doug

---

<div class="post-metadata">

**Author:** ![AndersonS\_Douglas\_J](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/53a042/32.png) [@AndersonS\_Douglas\_J](https://www.ruby-forum.com/u/AndersonS_Douglas_J)\
**Post date:** [October 28, 2014, 7:00pm UTC](https://www.ruby-forum.com/t/skiphead-block-with-reset/232796/2 "2014-10-28T19:00:44Z")

</div>

Doug,

that commit is in master. Note that it’s old, and committed _before_ the  
3.7 API change, so the changes are moved to the corresponding new block  
in gr-blocks.

M

---

<div class="post-metadata">

**Author:** ![AndersonS\_Douglas\_J](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/53a042/32.png) [@AndersonS\_Douglas\_J](https://www.ruby-forum.com/u/AndersonS_Douglas_J)\
**Post date:** [October 28, 2014, 7:14pm UTC](https://www.ruby-forum.com/t/skiphead-block-with-reset/232796/3 "2014-10-28T19:14:28Z")

</div>

Taking a quick look at a branch of that hash tag, the Reset function  
simply  
sets d\_nitems = 0. There are 4 helper functions within the Skip Head  
block  
of old that are not in the current one; namely setting the number of  
items  
to skip, checking how many items are to be skipped, checking how many  
items  
have currently been skipped, and resetting the block. The code below is  
from the hash tag given, and should be trivial to implement into the  
current block (the variable names are even still the same).

void  
gr\_skiphead::set\_nitems\_to\_skip(uint64\_t nitems\_to\_skip)  
{  
d\_nitems\_to\_skip = nitems\_to\_skip;  
reset();  
}

uint64\_t  
gr\_skiphead::nitems\_to\_skip() const  
{  
return d\_nitems\_to\_skip;  
}

uint64\_t  
gr\_skiphead::nitems\_skiped() const  
{  
return d\_nitems;  
}

void  
gr\_skiphead::reset()  
{  
d\_nitems = 0;  
}

Michael B.

On Tue, Oct 28, 2014 at 10:59 AM, Martin B. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)

---

<div class="post-metadata">

**Author:** ![AndersonS\_Douglas\_J](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/53a042/32.png) [@AndersonS\_Douglas\_J](https://www.ruby-forum.com/u/AndersonS_Douglas_J)\
**Post date:** [October 28, 2014, 7:59pm UTC](https://www.ruby-forum.com/t/skiphead-block-with-reset/232796/4 "2014-10-28T19:59:49Z")

</div>

Thanks for this, your git-fu is much stronger than mine!

I wonder why the mutator func for d\_nitems didn’t make it into the  
current version. At least for me, it’s really useful to have.

Anyway, looks like it won’t be too bad to graft in. Thanks again.

-Doug

* * *

From: discuss-gnuradio-bounces+danderson=removed\_email\_address@domain.invalid  
[discuss-gnuradio-bounces+danderson=removed\_email\_address@domain.invalid] on behalf  
of Michael B. [removed\_email\_address@domain.invalid]  
Sent: Tuesday, October 28, 2014 12:12 PM  
To: Martin B.  
Cc: removed\_email\_address@domain.invalid  
Subject: Re: [Discuss-gnuradio] skiphead block with reset

Taking a quick look at a branch of that hash tag, the Reset function  
simply sets d\_nitems = 0. There are 4 helper functions within the Skip  
Head block of old that are not in the current one; namely setting the  
number of items to skip, checking how many items are to be skipped,  
checking how many items have currently been skipped, and resetting the  
block. The code below is from the hash tag given, and should be trivial  
to implement into the current block (the variable names are even still  
the same).

void  
gr\_skiphead::set\_nitems\_to\_skip(uint64\_t nitems\_to\_skip)  
{  
d\_nitems\_to\_skip = nitems\_to\_skip;  
reset();  
}

uint64\_t  
gr\_skiphead::nitems\_to\_skip() const  
{  
return d\_nitems\_to\_skip;  
}

uint64\_t  
gr\_skiphead::nitems\_skiped() const  
{  
return d\_nitems;  
}

void  
gr\_skiphead::reset()  
{  
d\_nitems = 0;  
}

Michael B.

On Tue, Oct 28, 2014 at 10:59 AM, Martin B.  
\<removed\_email\_address@domain.invalid[mailto:removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)\> wrote:  
Doug,

that commit is in master. Note that it’s old, and committed _before_ the  
3.7 API change, so the changes are moved to the corresponding new block  
in gr-blocks.

M
