3 * Copyright 2002 Free Software Foundation, Inc.
5 * This file is part of GNU Radio
7 * GNU Radio is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 3, or (at your option)
12 * GNU Radio is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
17 * You should have received a copy of the GNU General Public License
18 * along with GNU Radio; see the file COPYING. If not, write to
19 * the Free Software Foundation, Inc., 51 Franklin Street,
20 * Boston, MA 02110-1301, USA.
23 #include <GrAtscFieldSyncChecker.h>
24 #include <create_atsci_fs_checker.h>
25 #include <atsci_fs_checker.h>
27 // typedefs for fundamental i/o types
29 typedef float iDataType;
30 typedef atsc::syminfo iTagType;
31 typedef float oDataType;
32 typedef atsc::syminfo oTagType;
34 static const int NUMBER_OF_OUTPUTS = 2; // # of output streams
37 GrAtscFieldSyncChecker::GrAtscFieldSyncChecker ()
38 : VrHistoryProc<iDataType,oDataType> (NUMBER_OF_OUTPUTS)
40 // tags and data must be same size due to limitation of runtime
41 assert (sizeof (iDataType) == sizeof (iTagType));
42 assert (sizeof (oDataType) == sizeof (oTagType));
44 // 1 + number of extra input elements at which we look. This is
45 // used by the superclass's forecast routine to get us the correct
46 // range on our inputs.
47 // We're one-to-one input-to-output so set it to 1.
50 d_fsc = create_atsci_fs_checker ();
53 GrAtscFieldSyncChecker::~GrAtscFieldSyncChecker ()
55 // Anything that isn't automatically cleaned up...
61 * This is the real work horse. In general this interface can handle
62 * multiple streams of input and output, but we almost always
63 * use a single input and output stream.
67 GrAtscFieldSyncChecker::work (VrSampleRange output, void *ao[],
68 VrSampleRange inputs[], void *ai[])
70 // If we have state that persists across invocations (e.g., we have
71 // instance variables that we modify), we must use the sync method
72 // to indicate to the scheduler that our output must be computed in
73 // order. This doesn't keep other things from being run in
74 // parallel, it just means that at any given time, there is only a
75 // single thread working this code, and that the scheduler will
76 // ensure that we are asked to produce output that is contiguous and
77 // that will be presented to us in order of increasing time.
79 // We have state, hence we must use sync.
83 // construct some nicer i/o pointers to work with.
85 iDataType *sample_in = ((iDataType **) ai)[0];
86 iTagType *tag_in = ((iTagType **) ai)[1];
87 oDataType *sample_out = ((oDataType **) ao)[0];
88 oTagType *tag_out = ((oTagType **) ao)[1];
90 // We must produce output.size units of output.
92 for (unsigned int i = 0; i < output.size; i++){
93 d_fsc->filter (sample_in[i], tag_in[i], &sample_out[i], &tag_out[i]);
96 // Return the number of units we produced.
97 // Note that for all intents and purposes, it is an error to
98 // produce less than you are asked for.