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 SCALAR_DATA_SOURCE_H 00012 #define SCALAR_DATA_SOURCE_H 00013 00014 /*********************************************************************** 00015 * 00016 * ScalarDataSource is a DataSource for scalars. 00017 * It makes a scalar available for another program or data processing 00018 * API (e.g., visualization) through the DataSource API. 00019 * 00020 ***********************************************************************/ 00021 00022 // include files 00023 #include "DataSource/DataSource.h" 00024 00025 // forward declarations 00026 class DataSourceObject; 00027 class DataConnect; 00028 00029 // A DataSource class for handling scalars 00030 template<class T> 00031 class ScalarDataSource : public DataSource { 00032 00033 public: 00034 // constructor 00035 ScalarDataSource(T& S) : MyScalar(S) {}; 00036 00037 // destructor 00038 virtual ~ScalarDataSource() { } 00039 00040 // Return ptr to Scalar 00041 T& scalarRef() { return MyScalar; } 00042 00043 protected: 00044 // a virtual function which is called by this base class to get a 00045 // specific instance of DataSourceObject based on the type of data 00046 // and the connection method (the argument to the call). 00047 DataSourceObject *createDataSourceObject(const char *, 00048 DataConnect *, 00049 int); 00050 00051 private: 00052 // The scalar 00053 T& MyScalar; 00054 }; 00055 00056 #include "DataSource/ScalarDataSource.cpp" 00057 00058 #endif // SCALAR_DATA_SOURCE_H 00059 00060 /*************************************************************************** 00061 * $RCSfile: ScalarDataSource.h,v $ $Author: adelmann $ 00062 * $Revision: 1.1.1.1 $ $Date: 2003/01/23 07:40:25 $ 00063 * IPPL_VERSION_ID: $Id: ScalarDataSource.h,v 1.1.1.1 2003/01/23 07:40:25 adelmann Exp $ 00064 ***************************************************************************/