OPAL (Object Oriented Parallel Accelerator Library)
2.2.0
OPAL
Main Page
Related Pages
Modules
Namespaces
Classes
Files
File List
File Members
ippl
src
DataSource
DataSourceObject.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_SOURCE_OBJECT_H
12
#define DATA_SOURCE_OBJECT_H
13
14
/***********************************************************************
15
*
16
* DataSourceObject is used basically as a type-independent interface
17
* to store the specific object which is being connected with a receiver,
18
* and to provide the actual implementations of the interface functions
19
* described above. These are implemented in DataSourceObject as virtual
20
* functions; a specific, derived version of DataSourceObject for the
21
* different types of objects to connect (e.g. Field or ParticleAttrib)
22
* must be given to the constructor of DataSource. The specific
23
* implementation (a class derived from DataSourceObject) must also be
24
* customized to the type of data receivers, or
25
* another external program or an API within the same process.
26
*
27
* While a single DataSource may be connected to several DataConnect's, and
28
* a DataConnect may have several DataSource objects connected to it, there
29
* is exactly one DataSourceObject per DataSource <---> DataConnect pair.
30
* This class carries out the actual work to tranfer the data for one data
31
* object from a sender to a receiver.
32
*
33
* The def type of data source to use for a particular invocation of a IPPL
34
* application is selected via a command-line option; the IpplInfo class
35
* will save this information, which is used by the templated global
36
* function 'make_DataSourceObject'. There should be a version of this
37
* function provided for each type of object in IPPL we want to connect,
38
* basically Field's and ParticleAttrib's.
39
*
40
***********************************************************************/
41
42
// include files
43
#include "
DataSource/DataSource.h
"
44
#include "
Utility/NamedObj.h
"
45
46
// forward declarations
47
class
DataConnect
;
48
49
50
// The interface class for objects we wish to connect to other agencies.
51
// The function 'make_DataSourceObject' in DataSource/MakeDataSource.h will
52
// create the proper subclass of this object, for use by DataSource.
53
class
DataSourceObject
:
public
NamedObj
{
54
55
public
:
56
// Constructor
57
DataSourceObject
(
const
char
*nm,
DataSource
*ds,
DataConnect
*dc,
int
tm)
58
:
NamedObj
(nm),
Connection
(dc),
Source
(ds),
TransferMethod
(tm) { }
59
60
// Default constructor
61
DataSourceObject
()
62
:
Connection
(0),
Source
(0),
TransferMethod
(
DataSource
::OUTPUT) { }
63
64
// Destructor: make it virtual, but it does nothing.
65
virtual
~DataSourceObject
() { }
66
67
// are we currently connected?
68
bool
connected
()
const
{
return
(
Connection
!= 0 &&
Source
!= 0); }
69
70
// who are we connected to?
71
DataConnect
*
getConnection
() {
return
Connection
; }
72
73
// who are we connected from?
74
DataSource
*
getSource
() {
return
Source
; }
75
76
//
77
//
78
// virtual function interface. The default versions of these objects
79
// do nothing, so that we can have a default behavior. Note that the
80
// 'connect' and 'disconnect' functionality should be implemented in the
81
// derived classes constructor and destructor, respectively.
82
//
83
84
// Update the object, that is, make sure the receiver of the data has a
85
// current and consistent snapshot of the current state. Return success.
86
virtual
bool
update
() {
return
false
; }
87
88
// Indicate to the receiver that we're allowing them time to manipulate the
89
// data (e.g., for a viz program, to rotate it, change representation, etc.)
90
// This should only return when the manipulation is done.
91
// Optionally, a string can be passed on to the connection, possibly for
92
// use as an interactive command.
93
virtual
void
interact
(
const
char
* = 0) { }
94
95
protected
:
96
// our current connection ... if the connection was not successful, this
97
// should be set to 0
98
DataConnect
*
Connection
;
99
100
// our current source ... if the connection was not successful, this
101
// should be set to 0
102
DataSource
*
Source
;
103
104
// our transfer method, as requested by the user ... some subclasses may
105
// not support all types of transfer, if the user asks for one which is
106
// not supported, the connection should fail
107
int
TransferMethod
;
108
};
109
110
#endif // DATA_SOURCE_OBJECT_H
111
112
/***************************************************************************
113
* $RCSfile: DataSourceObject.h,v $ $Author: adelmann $
114
* $Revision: 1.1.1.1 $ $Date: 2003/01/23 07:40:25 $
115
* IPPL_VERSION_ID: $Id: DataSourceObject.h,v 1.1.1.1 2003/01/23 07:40:25 adelmann Exp $
116
***************************************************************************/
DataSourceObject::interact
virtual void interact(const char *=0)
Definition:
DataSourceObject.h:93
Source
Definition:
Source.h:12
DataSourceObject::Source
DataSource * Source
Definition:
DataSourceObject.h:102
DataSourceObject
Definition:
DataSourceObject.h:53
DataSourceObject::getConnection
DataConnect * getConnection()
Definition:
DataSourceObject.h:71
DataSourceObject::Connection
DataConnect * Connection
Definition:
DataSourceObject.h:98
DataSourceObject::DataSourceObject
DataSourceObject(const char *nm, DataSource *ds, DataConnect *dc, int tm)
Definition:
DataSourceObject.h:57
DataSourceObject::DataSourceObject
DataSourceObject()
Definition:
DataSourceObject.h:61
DataSource
Definition:
DataSource.h:56
DataSourceObject::~DataSourceObject
virtual ~DataSourceObject()
Definition:
DataSourceObject.h:65
DataSourceObject::connected
bool connected() const
Definition:
DataSourceObject.h:68
DataConnect
Definition:
DataConnect.h:32
DataSource.h
NamedObj
Definition:
NamedObj.h:25
NamedObj.h
DataSourceObject::getSource
DataSource * getSource()
Definition:
DataSourceObject.h:74
DataSourceObject::TransferMethod
int TransferMethod
Definition:
DataSourceObject.h:107
DataSourceObject::update
virtual bool update()
Definition:
DataSourceObject.h:86
Generated on Sat Jan 4 2020 14:47:34 for OPAL (Object Oriented Parallel Accelerator Library) by
1.8.5