#include "SincResampler.h"
#include <cassert>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <sys/types.h>
#include <sys/stat.h>
#include <sys/mman.h>
#include <fcntl.h>
#include <unistd.h>
#include <map>
#include <string>
#include <strstream>
Classes | |
class | AuditAdapter |
class | MonitorAdapter |
class | ReferenceDatabaseAdapter |
Functions | |
void | attachBuffers (void) |
void | detachBuffers (void) |
int | Resample (SincResampler &R, int dexout, int dexin, int refin) |
void | cmdLoop (FILE *out, FILE *in) |
int | main (int argc, char **argv) |
Variables | |
int | fdInput = -1 |
int | fdOutput = -1 |
int | fdDatabase = -1 |
double * | mmInput = NULL |
double * | mmOutput = NULL |
ResamplingSettings_t * | mmDatabase = NULL |
size_t | inputRecordSize = 0 |
size_t | outputRecordSize = 0 |
size_t | databaseRecordSize = sizeof( ResamplingSettings_t ) |
size_t | inputRecordCount = 0 |
size_t | outputRecordCount = 0 |
size_t | databaseRecordCount = 0 |
This stage implements a simplified standalone executable processing stage using memory mapped data channel, and piped audit and monitoring channel. The stage logic is responsible for negotiating with the framework code to make sure that the data structures being provided and delivered conform to the needs of the enclosed operators. The stage logic also accepts control information forwarded from the pipeline sequencing logic by the framework software. This module may be ultimately superseded by an equivalently testable module for a more advanced middleware solution (e.g. ACE).
* * $Log: ResamplingStage.cc,v $ * Revision 1.8 2004/02/21 21:52:38 rayg * Forgot eoln on ident response. * * Revision 1.7 2004/02/21 21:49:29 rayg * Fix for ATLAS doing C++-style mangling on cblas.h * Addition of ident command. * * Revision 1.6 2004/02/21 21:19:31 rayg * added 'ident' command and _cvsid * * Revision 1.5 2004/02/20 16:10:39 rayg * Simple testing harness simpletest0.py runs to completion. Next, create * simpletest1.py which uses regression testing data. * * Revision 1.4 2004/02/20 05:00:11 rayg * Modified back to passing file descriptors - memory maps are not necessarily * treated as physical memory addresses by things like Java and Python. * * Revision 1.3 2004/02/20 04:09:53 rayg * Approaching readiness for verification against reference implementation. * Still need a quick python execution wrapper for testing which will * memory map appropriate flat binary reference test data files. * Changed input environment variables significantly in the simplifying direction. * * Revision 1.2 2004/02/19 18:01:31 rayg * This version is about 80% complete. It needs to be provided information on the dimensionality * of the inputs (flat binary convention for starters) and it needs to properly initialize * the adapters which are used by the operator.. * * Revision 1.1 2004/02/19 17:02:29 rayg * Main routine for a resampling stage using memory-mapped files for framework * communication and the SincResampler operator for the algorithm implementation. * * *
* * Copyright UW/SSEC, ALL RIGHTS RESERVED, 2004 * Space Science and Engineering Center * University of Wisconsin - Madison, USA * *
|
Attach buffers needed to interface to the framework These are specified in environment variables. varInputSpectra: "%d,%u,%u" herited read-only memory map to be made from of file descriptor (d) containing (u) doubles for each of (u) buffers; buffers are indexed from 0 (i.e. offset) varOutputSpectra: "%d,%u,%u" herited read-write memory map to be made from of file descriptor (d) containing (u) doubles for each of (u) buffers; buffers are indexed from 0 (i.e. offset) refSamplingSettings: "%d,%u" heritable read-only fd (d) to be used memory map containing (d) ResamplingSettings_t structures |
|
main command loop. at the moment, quick and dirty. later, toolbox approach to doing these kinds of things to impose some uniformity across apps. one line input -> one line output. control channel is typically stdin and stdout |
|
Detach connection to driver/framework. |
|
Resample command implementation Given an input buffer number and an output buffer number, Find the F matrix that we need in the cache. If it's not in the cache, add it to the cache. If the cache is too big, flush out a random entry or the LRU entry Multiply the input spectrum by the corresponding F-matrix Rrite the output to the output buffer Return control and status to the command loop for it to respond to the managing (parent) application. |
|
number of available reference setting structures |
|
record size for reference data is sizeof(ResamplingSettings_t) |
|
Globals. |
|
number of available input buffers |
|
size in bytes of records in input map |
|
number of available output buffers |
|
record size for output map (should be identical) |