File: XdmfHeavyData.h

package info (click to toggle)
vtk6 6.1.0+dfsg2-6
  • links: PTS, VCS
  • area: main
  • in suites: jessie, jessie-kfreebsd
  • size: 165,164 kB
  • ctags: 226,428
  • sloc: cpp: 1,354,490; ansic: 730,748; python: 227,134; tcl: 48,285; xml: 8,290; yacc: 4,832; java: 3,827; perl: 3,108; lex: 1,809; sh: 1,437; asm: 471; makefile: 229
file content (186 lines) | stat: -rw-r--r-- 6,144 bytes parent folder | download | duplicates (6)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
/*******************************************************************/
/*                               XDMF                              */
/*                   eXtensible Data Model and Format              */
/*                                                                 */
/*  Id : Id  */
/*  Date : $Date$ */
/*  Version : $Revision$ */
/*                                                                 */
/*  Author:                                                        */
/*     Jerry A. Clarke                                             */
/*     clarke@arl.army.mil                                         */
/*     US Army Research Laboratory                                 */
/*     Aberdeen Proving Ground, MD                                 */
/*                                                                 */
/*     Copyright @ 2002 US Army Research Laboratory                */
/*     All Rights Reserved                                         */
/*     See Copyright.txt or http://www.arl.hpc.mil/ice for details */
/*                                                                 */
/*     This software is distributed WITHOUT ANY WARRANTY; without  */
/*     even the implied warranty of MERCHANTABILITY or FITNESS     */
/*     FOR A PARTICULAR PURPOSE.  See the above copyright notice   */
/*     for more information.                                       */
/*                                                                 */
/*******************************************************************/
#ifndef __XdmfHeavyData_h
#define __XdmfHeavyData_h

#include "XdmfArray.h"

class XdmfOpenCallback;
class XdmfReadCallback;
class XdmfWriteCallback;
class XdmfCloseCallback;

//! Container class for Heavy Data Access
/*!
This is an abstract convenience object for reading and writing
HeavyData Files. 
Datasets in HeavyDat are specified by :
\verbatim
  Domain:Filename:Pathname
where
  Domain = NDGM | FILE | CORE | GASS
    if Domain is not specified,
    FILE is assumed
  Filename = UNIX style Pathname of HeavyDat file
  Pathname = HeavyData Pathname inside HeavyData File
\endverbatim
*/
class XDMF_EXPORT XdmfHeavyData : public XdmfDataDesc {

public:
  XdmfHeavyData();
  ~XdmfHeavyData();

  XdmfConstString GetClassName() { return ( "XdmfHeavyData" ) ; };

//! Get the default NDGM Host for NDGM:File:/Dataset
        XdmfGetValueMacro(NdgmHost, XdmfConstString);
//! Set the default NDGM Host for NDGM:File:/Dataset
        void SetNdgmHost( XdmfConstString String ) { strcpy( this->NdgmHost, String ); }

//! Get the default Pathname for File:/Dataset
        XdmfGetValueMacro(WorkingDirectory, XdmfConstString);
//! Set the default Pathname for File:/Dataset
        void SetWorkingDirectory( XdmfConstString String );


//! Get the current domain
  XdmfGetValueMacro(Domain, XdmfConstString);
//! Set the current domain
  void SetDomain( XdmfConstString domain ) {
    strcpy( this->Domain, domain );
    } ;

//! Get the current filename
  XdmfGetValueMacro(FileName, XdmfConstString);
//! Set the current filename
  void SetFileName( XdmfConstString File );

//! Get the current HeavyData Dataset path
  XdmfGetValueMacro(Path, XdmfConstString);
//! Set the current HeavyData Dataset path
  void SetPath( XdmfConstString path ) {
    strcpy( this->Path, path );
    } ;

/*!
Get the current read/write access
values can be :
  "r"
  "w"
  "rw"
*/
  XdmfGetValueMacro(Access, XdmfConstString);
//! Set the access permissions
  void SetAccess( XdmfConstString access ) {
    strcpy( this->Access, access );
    } ;

  //-- public interface functions for manipulating heavy data --//

  /// Open a heavy dataset for reading or writing.
  XdmfInt32 Open( XdmfConstString name = NULL, XdmfConstString access = NULL );
  /// Read an array from a heavy dataset.
  XdmfArray* Read( XdmfArray* array = NULL );
  /// Write to the heavy dataset that is currently open.
  XdmfInt32 Write( XdmfArray* array );
  /// Close a heavy dataset.
  XdmfInt32 Close();

  //-- Implementation Functions for manipulating heavy data --//

  /// Virtual function to define the implementation of Open.
  virtual XdmfInt32 DoOpen( XdmfConstString name, XdmfConstString access );
  /// Virtual function to define the implementation of Read.
  virtual XdmfArray* DoRead( XdmfArray* array );
  /// Virtual function to define the implementation of Write.
  virtual XdmfInt32 DoWrite( XdmfArray* array );
  /// Virtual function to define the implementation of Close
  virtual XdmfInt32 DoClose();

  void setOpenCallback( XdmfOpenCallback* cb );
  void setReadCallback( XdmfReadCallback* cb );
  void setWriteCallback( XdmfWriteCallback* cb );
  void setCloseCallback( XdmfCloseCallback* cb );
  

protected:
  char    NdgmHost[XDMF_MAX_STRING_LENGTH];
  XdmfString WorkingDirectory;
  char    Access[XDMF_MAX_STRING_LENGTH];
  char    Domain[XDMF_MAX_STRING_LENGTH];
  XdmfString FileName;
  char    Path[XDMF_MAX_STRING_LENGTH];

  XdmfOpenCallback* mOpenCB;
  XdmfReadCallback* mReadCB;
  XdmfWriteCallback* mWriteCB;
  XdmfCloseCallback* mCloseCB;
};

/// Callback function to decorate opening a heavy dataset.
class XdmfOpenCallback {
    public :
  virtual XdmfInt32 DoOpen( 
    XdmfHeavyData* ds, 
    XdmfConstString name,
    XdmfConstString access )
  {
    return ds->DoOpen( name, access );
  }
};

/// Callback function to decorate reading a heavy dataset.
class XdmfReadCallback {
    public :
  virtual XdmfArray* DoRead( XdmfHeavyData* ds, XdmfArray* array ) {
    return ds->DoRead( array );
  }
};

/// Callback function to decorate writing a heavy dataset.
class XdmfWriteCallback {
    public :
  virtual XdmfInt32 DoWrite( XdmfHeavyData* ds, XdmfArray* array ) {
    return ds->DoWrite( array );
  }
};

/// Callback function to decorate closing a heavy dataset.
class XdmfCloseCallback {
    public :
  virtual XdmfInt32 DoClose( XdmfHeavyData* ds ) {
    return ds->DoClose();
  }
};

/*
extern "C" {
extern XdmfString XdmfGetNdgmEntries( void );
extern void XdmfDeleteAllNdgmEntries( void );
extern XdmfInt64 XdmfAddNdgmEntry( XdmfString Name, XdmfInt64 Length );
  }
*/
#endif // __XdmfHeavyData_h