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 PARTICLE_ATTRIB_DATA_SOURCE_H 00012 #define PARTICLE_ATTRIB_DATA_SOURCE_H 00013 00014 /*********************************************************************** 00015 * 00016 * class ParticleAttribDataSource 00017 * 00018 * ParticleAttribDataSource is a base class for classes which 00019 * provides functionality needed to have the attributes check to see if 00020 * their associated ParticleBase has been previously connected, and if so, 00021 * to add this object to the list of connected attributes for that 00022 * ParticleBase. This also provides virtual functions for transmitting 00023 * and receiving attribute data from other nodes. 00024 * 00025 ***********************************************************************/ 00026 00027 // include files 00028 #include "DataSource/DataSourceObject.h" 00029 #include "Message/Message.h" 00030 00031 00032 // forward declarations 00033 class ParticleBaseDataSource; 00034 class ParticleAttribBase; 00035 class DataSource; 00036 00037 00038 class ParticleAttribDataSource : public DataSourceObject { 00039 00040 public: 00041 // constructor: the name, the connection, the transfer method, the attrib 00042 ParticleAttribDataSource(const char *, DataConnect *, int, 00043 ParticleAttribBase *, DataSource *); 00044 00045 // destructor 00046 virtual ~ParticleAttribDataSource(); 00047 00048 // tell this attribute we're disconnecting it 00049 void setDisconnected() { PBase = 0; } 00050 00051 // 00052 // ParticleAttribDataSource virtual functions 00053 // 00054 00055 // retrieve the agency-specific data structure 00056 virtual void *getConnectStorage() { return 0; } 00057 00058 // copy attrib data on the local processor into the given Message. 00059 virtual void putMessage(Message *) = 0; 00060 00061 // prepare the agency-specific data structures for update; this may 00062 // require reallocation of storage memory, etc. 00063 // Argument = are we at the start (true) or end (false) of the data update; 00064 // # of particles to prepare for. 00065 virtual void prepare_data(bool, unsigned) = 0; 00066 00067 // take data for N particles out of the given message, and put it 00068 // into the proper agency-specific structure. 00069 // If the Message pointer is 0, put in the locally-stored particles. 00070 // Arguments: num particles, 00071 // starting index for inserted particles, Message containing 00072 // particles 00073 virtual void insert_data(unsigned, unsigned, Message *) = 0; 00074 00075 protected: 00076 // container holding our particle base ... used for disconnection 00077 ParticleBaseDataSource *PBase; 00078 }; 00079 00080 00081 #endif // PARTICLE_ATTRIB_DATA_SOURCE_H 00082 00083 /*************************************************************************** 00084 * $RCSfile: PtclAttribDataSource.h,v $ $Author: adelmann $ 00085 * $Revision: 1.1.1.1 $ $Date: 2003/01/23 07:40:25 $ 00086 * IPPL_VERSION_ID: $Id: PtclAttribDataSource.h,v 1.1.1.1 2003/01/23 07:40:25 adelmann Exp $ 00087 ***************************************************************************/