7 modified files
lcio/doc
diff -u -r1.65.2.4 -r1.65.2.5
--- lcio.xml 13 Apr 2010 10:50:14 -0000 1.65.2.4
+++ lcio.xml 28 May 2010 14:51:43 -0000 1.65.2.5
@@ -16,7 +16,7 @@
There are two types of LCIORandomAccess records
file record -- one per file, always first record on file
index record -- one or more per file, points to associated LCIOIndex record
- <block name="LCIORandomAccess" major="1" minor="0">
+ <block name="LCIORandomAccess" major="1" minor="11">
<data type="int" name="runMin"/>
<data type="int" name="eventMin"/>
<data type="int" name="runMax"/>
@@ -41,7 +41,7 @@
</block>
</record>
<record name="LCIOIndex">
- <block name="LCIOIndex" major="1" minor="0">
+ <block name="LCIOIndex" major="1" minor="11">
<data type="int" name="controlWord">
Bit 0 = single Run
Bit 1 = long offset required
lcio/sio/include
diff -u -r1.1 -r1.1.24.1
--- SIO_definitions.h 6 Mar 2003 11:01:23 -0000 1.1
+++ SIO_definitions.h 28 May 2010 14:51:43 -0000 1.1.24.1
@@ -1,5 +1,5 @@
// ----------------------------------------------------------------------------
-// CVS $Id: SIO_definitions.h,v 1.1 2003/03/06 11:01:23 gaede Exp $
+// CVS $Id: SIO_definitions.h,v 1.1.24.1 2010/05/28 14:51:43 gaede Exp $
// ----------------------------------------------------------------------------
// => Assorted definitions for the SIO package.
// ----------------------------------------------------------------------------
@@ -85,6 +85,7 @@
SIO_MODE_READ,
SIO_MODE_WRITE_NEW,
SIO_MODE_WRITE_APPEND,
+ SIO_MODE_READ_WRITE,
SIO_MODE_UNDEFINED
} SIO_stream_mode;
lcio/sio/src
diff -u -r1.7.8.3 -r1.7.8.4
--- SIO_stream.cc 30 Apr 2010 21:30:52 -0000 1.7.8.3
+++ SIO_stream.cc 28 May 2010 14:51:43 -0000 1.7.8.4
@@ -1,5 +1,5 @@
// ----------------------------------------------------------------------------
-// CVS $Id: SIO_stream.cc,v 1.7.8.3 2010/04/30 21:30:52 gaede Exp $
+// CVS $Id: SIO_stream.cc,v 1.7.8.4 2010/05/28 14:51:43 gaede Exp $
// ----------------------------------------------------------------------------
// => Controller for a single SIO stream.
// ----------------------------------------------------------------------------
@@ -454,7 +454,7 @@
z_stat;
static char
- SIO_filemode[3][3] = { "rb", "wb", "ab" };
+ SIO_filemode[4][3] = { "rb", "wb", "ab","r+" };
//
// Can't open what ain't closed!
@@ -473,17 +473,17 @@
//
// Can't open in mode undefined.
//
-if( i_mode == SIO_MODE_UNDEFINED )
-{
- if( verbosity >= SIO_ERRORS )
- {
- std::cout << "SIO: [" << name << "//] "
- << "Cannot open in mode SIO_MODE_UNDEFINED"
- << std::endl;
- }
- return( SIO_STREAM_BADMODE );
-}
-
+ if( i_mode == SIO_MODE_UNDEFINED )
+ {
+ if( verbosity >= SIO_ERRORS )
+ {
+ std::cout << "SIO: [" << name << "//] "
+ << "Cannot open in mode SIO_MODE_UNDEFINED"
+ << std::endl;
+ }
+ return( SIO_STREAM_BADMODE );
+ }
+
//
// Open the file.
//
@@ -607,19 +607,21 @@
unsigned int status;
- //
- // This must be a readable stream!
- //
- if( mode != SIO_MODE_READ ) {
+ //fg: also need the seek in 'append' mode ( delete old file record )
+// //
+// // This must be a readable stream!
+// //
+// if( mode != SIO_MODE_READ ) {
- if( verbosity >= SIO_ERRORS ) {
+// // if( verbosity >= SIO_ERRORS ) {
+// if( true ) {
- std::cout << "SIO: [" << name << "//] "
- << "Cannot seek (stream is write only)"
- << std::endl;
- }
- return( SIO_STREAM_WRITEONLY );
- }
+// std::cout << "SIO: [" << name << "//] "
+// << "Cannot seek (stream is write only)"
+// << std::endl;
+// }
+// return( SIO_STREAM_WRITEONLY );
+// }
status = FSEEK( handle, pos , whence ) ;
lcio/src/cpp/include/SIO
diff -u -r1.1.2.6 -r1.1.2.7
--- LCIORandomAccessMgr.h 26 May 2010 10:22:21 -0000 1.1.2.6
+++ LCIORandomAccessMgr.h 28 May 2010 14:51:43 -0000 1.1.2.7
@@ -32,7 +32,7 @@
*
*
* @author gaede
- * @version $Id: LCIORandomAccessMgr.h,v 1.1.2.6 2010/05/26 10:22:21 gaede Exp $
+ * @version $Id: LCIORandomAccessMgr.h,v 1.1.2.7 2010/05/28 14:51:43 gaede Exp $
*/
class LCIORandomAccessMgr {
@@ -68,7 +68,7 @@
/** Initialize random access for append mode: read last LCIORandomAccess record if it exists -
* recreate the RunEvent map from the file if not (old files).
*/
- void initAppend( SIO_stream* s) ;
+ bool initAppend( SIO_stream* s) ;
/** Write the current random access records LCIOIndex and LCIORandomAccess to the stream.
lcio/src/cpp/src/SIO
diff -u -r1.1.2.6 -r1.1.2.7
--- LCIORandomAccessMgr.cc 26 May 2010 10:22:21 -0000 1.1.2.6
+++ LCIORandomAccessMgr.cc 28 May 2010 14:51:43 -0000 1.1.2.7
@@ -189,22 +189,24 @@
}
- void LCIORandomAccessMgr::initAppend( SIO_stream* stream ) {
+ bool LCIORandomAccessMgr::initAppend( SIO_stream* stream ) {
// check if the last record is LCIORandomAccess (the file record )
if( ! readLCIORandomAccessAt( stream , -LCSIO_RANDOMACCESS_SIZE) ) {
recreateEventMap( stream ) ;
- return ;
+ return false;
}
// store the file record separately
_fileRecord = _list.back() ;
_list.pop_back() ;
- // no read first LCIORandomAccess record
+ // now read first LCIORandomAccess record
readLCIORandomAccessAt( stream , _fileRecord->_nextLocation ) ; // start of last LCIORandomAccessRecord
+
+ return true ;
}
@@ -260,8 +262,8 @@
bool LCIORandomAccessMgr::recreateEventMap( SIO_stream* stream ) {
-// std::cout << " LCIORandomAccessMgr::getEventMap() recreating event map for direct access ..."
-// << std::endl ;
+ std::cout << " LCIORandomAccessMgr::getEventMap() recreating event map for direct access (old file) ..."
+ << std::endl ;
LCSIO::seekStream( stream, 0 ) ;// go to start of file
lcio/src/cpp/src/SIO
diff -u -r1.16.4.3 -r1.16.4.4
--- LCSIO.cc 30 Apr 2010 21:30:52 -0000 1.16.4.3
+++ LCSIO.cc 28 May 2010 14:51:44 -0000 1.16.4.4
@@ -4,6 +4,7 @@
#include "SIO_stream.h"
#include "SIO_recordManager.h"
#include <cctype>
+#include <cerrno>
#include "Exceptions.h"
#include <iostream>
@@ -105,8 +106,7 @@
status = stream->seek( pos ) ;
if( status != SIO_STREAM_SUCCESS ) {
- std::stringstream s("[SIOReader::getEventMap()] Can't seek stream to ") ;
- s << pos ;
+ std::stringstream s ; s << "[LCSIO::seekStream] Can't seek stream to " << pos << " errno : " << errno ;
throw IO::IOException( s.str() ) ;
}
lcio/src/cpp/src/SIO
diff -u -r1.36.8.4 -r1.36.8.5
--- SIOWriter.cc 26 May 2010 10:22:21 -0000 1.36.8.4
+++ SIOWriter.cc 28 May 2010 14:51:44 -0000 1.36.8.5
@@ -153,15 +153,20 @@
throw IOException( std::string( "[SIOWriter::open()] Can't open stream for reading TOC: "
+ sioFilename ) ) ;
- _raMgr.initAppend( _stream ) ;
+ bool hasRandomAccess = _raMgr.initAppend( _stream ) ;
+
+ _stream->close() ;
- _stream->close() ;
+ if( hasRandomAccess ) {
+ status = _stream->open( sioFilename.c_str() , SIO_MODE_READ_WRITE ) ; // SIO_MODE_WRITE_APPEND ) ;
+ // position at the beginnning of the file record which will then be overwritten with the next record ...
+ LCSIO::seekStream( _stream, -LCSIO_RANDOMACCESS_SIZE ) ;
+ } else {
- // --- open the file in append mode
- status = _stream->open( sioFilename.c_str() , SIO_MODE_WRITE_APPEND ) ;
+ // --- old files: ll simjopen the file in append mode
+ status = _stream->open( sioFilename.c_str() , SIO_MODE_WRITE_APPEND ) ;
- // the file record will be overwritten with the next record ...
- // LCSIO::seekStream( _stream, -LCSIO_RANDOMACCESS_SIZE ) ;
+ }
break ;
}
CVSspam 0.2.8