43 |
|
#endif |
44 |
|
|
45 |
|
namespace oopse { |
46 |
< |
using namespace std; |
46 |
> |
|
47 |
|
/** |
48 |
|
* @class basic_ifstrstream basic_ifstrstream.hpp "io/basic_ifstrstream.hpp" |
49 |
< |
* @brief class provides a stream interface to read data from files. |
49 |
> |
* @brief basic_ifstrstream class provides a stream interface to read data from files. |
50 |
|
* <p>In single mode, it falls back to ifstream. Don't need to read the whole file into memory. |
51 |
|
* In parallel mode, the master node will read the whole file and brocast it to other slave nodes. |
52 |
|
* After brocasting, every node will fall back to stringstream.</p> |
81 |
|
typedef basic_filebuf<_CharT, _Traits> _Buf; |
82 |
|
#endif |
83 |
|
|
84 |
< |
static const int FileNoExists = -1; |
84 |
> |
static const int FileNotExists = -1; |
85 |
|
static const int FileIOError = -2; |
86 |
|
|
87 |
|
public: |
266 |
|
fin.close(); |
267 |
|
delete fbuf; |
268 |
|
}else{ |
269 |
< |
fileSize = FileNoExists; |
269 |
> |
fileSize = FileNotExists; |
270 |
|
commStatus = MPI_Bcast(&fileSize, 1, MPI_LONG, masterNode, MPI_COMM_WORLD); |
271 |
|
return false; |
272 |
|
} |
273 |
|
|
274 |
< |
} else{ |
274 |
> |
} else{ //slave nodes |
275 |
> |
|
276 |
|
//check file name |
277 |
|
if (checkFilename) { |
278 |
|
commStatus = MPI_Bcast(&filenameLen, 1, MPI_INT, masterNode, MPI_COMM_WORLD); |
312 |
|
|
313 |
|
delete fbuf; |
314 |
|
|
315 |
< |
} else if (fileSize == FileNoExists ) { |
315 |
> |
} else if (fileSize == FileNotExists ) { |
316 |
|
return false; |
317 |
|
|
318 |
|
} else if (fileSize == FileIOError ) { |