~ubuntu-branches/ubuntu/quantal/kde-runtime/quantal

« back to all changes in this revision

Viewing changes to nepomuk/services/backupsync/service/diffgenerator.h

  • Committer: Package Import Robot
  • Author(s): Philip Muškovac
  • Date: 2012-06-03 21:50:00 UTC
  • mto: This revision was merged to the branch mainline in revision 21.
  • Revision ID: package-import@ubuntu.com-20120603215000-vn7oarsq0ynrydj5
Tags: upstream-4.8.80
Import upstream version 4.8.80

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/*
2
 
   This file is part of the Nepomuk KDE project.
3
 
   Copyright (C) 2010  Vishesh Handa <handa.vish@gmail.com>
4
 
 
5
 
   This library is free software; you can redistribute it and/or
6
 
   modify it under the terms of the GNU Lesser General Public
7
 
   License as published by the Free Software Foundation; either
8
 
   version 2.1 of the License, or (at your option) version 3, or any
9
 
   later version accepted by the membership of KDE e.V. (or its
10
 
   successor approved by the membership of KDE e.V.), which shall
11
 
   act as a proxy defined in Section 6 of version 3 of the license.
12
 
 
13
 
   This library is distributed in the hope that it will be useful,
14
 
   but WITHOUT ANY WARRANTY; without even the implied warranty of
15
 
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
16
 
   Lesser General Public License for more details.
17
 
 
18
 
   You should have received a copy of the GNU Lesser General Public
19
 
   License along with this library.  If not, see <http://www.gnu.org/licenses/>.
20
 
*/
21
 
 
22
 
 
23
 
#ifndef DIFFGENERATOR_H
24
 
#define DIFFGENERATOR_H
25
 
 
26
 
#include <QtCore/QThread>
27
 
#include <QtCore/QMutex>
28
 
#include <QtCore/QWaitCondition>
29
 
#include <QtCore/QQueue>
30
 
#include "changelogrecord.h"
31
 
 
32
 
namespace Soprano {
33
 
    class Model;
34
 
    class Statement;
35
 
}
36
 
 
37
 
namespace Nepomuk {
38
 
 
39
 
    namespace Sync {
40
 
        class ChangeLog;
41
 
    }
42
 
 
43
 
    class DiffGenerator : public QThread
44
 
    {
45
 
        Q_OBJECT
46
 
    public :
47
 
        DiffGenerator( QObject* parent = 0 );
48
 
        virtual ~DiffGenerator();
49
 
 
50
 
        void run();
51
 
 
52
 
    public Q_SLOTS:
53
 
        void statementAdded( const Soprano::Statement & st );
54
 
        void statementRemoved( const Soprano::Statement & st );
55
 
 
56
 
        //void removeOldRecords();
57
 
    private:
58
 
        Soprano::Model *m_model;
59
 
 
60
 
        QQueue<ChangeLogRecord> m_recordQueue;
61
 
 
62
 
        bool m_stopped;
63
 
        QMutex m_queueMutex;
64
 
        QWaitCondition m_queueWaiter;
65
 
 
66
 
        void stop();
67
 
 
68
 
        /**
69
 
         * Returns true if the statement should be backed up
70
 
         * A statement will be backed up if it can not be regenerated or is a part of the
71
 
         * InstanceBase OR if the property is a sub property of nao:identifyingProperty.
72
 
         * This is done to help to the identification.
73
 
         */
74
 
        bool backupStatement( const Soprano::Statement & st );
75
 
 
76
 
        /// A cache of the discardable graphs to speed up backupStatement()
77
 
        QHash<QUrl, bool> m_discardableGraphs;
78
 
    };
79
 
 
80
 
}
81
 
#endif // DIFFGENERATOR_H