Subversion Repositories Projects

Rev

Rev 239 | Go to most recent revision | Only display areas with differences | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 239 Rev 240
1
/***************************************************************************
1
/***************************************************************************
2
 *   Copyright (C) 2009 by Manuel Schrape                                  *
2
 *   Copyright (C) 2009 by Manuel Schrape                                  *
3
 *   manuel.schrape@gmx.de                                                 *
3
 *   manuel.schrape@gmx.de                                                 *
4
 *   and Andreas Bresser bresser@informatik.uni-bremen.de                  *
4
 *   and Andreas Bresser bresser@informatik.uni-bremen.de                  *
5
 *                                                                         *
5
 *                                                                         *
6
 *   This program is free software; you can redistribute it and/or modify  *
6
 *   This program is free software; you can redistribute it and/or modify  *
7
 *   it under the terms of the GNU General Public License as published by  *
7
 *   it under the terms of the GNU General Public License as published by  *
8
 *   the Free Software Foundation; either version 2 of the License.        *
8
 *   the Free Software Foundation; either version 2 of the License.        *
9
 *                                                                         *
9
 *                                                                         *
10
 *   This program is distributed in the hope that it will be useful,       *
10
 *   This program is distributed in the hope that it will be useful,       *
11
 *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
11
 *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
12
 *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *
12
 *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *
13
 *   GNU General Public License for more details.                          *
13
 *   GNU General Public License for more details.                          *
14
 *                                                                         *
14
 *                                                                         *
15
 *   You should have received a copy of the GNU General Public License     *
15
 *   You should have received a copy of the GNU General Public License     *
16
 *   along with this program; if not, write to the                         *
16
 *   along with this program; if not, write to the                         *
17
 *   Free Software Foundation, Inc.,                                       *
17
 *   Free Software Foundation, Inc.,                                       *
18
 *   59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.             *
18
 *   59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.             *
19
 ***************************************************************************/
19
 ***************************************************************************/
20
 
20
 
21
#include "Logger.h"
21
#include "Logger.h"
22
 
22
 
23
Logger::Logger(cSettings * settings)
23
Logger::Logger(cSettings * settings, sMode * mode)
24
{
24
{
25
    csv = new CSVLogger(settings);
25
    csv = new CSVLogger(settings, mode);
26
    logger << csv;
26
    logger << csv;
27
    active = false;
27
    active = false;
28
}
28
}
29
 
29
 
30
Logger::~Logger()
30
Logger::~Logger()
31
{
31
{
32
    close();
32
    close();
33
}
33
}
34
 
34
 
35
//schreibe log
35
//schreibe log
36
void Logger::write(int * analogData)
36
void Logger::write(int * analogData)
37
{
37
{
38
    if (active == true)
38
    if (active == true)
39
        foreach (DefaultLogger * log, logger)
39
        foreach (DefaultLogger * log, logger)
40
            if (log->ready())
40
            if (log->ready())
41
                log->write(analogData);
41
                log->write(analogData);
42
}
42
}
43
 
-
 
44
//erzeuge neue Log-Datei/neuen Datensatz
-
 
45
void Logger::newLog(QString name)
-
 
46
{
-
 
47
    foreach (DefaultLogger * log, logger)
-
 
48
        log->newLog(name);
-
 
49
}
-
 
50
 
43
 
51
//starte Logging
44
//starte Logging
52
void Logger::start_Log()
45
void Logger::start_Log()
53
{
46
{
54
    active = true;
47
    active = true;
-
 
48
    foreach (DefaultLogger * log, logger)
-
 
49
        log->newLog();
55
}
50
}
56
 
51
 
57
//soll geloggt werden?
52
//soll geloggt werden?
58
bool Logger::is_active()
53
bool Logger::is_active()
59
{
54
{
60
    return active;
55
    return active;
61
}
56
}
62
 
57
 
63
//alles schließen
58
//alles schließen
64
void Logger::close()
59
void Logger::close()
65
{
60
{
66
    active = false;
61
    active = false;
67
    foreach (DefaultLogger * log, logger)
62
    foreach (DefaultLogger * log, logger)
68
        log->close();
63
        log->close();
69
}
64
}