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_PARTICLE_ATTRIB_DATA_SOURCE_H 00012 #define FILE_PARTICLE_ATTRIB_DATA_SOURCE_H 00013 00014 /*********************************************************************** 00015 * 00016 * class FileParticleAttribDataSource 00017 * 00018 * A specific version of DataSourceObject which takes the data for 00019 * a given ParticleAttrib and writes it to a file using a DiscParticle 00020 * object. 00021 * 00022 ***********************************************************************/ 00023 00024 // include files 00025 #include "DataSource/DataSourceObject.h" 00026 #include "Particle/ParticleAttrib.h" 00027 #include "Utility/DiscParticle.h" 00028 00029 00030 template<class T> 00031 class FileParticleAttribDataSource : public DataSourceObject { 00032 00033 public: 00034 // constructor: the name, the connection, the transfer method, 00035 // the ParticleAttrib to connect 00036 FileParticleAttribDataSource(const char *, DataConnect *, int, 00037 ParticleAttrib<T> &); 00038 00039 // destructor 00040 virtual ~FileParticleAttribDataSource(); 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 DiscParticle object, which read/writes the data 00057 DiscParticle *DP; 00058 00059 // the ParticleAttrib to read into (or write from) 00060 ParticleAttrib<T> &MyParticles; 00061 00062 // the number of frames we have read or written (i.e. or current record) 00063 int counter; 00064 }; 00065 00066 #include "DataSource/FilePtclAttribDataSource.cpp" 00067 00068 #endif // FILE_PARTICLE_ATTRIB_DATA_SOURCE_H 00069 00070 /*************************************************************************** 00071 * $RCSfile: FilePtclAttribDataSource.h,v $ $Author: adelmann $ 00072 * $Revision: 1.1.1.1 $ $Date: 2003/01/23 07:40:25 $ 00073 * IPPL_VERSION_ID: $Id: FilePtclAttribDataSource.h,v 1.1.1.1 2003/01/23 07:40:25 adelmann Exp $ 00074 ***************************************************************************/