OPAL (Object Oriented Parallel Accelerator Library)  2.2.0
OPAL
DataConnectCreator.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 DATA_CONNECT_CREATOR_H
12 #define DATA_CONNECT_CREATOR_H
13 
14 /***********************************************************************
15  *
16  * DataConnectCreator is a factory class which is used to create specific
17  * subclasses of the base class DataConnect. To create a new, agency-
18  * specific DataConnect, the user can either instantiate such a class
19  * directly, or they can call the static method
20  * DataConnectCreator::create(DataConnectCreator::CreateMethod, char *name,
21  * DataConnectCreator::TransferMethod)
22  * There is also a static method 'create' which does not take a CreateMethod
23  * argument, instead it will use a 'default' value. In the IPPL Framework,
24  * this default value is set by the IpplInfo object based on the command
25  * line arguments.
26  *
27  ***********************************************************************/
28 
29 
30 // forward declarations
31 class DataConnect;
32 
33 
34 // class definition
36 
37 public:
38  // constructor and destructor
41 
42  //
43  // informative methods
44  //
45 
46  // return the number of connection methods available
47  static int getNumMethods();
48 
49  // return the name of the Nth method
50  static const char *getMethodName(int);
51 
52  // return a list of all the methods, as a single string
53  static const char *getAllMethodNames();
54 
55  // return the current 'default' connection method
56  static int getDefaultMethod() {
57  return DefaultMethod;
58  }
59 
60  // return the current 'default' connection method name
61  static const char *getDefaultMethodName() {
63  }
64 
65  // is the given method available here?
66  static bool supported(int);
67  static bool supported(const char *nm);
68 
69  // is the given method name one we recognize?
70  static bool known(int);
71  static bool known(const char *nm);
72 
73  //
74  // DataConnect create methods
75  //
76 
77  // create a new connection. Arguments = type, name, nodes
78  static DataConnect *create(int, const char *, int = 0);
79 
80  // create a new connection, by giving the method name (nm1), the name
81  // for the new connection (nm2), and the number of nodes
82  static DataConnect *create(const char *nm1, const char *nm2, int n = 0) {
83  return create(libindex(nm1), nm2, n);
84  }
85 
86  // also create a new connection, but use the 'default' connection method.
87  static DataConnect *create(const char *nm, int n = 0) {
88  return create(DefaultMethod, nm, n);
89  }
90 
91  // a final method for creating objects; this one provides a default name,
92  // and if the default connection object has already been created, this just
93  // returns that one.
94  static DataConnect *create();
95 
96  //
97  // DataConnectCreator manipulation methods
98  //
99 
100  // change the default connection method. Return success.
101  static bool setDefaultMethod(int);
102 
103  // change the default connection method by specifying a name. Return
104  // success.
105  static bool setDefaultMethod(const char *nm) {
106  return setDefaultMethod(libindex(nm));
107  }
108 
109  // change the default number of nodes to use for the connection
110  static void setDefaultNodes(int);
111 
112  // return the default number of nodes to use in a connection
113  static int getDefaultNodes();
114 
115 private:
116  // default connection method
117  static int DefaultMethod;
118 
119  // default connection, if it has been created yet
121 
122  // how many instances of this class exist?
123  static int InstanceCount;
124 
125  // default number of nodes to use in the connection ... some connections
126  // may not care about this
127  static int ConnectNodes;
128 
129  // return the index of the given named method, or (-1) if not found
130  static int libindex(const char *);
131 };
132 
133 #endif // DATA_CONNECT_CREATOR_H
134 
135 /***************************************************************************
136  * $RCSfile: DataConnectCreator.h,v $ $Author: adelmann $
137  * $Revision: 1.1.1.1 $ $Date: 2003/01/23 07:40:24 $
138  * IPPL_VERSION_ID: $Id: DataConnectCreator.h,v 1.1.1.1 2003/01/23 07:40:24 adelmann Exp $
139  ***************************************************************************/
static bool known(int)
static bool setDefaultMethod(int)
static const char * getMethodName(int)
static void setDefaultNodes(int)
static bool supported(int)
static DataConnect * create()
static const char * getAllMethodNames()
static DataConnect * create(const char *nm1, const char *nm2, int n=0)
static DataConnect * create(const char *nm, int n=0)
static const char * getDefaultMethodName()
static int getDefaultMethod()
static bool setDefaultMethod(const char *nm)
static int libindex(const char *)
static DataConnect * DefaultConnection