File indexing completed on 2024-12-22 04:17:24
0001 /*************************************************************************** 0002 vscalar.h - a scalar from a sample of a vector field 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 VSCALAR_H 0019 #define VSCALAR_H 0020 0021 #include "scalar.h" 0022 #include "datasource.h" 0023 #include "kst_export.h" 0024 0025 class QXmlStreamWriter; 0026 0027 namespace Kst { 0028 0029 /**A class for handling vector scalars for kst. 0030 *@author cbn 0031 */ 0032 0033 /** A scalar which gets its value from a vector field in a data file. */ 0034 class KSTCORE_EXPORT VScalar : public Scalar, public DataPrimitive { 0035 Q_OBJECT 0036 0037 protected: 0038 VScalar(ObjectStore *store); 0039 friend class ObjectStore; 0040 0041 virtual QString _automaticDescriptiveName() const; 0042 0043 virtual qint64 minInputSerial() const; 0044 virtual qint64 maxInputSerialOfLastChange() const; 0045 0046 public: 0047 virtual ~VScalar(); 0048 0049 /** Update the scalar. */ 0050 virtual void internalUpdate(); 0051 0052 virtual const QString& typeString() const; 0053 static const QString staticTypeString; 0054 static const QString staticTypeTag; 0055 0056 /** change the properties of a VScalar */ 0057 void change(DataSourcePtr file, const QString &field, int f0); 0058 void changeFile(DataSourcePtr file); 0059 void changeFrame(int in_f0) {_f0 = in_f0;} 0060 0061 /** return the name of the file */ 0062 QString filename() const; 0063 0064 /** return the field name */ 0065 const QString& field() const; 0066 0067 /** return sample number */ 0068 int F0() const; 0069 0070 /** return file length */ 0071 int fileLength(); 0072 0073 /** Save scalar information */ 0074 virtual void save(QXmlStreamWriter &s); 0075 0076 virtual QString descriptionTip() const; 0077 0078 /** return true if it has a valid file and field, or false otherwise */ 0079 bool isValid() const; 0080 0081 virtual QString propertyString() const; 0082 0083 virtual ScriptInterface* createScriptInterface(); 0084 0085 /** make a copy of the VScalar */ 0086 virtual PrimitivePtr makeDuplicate() const; 0087 virtual bool checkValidity(const DataSourcePtr& ds) const; 0088 private: 0089 /** For the scalar field in the data source */ 0090 //QString _field; 0091 0092 int _f0; 0093 0094 0095 }; 0096 0097 typedef SharedPtr<VScalar> VScalarPtr; 0098 typedef ObjectList<VScalar> VScalarList; 0099 0100 } 0101 0102 #endif 0103 // vim: ts=2 sw=2 et