File indexing completed on 2024-12-22 04:17:17
0001 /*************************************************************************** 0002 datacollection.h 0003 ------------------- 0004 begin : June 12, 2003 0005 copyright : (C) 2003 The University of Toronto 0006 email : netterfield@astro.utoronto.ca 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 #ifndef DATACOLLECTION_H 0019 #define DATACOLLECTION_H 0020 0021 #include "datasource.h" 0022 #include "string_kst.h" 0023 #include "vector.h" 0024 #include "matrix.h" 0025 #include "kst_export.h" 0026 0027 class QFile; 0028 0029 namespace Kst { 0030 0031 class Relation; 0032 class PlotItemInterface; 0033 0034 class KSTCORE_EXPORT Data 0035 { 0036 protected: 0037 static Data *_self; 0038 static void cleanup(); 0039 Data(); 0040 virtual ~Data(); 0041 0042 public: 0043 static Data *self(); 0044 static void replaceSelf(Data *newInstance); 0045 0046 virtual void removeCurveFromPlots(Relation *c); // no sharedptr here 0047 0048 /** The list of plots for the current view. */ 0049 virtual QList<PlotItemInterface*> plotList() const; 0050 0051 /** Returns the number of rows in the current view's layout. 0052 * -1 if not in layout. 0053 */ 0054 virtual int rows() const; 0055 0056 /** Returns the number of columns in the given view's layout. 0057 * -1 if not in layout. 0058 */ 0059 virtual int columns() const; 0060 0061 static double AvailableMemory(); 0062 }; 0063 0064 0065 /** Bad choice for location - maybe move it later */ 0066 template<class T> 0067 bool kstrealloc(T* &ptr, size_t size) 0068 { 0069 // don't overwrite old pointer when resize fails 0070 // it doesn't free the old pointer 0071 void* newptr = qRealloc(static_cast<void*>(ptr), size); 0072 if (!newptr) 0073 return false; 0074 ptr = static_cast<T*>(newptr); 0075 return true; 0076 } 0077 0078 } 0079 0080 #endif 0081 // vim: ts=2 sw=2 et