summaryrefslogtreecommitdiff
path: root/ezdop/src/host/hunter/src/samplelog.h
blob: 3bb35b8c11e11c289392ae086d01df95ba040d8d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
/*
 Copyright 2006 Johnathan Corgan.
 
 This program is free software; you can redistribute it and/or modify
 it under the terms of the GNU General Public License version 2
 as published by the Free Software Foundation.
 
 This software is distributed in the hope that it will be useful,
 but WITHOUT ANY WARRANTY; without even the implied warranty of
 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 GNU General Public License for more details.
 
 You should have received a copy of the GNU General Public License
 along with GNU Radio; see the file COPYING.  If not, write to
 the Free Software Foundation, Inc., 51 Franklin Street,
 Boston, MA 02110-1301, USA.
*/

#ifndef __SAMPLELOG_H__
#define __SAMPLELOG_H__

// Application level includes
#include "sample.h"

// wxWidgets includes
#include <wx/string.h>
#include <wx/event.h>

// System level includes
#include <vector>

// Forward declarations
class wxFile;

class SampleLog
{
public:
    SampleLog();
    
    // Sample access
    void Add(Sample &sample);
    int  Count() const { return m_samples.size(); }
    wxMutex &Mutex() { return m_mutex; }
    std::vector<Sample>& Samples() { return m_samples; }

    // File operations
    void Load(wxString filename);
    bool Save();
    bool Save(wxString &filename);
    bool HasFile() const { return (m_file != NULL); }
    bool IsDirty() const { return m_save >= 0; }

private:
    bool readline(wxString &line);

    std::vector<Sample> m_samples;
    wxMutex m_mutex;
    int m_save;
    wxString m_filename;
    wxFile *m_file;
};

#endif