File indexing completed on 2024-12-22 04:17:18
0001 /*************************************************************************** 0002 datastscalar.h - a scalar from a data source 0003 ------------------- 0004 begin : September, 2008 0005 copyright : (C) 2008 by cbn 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 DATASCALAR_H 0019 #define DATASCALAR_H 0020 0021 #include "kst_export.h" 0022 #include "dataprimitive.h" 0023 #include "scalar.h" 0024 0025 class QXmlStreamWriter; 0026 0027 namespace Kst { 0028 0029 /**A class for handling data scalars for kst. 0030 *@author cbn 0031 */ 0032 0033 /** A scalar which gets its value from a data file. */ 0034 class KSTCORE_EXPORT DataScalar : public Scalar, public DataPrimitive 0035 { 0036 Q_OBJECT 0037 0038 protected: 0039 DataScalar(ObjectStore *store); 0040 friend class ObjectStore; 0041 0042 virtual QString _automaticDescriptiveName() const; 0043 0044 /** Update the scalar.*/ 0045 virtual qint64 minInputSerial() const; 0046 virtual qint64 maxInputSerialOfLastChange() const; 0047 0048 0049 public: 0050 virtual ~DataScalar(); 0051 0052 struct ReadInfo { 0053 ReadInfo(double* d) : value(d) {} 0054 double* value; 0055 }; 0056 0057 struct DataInfo { 0058 }; 0059 0060 virtual void internalUpdate(); 0061 virtual const QString& typeString() const; 0062 static const QString staticTypeString; 0063 static const QString staticTypeTag; 0064 0065 /** change the properties of a DataScalar */ 0066 void change(DataSourcePtr file, const QString &field); 0067 void changeFile(DataSourcePtr file); 0068 0069 /** Save scalar information */ 0070 virtual void save(QXmlStreamWriter &s); 0071 0072 virtual QString descriptionTip() const; 0073 0074 virtual QString propertyString() const; 0075 bool isValid() const; 0076 0077 virtual void reset(); 0078 void reload(); 0079 0080 virtual ScriptInterface* createScriptInterface(); 0081 0082 private: 0083 /** make a copy of the DataScalar */ 0084 virtual PrimitivePtr makeDuplicate() const; 0085 virtual bool checkValidity(const DataSourcePtr& ds) const; 0086 }; 0087 0088 typedef SharedPtr<DataScalar> DataScalarPtr; 0089 typedef ObjectList<DataScalar> DataScalarList; 0090 0091 } 0092 0093 #endif 0094 // vim: ts=2 sw=2 et