summaryrefslogtreecommitdiff
path: root/src/pmview/metriclist.h
blob: 8ef1eeef89c176dc73c6dde05d185dcac5c1d3cf (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
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
/*
 * Copyright (c) 1997 Silicon Graphics, Inc.  All Rights Reserved.
 * Copyright (c) 2009 Aconex.  All Rights Reserved.
 * 
 * This program is free software; you can redistribute it and/or modify it
 * under the terms of the GNU General Public License as published by the
 * Free Software Foundation; either version 2 of the License, or (at your
 * option) any later version.
 * 
 * This program 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.
 */
#ifndef _METRICLIST_H_
#define _METRICLIST_H_

#include <sys/types.h>
#include <Inventor/SbColor.h>
#include "qmc_metric.h"
#include "qmc_source.h"

typedef QList<QmcMetric *> MetricsList;
typedef QList<SbColor *> SbColorList;

class MetricList
{
public:

    enum AlignColor { noColors, perMetric, perValue };

private:

    MetricsList		_metrics;
    SbColorList		_colors;
    int			_values;

public:

    ~MetricList();

    MetricList();

    int numMetrics() const
	{ return _metrics.size(); }
    int numValues() const
	{ return _values; }
    int numColors() const
        { return _colors.size(); }

    const QmcMetric &metric(int i) const
	{ return *(_metrics[i]); }
    QmcMetric &metric(int i)
	{ return *(_metrics[i]); }

    const SbColor &color(int i) const
	{ return *(_colors[i]); }
    SbColor &color(int i)
	{ return *(_colors[i]); }    
    void color(int i, QString &str) const;

    int add(char const* metric, double scale);
    int add(char const* metric, double scale, int history);
    int add(pmMetricSpec *metric, double scale);
    int add(pmMetricSpec *metric, double scale, int history);
    int traverse(const char *metric);

    void add(SbColor const& color);
    void add(int packedcol);

    void resolveColors(AlignColor align = perMetric);

    static void toString(const SbColor &color, QString &str);

    friend QTextStream& operator<<(QTextStream&, MetricList const &);

private:

    MetricList(const MetricList &);
    const MetricList &operator=(const MetricList &);
    // Never defined
};

#endif /* _METRICLIST_H_ */