File: dmcdata.cpp

package info (click to toggle)
kst 2.0.8-6
  • links: PTS, VCS
  • area: main
  • in suites: sid, trixie
  • size: 30,748 kB
  • sloc: cpp: 97,086; ansic: 13,364; python: 2,970; sh: 761; yacc: 184; lex: 143; makefile: 141; javascript: 122; perl: 30; xml: 30
file content (106 lines) | stat: -rw-r--r-- 2,557 bytes parent folder | download | duplicates (4)
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
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
/***************************************************************************
                         dmcdata.cpp  -  Part of KST
                             -------------------
    begin                : Wed July 4 2007
    copyright            : (C) 2007 The University of Toronto
    email                :
 ***************************************************************************/

/***************************************************************************
 *                                                                         *
 *   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.                                   *
 *                                                                         *
 ***************************************************************************/


#include "dmcdata.h"
#include "stdlib.h"

using namespace DMC;


namespace DMC
{

bool haveDMC() {
  return true;
}

bool validDatabase(const QString& db) {
  if (getenv("PGUSER") == NULL || getenv("DBROOT") == NULL) {
    qDebug("DMC is missing environment variables");
    /* DMC will lock up if these environment variables are not set */
    return false;
  }

  PIOGroup *g = PIOOpenVoidGrp(const_cast<char*>(db.toLatin1().constData()), const_cast<char*>("r"));
  if (g) {
    PIOCloseVoidGrp(&g);
    // the call PIOOpenVoidGrp open the database, 
    // the PIOCloseVoidGrp call do not close it
    // once one db is opened, 
    // any subsequent open call will fail unless it is the same database
    // lets close it
    int rtc;
#warning "Kst2 port use PIOQuitDB()"
    //rtc = PIOQuitDB();
    if(rtc != 0) { 
      // closing failed, do not care
    }
    return true;
  }
  return false;
}
}

Source::Source() : Kst::Shared() {
  _isValid = false;
}


Source::~Source() {
}


bool Source::setGroup(const QString& group) {
  Q_UNUSED(group)
  return false;
}


void Source::reset() {
  _isValid = false;
}


bool Source::isValid() const {
  return _isValid;
}


QStringList Source::fields() const {
  return QStringList();
}


int Source::readObject(const QString& object, double *buf, long start, long end) {
  Q_UNUSED(object)
  Q_UNUSED(buf)
  Q_UNUSED(start)
  Q_UNUSED(end)
  return 0;
}


bool Source::updated() const {
  return false;
}


QSize Source::range(const QString& object) const {
  Q_UNUSED(object)
  return QSize();
}