00001 // -*- C++ -*- 00002 /*************************************************************************** 00003 * 00004 * The IPPL Framework 00005 * 00006 * 00007 * Visit http://people.web.psi.ch/adelmann/ for more details 00008 * 00009 ***************************************************************************/ 00010 00011 #ifndef FILE_FIELD_DATA_SOURCE_H 00012 #define FILE_FIELD_DATA_SOURCE_H 00013 00014 /*********************************************************************** 00015 * 00016 * class FileFieldDataSource 00017 * 00018 * FileFieldDataSource is a specific version of DataSourceObject which takes 00019 * the data for a given Field and writes it to a file using a DiscField 00020 * object. 00021 * 00022 ***********************************************************************/ 00023 00024 // include files 00025 #include "DataSource/DataSourceObject.h" 00026 #include "Field/Field.h" 00027 #include "Utility/DiscField.h" 00028 00029 00030 template<class T, unsigned Dim, class M, class C> 00031 class FileFieldDataSource : public DataSourceObject { 00032 00033 public: 00034 00035 // constructor: the name, the connection, the transfer method, 00036 // the field to connect, and the parent node. 00037 FileFieldDataSource(const char *, DataConnect *, int, Field<T,Dim,M,C>&); 00038 00039 // destructor 00040 virtual ~FileFieldDataSource(); 00041 00042 // 00043 // virtual function interface. 00044 // 00045 00046 // Update the object, that is, make sure the receiver of the data has a 00047 // current and consistent snapshot of the current state. Return success. 00048 virtual bool update(); 00049 00050 // Indicate to the receiver that we're allowing them time to manipulate the 00051 // data (e.g., for a viz program, to rotate it, change representation, etc.) 00052 // This should only return when the manipulation is done. 00053 virtual void interact(const char * = 0); 00054 00055 private: 00056 // the DiscField object, which read/writes the data 00057 DiscField<Dim> *DF; 00058 00059 // the Field to read into (or write from) 00060 Field<T,Dim,M,C> &myField; 00061 00062 // which field are we in the file? 00063 int FieldID; 00064 00065 // the number of frames we have read or written (i.e. or current record) 00066 int counter; 00067 }; 00068 00069 #include "DataSource/FileFieldDataSource.cpp" 00070 00071 #endif // FILE_FIELD_DATA_SOURCE_H 00072 00073 /*************************************************************************** 00074 * $RCSfile: FileFieldDataSource.h,v $ $Author: adelmann $ 00075 * $Revision: 1.1.1.1 $ $Date: 2003/01/23 07:40:25 $ 00076 * IPPL_VERSION_ID: $Id: FileFieldDataSource.h,v 1.1.1.1 2003/01/23 07:40:25 adelmann Exp $ 00077 ***************************************************************************/