OPAL (Object Oriented Parallel Accelerator Library)  2.2.0
OPAL
MakeDataSource.hpp
Go to the documentation of this file.
1 // -*- C++ -*-
2 /***************************************************************************
3  *
4  * The IPPL Framework
5  *
6  * This program was prepared by PSI.
7  * All rights in the program are reserved by PSI.
8  * Neither PSI nor the author(s)
9  * makes any warranty, express or implied, or assumes any liability or
10  * responsibility for the use of this software
11  *
12  * Visit www.amas.web.psi for more details
13  *
14  ***************************************************************************/
15 
16 // -*- C++ -*-
17 /***************************************************************************
18  *
19  * The IPPL Framework
20  *
21  *
22  * Visit http://people.web.psi.ch/adelmann/ for more details
23  *
24  ***************************************************************************/
25 
26 // include files
29 #include "DataSource/DataConnect.h"
30 
31 //
32 // include the connection-method-specific class headers
33 //
34 
35 // file connection method
39 
41 // a version of make_DataSourceObject for Field's.
42 // arguments: name, connection type, transfer metohd, Field
43 template<class T, unsigned Dim, class M, class C>
45 make_DataSourceObject(const char *nm, DataConnect *dc, int t,
46  Field<T,Dim,M,C>& F) {
47 
48  // get the connection method name, and make a string out of it
49  std::string method(dc->DSID());
50 
51  // find what method it is, and make the appropriate DataSourceObject
52  DataSourceObject *dso = 0;
53  if (method == "file") {
54  // create a DataSourceObject for this Field which will connect to a file
55  dso = new FileFieldDataSource<T,Dim,M,C>(nm, dc, t, F);
56  }
57 
58  // make a default connection is nothing has been found
59  if (dso == 0)
60  dso = new DataSourceObject;
61 
62  return dso;
63 }
64 
65 
67 // a version of make_DataSourceObject for ParticleAttrib's
68 template<class T>
70 make_DataSourceObject(const char *nm, DataConnect *dc, int t,
71  ParticleAttrib<T>& P) {
72 
73  // get the connection method name, and make a string out of it
74  std::string method(dc->DSID());
75 
76  DataSourceObject *dso = 0;
77  if (method == "file") {
78  // create a DataSourceObject for this ParticleAttrib which will connect to
79  // a file
80  dso = new FileParticleAttribDataSource<T>(nm, dc, t, P);
81  }
82 
83  // make a default connection is nothing has been found
84  if (dso == 0)
85  dso = new DataSourceObject;
86 
87  return dso;
88 }
89 
90 
92 // a version of make_DataSourceObject for IpplParticleBase's
93 template<class PLayout>
95 make_DataSourceObject(const char *nm, DataConnect *dc, int t,
97 
98  // get the connection method name, and make a string out of it
99  std::string method(dc->DSID());
100 
101  DataSourceObject *dso = 0;
102  if (method == "file") {
103  // create a DataSourceObject for this FILE which will connect to
104  // a file
105  dso = new FileIpplParticleBaseDataSource<PLayout>(nm, dc, t, P);
106  }
107 
108  // make a default connection is nothing has been found
109  if (dso == 0)
110  dso = new DataSourceObject;
111 
112  return dso;
113 }
114 
116 // a version of make_DataSourceObject for ScalarDataSource's
117 template<class T>
119 make_DataSourceObject(const char *nm, DataConnect *dc, int t,
120  ScalarDataSource<T>& S) {
121 
122  // get the connection method name, and make a string out of it
123  std::string method(dc->DSID());
124 
125  DataSourceObject *dso = 0;
126  if (method == "file") {
127  // create a DataSourceObject for this FILE which will connect to
128  // a file
129  }
130 
131  // make a default connection is nothing has been found
132  if (dso == 0)
133  dso = new DataSourceObject;
134 
135  return dso;
136 }
137 
138 
140 // a version of make_DataSourceObject for StringDataSource's
141 template<class T>
143 make_DataSourceObject(const char *nm, DataConnect *dc, int t,
144  StringDataSource<T>& S) {
145 
146  // get the connection method name, and make a string out of it
147  std::string method(dc->DSID());
148 
149  DataSourceObject *dso = 0;
150  if (method == "file") {
151  // create a DataSourceObject for this FILE which will connect to
152  // a file
153  }
154 
155  // make a default connection is nothing has been found
156  if (dso == 0)
157  dso = new DataSourceObject;
158 
159  return dso;
160 }
161 
162 /***************************************************************************
163  * $RCSfile: MakeDataSource.cpp,v $ $Author: adelmann $
164  * $Revision: 1.1.1.1 $ $Date: 2003/01/23 07:40:25 $
165  * IPPL_VERSION_ID: $Id: MakeDataSource.cpp,v 1.1.1.1 2003/01/23 07:40:25 adelmann Exp $
166  ***************************************************************************/
DataSourceObject * make_DataSourceObject(const char *, DataConnect *, int, Field< T, Dim, M, C > &)
const char * DSID() const
Definition: DataConnect.h:55