annotate AgentFeeder.h @ 75:84d1a0647ce5 tip

Split out COPYING from README
author Chris Cannam
date Fri, 06 Mar 2020 11:01:53 +0000
parents 82b3cdf6ca6b
children 7ad142c710c6
rev   line source
Chris@52 1 /* -*- c-basic-offset: 4 indent-tabs-mode: nil -*- vi:set ts=8 sts=4 sw=4: */
Chris@52 2 /*
Chris@52 3 This file is Copyright (c) 2012 Chris Cannam
Chris@52 4
Chris@52 5 Permission is hereby granted, free of charge, to any person
Chris@52 6 obtaining a copy of this software and associated documentation
Chris@52 7 files (the "Software"), to deal in the Software without
Chris@52 8 restriction, including without limitation the rights to use, copy,
Chris@52 9 modify, merge, publish, distribute, sublicense, and/or sell copies
Chris@52 10 of the Software, and to permit persons to whom the Software is
Chris@52 11 furnished to do so, subject to the following conditions:
Chris@52 12
Chris@52 13 The above copyright notice and this permission notice shall be
Chris@52 14 included in all copies or substantial portions of the Software.
Chris@52 15
Chris@52 16 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
Chris@52 17 EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
Chris@52 18 MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
Chris@52 19 NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR
Chris@52 20 ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
Chris@52 21 CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
Chris@52 22 WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
Chris@52 23 */
Chris@52 24
Chris@52 25 #ifndef _AGENT_FEEDER_H_
Chris@52 26 #define _AGENT_FEEDER_H_
Chris@52 27
Chris@52 28 #include "NoteHypothesis.h"
Chris@52 29
Chris@52 30 #include <vector>
Chris@52 31
Chris@52 32 /**
Chris@52 33 * Take a series of estimates (one at a time) and feed them to a set
Chris@52 34 * of note hypotheses, creating a new candidate hypothesis for each
Chris@52 35 * observation and also testing the observation against the existing
Chris@52 36 * set of hypotheses.
Chris@52 37 *
Chris@52 38 * One satisfied hypothesis is considered to be "accepted" at any
Chris@52 39 * moment (that is, the earliest contemporary hypothesis to have
Chris@52 40 * become satisfied). The series of accepted and completed hypotheses
Chris@52 41 * from construction to the present time can be queried through
Chris@52 42 * getAcceptedHypotheses().
Chris@52 43 *
Chris@52 44 * Call feed() to provide a new observation. Call finish() when all
Chris@52 45 * observations have been provided. The set of hypotheses returned by
Chris@52 46 * getAcceptedHypotheses() will not be complete unless finish() has
Chris@52 47 * been called.
Chris@52 48 */
Chris@52 49 class AgentFeeder
Chris@52 50 {
Chris@52 51 public:
Chris@54 52 AgentFeeder() : m_haveCurrent(false) { }
Chris@52 53
Chris@52 54 void feed(NoteHypothesis::Estimate);
Chris@52 55 void finish();
Chris@52 56
Chris@52 57 typedef std::vector<NoteHypothesis> Hypotheses;
Chris@52 58
Chris@57 59 const Hypotheses &getAcceptedHypotheses() const {
Chris@52 60 return m_accepted;
Chris@52 61 }
Chris@52 62
Chris@54 63 Hypotheses reap(Hypotheses);
Chris@54 64
Chris@52 65 private:
Chris@52 66 Hypotheses m_candidates;
Chris@52 67 NoteHypothesis m_current;
Chris@54 68 bool m_haveCurrent;
Chris@52 69 Hypotheses m_accepted;
Chris@52 70 };
Chris@52 71
Chris@52 72
Chris@52 73 #endif
Chris@52 74