File indexing completed on 2024-12-22 04:17:03

0001 /***************************************************************************
0002                          dmcdata.cpp  -  Part of KST
0003                              -------------------
0004     begin                : Wed July 4 2007
0005     copyright            : (C) 2007 The University of Toronto
0006     email                :
0007  ***************************************************************************/
0008 
0009 /***************************************************************************
0010  *                                                                         *
0011  *   This program is free software; you can redistribute it and/or modify  *
0012  *   it under the terms of the GNU General Public License as published by  *
0013  *   the Free Software Foundation; either version 2 of the License, or     *
0014  *   (at your option) any later version.                                   *
0015  *                                                                         *
0016  ***************************************************************************/
0017 
0018 
0019 #include "dmcdata.h"
0020 #include "stdlib.h"
0021 
0022 using namespace DMC;
0023 
0024 
0025 namespace DMC
0026 {
0027 
0028 bool haveDMC() {
0029   return true;
0030 }
0031 
0032 bool validDatabase(const QString& db) {
0033   if (getenv("PGUSER") == NULL || getenv("DBROOT") == NULL) {
0034     qDebug("DMC is missing environment variables");
0035     /* DMC will lock up if these environment variables are not set */
0036     return false;
0037   }
0038 
0039   PIOGroup *g = PIOOpenVoidGrp(const_cast<char*>(db.toLatin1().constData()), const_cast<char*>("r"));
0040   if (g) {
0041     PIOCloseVoidGrp(&g);
0042     // the call PIOOpenVoidGrp open the database, 
0043     // the PIOCloseVoidGrp call do not close it
0044     // once one db is opened, 
0045     // any subsequent open call will fail unless it is the same database
0046     // lets close it
0047     int rtc;
0048 #warning "Kst2 port use PIOQuitDB()"
0049     //rtc = PIOQuitDB();
0050     if(rtc != 0) { 
0051       // closing failed, do not care
0052     }
0053     return true;
0054   }
0055   return false;
0056 }
0057 }
0058 
0059 Source::Source() : Kst::Shared() {
0060   _isValid = false;
0061 }
0062 
0063 
0064 Source::~Source() {
0065 }
0066 
0067 
0068 bool Source::setGroup(const QString& group) {
0069   Q_UNUSED(group)
0070   return false;
0071 }
0072 
0073 
0074 void Source::reset() {
0075   _isValid = false;
0076 }
0077 
0078 
0079 bool Source::isValid() const {
0080   return _isValid;
0081 }
0082 
0083 
0084 QStringList Source::fields() const {
0085   return QStringList();
0086 }
0087 
0088 
0089 int Source::readObject(const QString& object, double *buf, long start, long end) {
0090   Q_UNUSED(object)
0091   Q_UNUSED(buf)
0092   Q_UNUSED(start)
0093   Q_UNUSED(end)
0094   return 0;
0095 }
0096 
0097 
0098 bool Source::updated() const {
0099   return false;
0100 }
0101 
0102 
0103 QSize Source::range(const QString& object) const {
0104   Q_UNUSED(object)
0105   return QSize();
0106 }