OPAL (Object Oriented Parallel Accelerator Library)  2.2.0
OPAL
FileDataConnect.h
Go to the documentation of this file.
1 // -*- C++ -*-
2 /***************************************************************************
3  *
4  * The IPPL Framework
5  *
6  *
7  * Visit http://people.web.psi.ch/adelmann/ for more details
8  *
9  ***************************************************************************/
10 
11 #ifndef FILE_DATA_CONNECT_H
12 #define FILE_DATA_CONNECT_H
13 
14 /***********************************************************************
15  *
16  * FileDataConnect represents a single connection to a parallel datafile
17  * object (such as DiskField)
18  *
19  ***********************************************************************/
20 
21 // include files
22 #include "DataSource/DataConnect.h"
23 
24 
25 class FileDataConnect : public DataConnect {
26 
27 public:
28  // constructor: file name, items in the file, typestring, nodes
29  FileDataConnect(const char *nm, unsigned int numobjs = 1, const char *ts = 0,
30  int n = 0)
31  : DataConnect(nm, "file", DataSource::OUTPUT, n), NumObjects(numobjs) {
32  if (ts == 0)
33  TypeString = "unknown";
34  else
35  TypeString = ts;
36  }
37 
38  // destructor: shut down the connection
39  virtual ~FileDataConnect() {}
40 
41  //
42  // methods specific to this type of DataConnect
43  //
44 
45  // return number of objects that this file should hold
46  unsigned int getNumObjects() const { return NumObjects; }
47 
48  // return the type string for this file
49  const char* getTypeString() const { return TypeString.c_str(); }
50 
51  //
52  // DataConnect virtual methods
53  //
54 
55  // are we currently connected to a receiver?
56  virtual bool connected() const { return true; }
57 
58 private:
59  // number of objects in the file, and a type string
60  unsigned int NumObjects;
61  std::string TypeString;
62 };
63 
64 #endif // FILE_DATA_CONNECT_H
65 
66 /***************************************************************************
67  * $RCSfile: FileDataConnect.h,v $ $Author: adelmann $
68  * $Revision: 1.1.1.1 $ $Date: 2003/01/23 07:40:25 $
69  * IPPL_VERSION_ID: $Id: FileDataConnect.h,v 1.1.1.1 2003/01/23 07:40:25 adelmann Exp $
70  ***************************************************************************/
unsigned int NumObjects
std::string TypeString
const char * getTypeString() const
virtual bool connected() const
FileDataConnect(const char *nm, unsigned int numobjs=1, const char *ts=0, int n=0)
virtual ~FileDataConnect()
unsigned int getNumObjects() const