~ubuntu-branches/debian/sid/calligraplan/sid

« back to all changes in this revision

Viewing changes to src/libs/main/KoFilterEdge.h

  • Committer: Package Import Robot
  • Author(s): Pino Toscano
  • Date: 2018-02-01 18:20:19 UTC
  • Revision ID: package-import@ubuntu.com-20180201182019-1qo7qaim5wejm5k9
Tags: upstream-3.1.0
ImportĀ upstreamĀ versionĀ 3.1.0

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/* This file is part of the Calligra libraries
 
2
   Copyright (C) 2001 Werner Trobin <trobin@kde.org>
 
3
 
 
4
This library is free software; you can redistribute it and/or
 
5
modify it under the terms of the GNU Library General Public
 
6
License as published by the Free Software Foundation; either
 
7
version 2 of the License, or (at your option) any later version.
 
8
 
 
9
This library is distributed in the hope that it will be useful,
 
10
but WITHOUT ANY WARRANTY; without even the implied warranty of
 
11
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 
12
Library General Public License for more details.
 
13
 
 
14
You should have received a copy of the GNU Library General Public License
 
15
along with this library; see the file COPYING.LIB.  If not, write to
 
16
the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
 
17
Boston, MA 02110-1301, USA.
 
18
*/
 
19
#ifndef KOFILTEREDGE_H
 
20
#define KOFILTEREDGE_H
 
21
 
 
22
#include "KoFilterChain.h"
 
23
#include "PriorityQueue_p.h"
 
24
 
 
25
namespace CalligraFilter {
 
26
/**
 
27
 * An internal class representing a filter (=edge) in the filter graph.
 
28
 * @internal
 
29
 */
 
30
class Edge
 
31
{
 
32
 
 
33
public:
 
34
    // creates a new edge to "vertex" with the given weight.
 
35
    Edge(Vertex* vertex, KoFilterEntry::Ptr filterEntry);
 
36
    ~Edge() {}
 
37
 
 
38
    unsigned int weight() const {
 
39
        return m_filterEntry ? m_filterEntry->weight : 0;
 
40
    }
 
41
    KoFilterEntry::Ptr filterEntry() const {
 
42
        return m_filterEntry;
 
43
    }
 
44
    const Vertex* vertex() const {
 
45
        return m_vertex;
 
46
    }
 
47
 
 
48
    // Relaxes the "connected" vertex (i.e. the weight of the
 
49
    // connected vertex = "predec.->key()" (parameter) + weight of this edge
 
50
    // As this will only be called once we calculate the weight
 
51
    // of the edge "on the fly"
 
52
    // Note: We have to pass the queue as we have to call keyDecreased :}
 
53
    void relax(const Vertex* predecessor, PriorityQueue<Vertex>& queue);
 
54
 
 
55
    // debugging
 
56
    void dump(const QByteArray& indent) const;
 
57
 
 
58
private:
 
59
    Edge(const Edge& rhs);
 
60
    Edge& operator=(const Edge& rhs);
 
61
 
 
62
    Vertex* m_vertex;
 
63
    KoFilterEntry::Ptr m_filterEntry;
 
64
 
 
65
    class Private;
 
66
    Private * const d;
 
67
};
 
68
}
 
69
 
 
70
#endif // KOFILTEREDGE_H