Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove dynamic exceptions from files (#2) #43

Merged
merged 2 commits into from
Jan 10, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .travis-ci.d/compile_and_test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,6 @@ cd /Package
mkdir build
cd build
cmake -GNinja -DUSE_CXX11=ON -DBUILD_ROOTDICT=ON -DCMAKE_CXX_FLAGS="-fdiagnostics-color=always" .. && \
ninja && \
ninja -k 0 && \
ninja install && \
ctest --output-on-failure
1 change: 1 addition & 0 deletions cmake/lcio_namespaces.h.in
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
#include "EVENT/LCIO.h"
#include "IOIMPL/LCFactory.h"
#include "IMPL/LCIOExceptionHandler.h"
#include "Exceptions.h"


/** \mainpage <a href="http://lcio.desy.de">LCIO</a> (v@LCIO_VERSION_MAJOR@-@LCIO_VERSION_MINOR@-@LCIO_VERSION_PATCH@)
Expand Down
9 changes: 8 additions & 1 deletion src/aid/EVENT/LCCollection.aid
Original file line number Diff line number Diff line change
Expand Up @@ -83,15 +83,22 @@ public interface LCCollection
*
* @throws ReadOnlyException
*/
@ifdef cpp
public void addElement(LCObject* obj) ;
@else
public void addElement(LCObject* obj) throws ReadOnlyException ;
@endif

/** Removes the i-th element from the collection. Throws an exception
* if the collection (event) is 'read only'.
*
* @throws ReadOnlyException
*/
@ifdef cpp
public void removeElementAt(int i) ;
@else
public void removeElementAt(int i) throws ReadOnlyException ;
@endif


/** Set the flag word. This is allowed in 'read only' mode.
Expand Down
21 changes: 17 additions & 4 deletions src/aid/EVENT/LCEvent.aid
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,11 @@ public interface LCEvent {
*
* @throws DataNotAvailableException
*/
public LCCollection* getCollection(const String& name) const throws DataNotAvailableException ;
@ifdef cpp
public LCCollection* getCollection(const String& name) const ;
@else
public LCCollection* getCollection(const String& name) const throws DataNotAvailableException ;
@endif

@ifdef cpp
/** Returns the collection for the given name and transfers the ownership of the collection
Expand All @@ -57,7 +61,7 @@ public interface LCEvent {
* Use with care!
* @throws DataNotAvailableException
*/
public LCCollection* takeCollection(const String& name) const throws DataNotAvailableException ;
public LCCollection* takeCollection(const String& name) const ;
@endif

/** Adds a collection with the given name (has to be a valid C/C++ variable name).
Expand All @@ -66,15 +70,24 @@ public interface LCEvent {
*
*@see validateCollectionName
*@throws EventException
*/
*/
@ifdef cpp
public void addCollection(LCCollection* col ,const String& name ) ;
@else
public void addCollection(LCCollection* col ,const String& name ) throws EventException ;
@endif


/** Removes (and deletes) the collection with name (if it exists in the event).
* Throws an exception if the event is 'read only' as defined by the read mode in LCReader.
*
*@throws ReadOnlyException
*/
*/
@ifdef cpp
public void removeCollection(const String& name ) ;
@else
public void removeCollection(const String& name ) throws ReadOnlyException ;
@endif

/** Parameters defined for this event.
*/
Expand Down
63 changes: 61 additions & 2 deletions src/aid/IO/LCReader.aid
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,12 @@ public interface LCReader {
*
* @throws IOException
*/
@ifdef cpp
public void open(const String& filename) ;
@else
public void open(const String& filename) throws IOException ;
@endif



/** Opens a list of files for reading (read-only). All subsequent
Expand All @@ -34,50 +39,72 @@ public interface LCReader {
*
* @throws IOException
*/
@ifdef cpp
public void open(const String[]& filenames) ;
@else
public void open(const String[]& filenames) throws IOException ;
@endif



/** Reads the next run header from the file. Returns NULL if
* 'EOF' read.
*
* @throws IOException
*/
@ifdef cpp
public LCRunHeader* readNextRunHeader() ;
@else
public LCRunHeader* readNextRunHeader() throws IOException ;
@endif

/** Same as readNextRunHeader() but allows to set the access mode
* LCIO::READ_ONLY (default) or LCIO::Update.
*
* @throws IOException
*/
@ifdef cpp
public LCRunHeader* readNextRunHeader(int accessMode) ;
@else
public LCRunHeader* readNextRunHeader(int accessMode) throws IOException ;
@endif

/** Reads the next event from the file. Returns NULL if
* 'EOF' read.
*
* @throws IOException
*/
@ifdef cpp
public LCEvent* readNextEvent() ;
@else
public LCEvent* readNextEvent() throws IOException ;
@endif

/** Same as readNextEvent() but allows to set the access mode
* LCIO::READ_ONLY (default) or LCIO::Update.
*
* @throws IOException
*/
@ifdef cpp
public LCEvent* readNextEvent(int accessMode) ;
@else
public LCEvent* readNextEvent(int accessMode) throws IOException ;
@endif


@ifdef cpp

/** Return the number of events in the file - the file has to be open. In
* case several input files are specified in the open() method -
* the number of events in the file that is currently open is returned.
*/
public int getNumberOfEvents() throws IOException;
public int getNumberOfEvents() ;

/** Return the number of runs (run headers) in the file - the file has to be open. In
* case several input files are specified in the open() method -
* the number of runs (run headers) in the file that is currently open is returned.
*/
public int getNumberOfRuns() throws IOException;
public int getNumberOfRuns() ;

/** Return the run numbers of the runs (run headers) in the file - the file has to be open. In
* case several input files are specified in the open() method -
Expand Down Expand Up @@ -105,41 +132,65 @@ public interface LCReader {
/** Skips the next n events from the current position.
* @throws IOException
*/
@ifdef cpp
public void skipNEvents(int n) ;
@else
public void skipNEvents(int n) throws IOException;
@endif

/** Reads the specified runHeader from file. Returns NULL if
* the specified runHeader hasn't been found in the file.
*
* @throws IOException
*/
@ifdef cpp
public LCRunHeader* readRunHeader(int runNumber ) ;
@else
public LCRunHeader* readRunHeader(int runNumber ) throws IOException ;
@endif

/** Same as LCEvent* readRunHeader(int runNumber)
* allowing to set the access mode LCIO::READ_ONLY (default) or LCIO::Update.
*
* @throws IOException
*/
@ifdef cpp
public LCRunHeader* readRunHeader(int runNumber, int accessMode) ;
@else
public LCRunHeader* readRunHeader(int runNumber, int accessMode) throws IOException ;
@endif

/** Reads the specified event from file. Returns NULL if
* the specified event hasn't been found in the file.
*
* @throws IOException
*/
@ifdef cpp
public LCEvent* readEvent(int runNumber, int evtNumber) ;
@else
public LCEvent* readEvent(int runNumber, int evtNumber) throws IOException ;
@endif

/** Same as LCEvent* readEvent(int runNumber, int evtNumber)
* allowing to set the access mode LCIO::READ_ONLY (default) or LCIO::Update.
*
* @throws IOException
*/
@ifdef cpp
public LCEvent* readEvent(int runNumber, int evtNumber, int accessMode) ;
@else
public LCEvent* readEvent(int runNumber, int evtNumber, int accessMode) throws IOException ;
@endif

/** Closes the output file/stream etc.
*
* @throws IOException
*/
@ifdef cpp
public void close() ;
@else
public void close() throws IOException ;
@endif


/** Registers a listener for reading LCEvents from a stream.
Expand All @@ -164,13 +215,21 @@ public interface LCReader {
*
* @throws IOException
*/
@ifdef cpp
public void readStream() ;
@else
public void readStream() throws IOException ;
@endif

/** Reads maxRecord from the input stream and notifies registered
* listeners according to the object type found in the stream.
* An exception is thrown if less than maxRecord where read from the file.
*
* @throws IOException
*/
@ifdef cpp
public void readStream(int maxRecord) ;
@else
public void readStream(int maxRecord) throws IOException ;
@endif
}
26 changes: 25 additions & 1 deletion src/aid/IO/LCWriter.aid
Original file line number Diff line number Diff line change
Expand Up @@ -19,15 +19,23 @@ public interface LCWriter {
*
*@throws IOException
*/
@ifdef cpp
public void open(const String& filename ) ;
@else
public void open(const String& filename ) throws IOException ;
@endif

/** Opens a file for writing.
* Possible write modes are: LCIO::WRITE_NEW
* (existing files are replaced) and LCIO::WRITE_APPEND.
*
*@throws IOException
*/
@ifdef cpp
public void open(const String& filename , int writeMode ) ;
@else
public void open(const String& filename , int writeMode ) throws IOException ;
@endif


/** Set the compression level - needs to be called before open() otherwise
Expand All @@ -53,23 +61,39 @@ public interface LCWriter {
*
*@throws IOException
*/
@ifdef cpp
public void writeRunHeader(const LCRunHeader* hdr) ;
@else
public void writeRunHeader(const LCRunHeader* hdr) throws IOException ;
@endif

/** Writes the given event to file.
*
*@throws IOException
*/
@ifdef cpp
public void writeEvent(const LCEvent* evt) ;
@else
public void writeEvent(const LCEvent* evt) throws IOException ;
@endif

/** Closes the output file/stream.
*
*@throws IOException
*/
@ifdef cpp
public void close() ;
@else
public void close() throws IOException ;
@endif

/** Flushes the output file/stream.
*
*@throws IOException
*/
public void flush() throws IOException ;
@ifdef cpp
public void flush() ;
@else
public void flush() throws IOException ;
@endif
}
4 changes: 2 additions & 2 deletions src/cpp/include/IMPL/AccessChecked.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@ namespace IMPL {
protected:
virtual void setReadOnly( bool readOnly ) ;

void checkAccess() throw ( EVENT::ReadOnlyException ) ;
void checkAccess(const char* what) throw ( EVENT::ReadOnlyException ) ;
void checkAccess() ;
void checkAccess(const char* what) ;

protected:
bool _readOnly{false} ;
Expand Down
4 changes: 2 additions & 2 deletions src/cpp/include/IMPL/LCCollectionVec.h
Original file line number Diff line number Diff line change
Expand Up @@ -125,14 +125,14 @@ namespace IMPL {
*
* @throws ReadOnlyException
*/
virtual void addElement(EVENT::LCObject * obj) throw (EVENT::ReadOnlyException) ;
virtual void addElement(EVENT::LCObject * obj) ;

/** Removes the i-th element from the collection. Throws an exception
* if the collection (event) is 'read only'.
*
* @throws ReadOnlyException
*/
virtual void removeElementAt(int i) throw (EVENT::ReadOnlyException) ;
virtual void removeElementAt(int i) ;

/** Parameters defined for this run.
*/
Expand Down
8 changes: 4 additions & 4 deletions src/cpp/include/IMPL/LCEventImpl.h
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ namespace IMPL{
* @throws DataNotAvailableException
*/
virtual EVENT::LCCollection * getCollection(const std::string & name) const
throw (EVENT::DataNotAvailableException, std::exception) ;
;

/** Returns the collection for the given name and transfers the ownership of the collection
* to the caller. The caller is responsible for deleting the collection _after_ the Event is
Expand All @@ -81,7 +81,7 @@ namespace IMPL{
* @throws DataNotAvailableException
*/
virtual EVENT::LCCollection * takeCollection(const std::string & name) const
throw (EVENT::DataNotAvailableException, std::exception ) ;
;

/** Adds a collection with the given name (has to be a valid C/C++ variable name).
* Throws an exception if the name already
Expand All @@ -91,14 +91,14 @@ namespace IMPL{
*@throws EventException
*/
virtual void addCollection(EVENT::LCCollection * col, const std::string & name)
throw (EVENT::EventException, std::exception) ;
;

/** Removes (and deletes) the collection with name (if it exists in the event).
* Throws an exception if the event is 'read only' as defined by the read mode in LCReader.
*
*@throws ReadOnlyException
*/
virtual void removeCollection(const std::string & name) throw (EVENT::ReadOnlyException, std::exception) ;
virtual void removeCollection(const std::string & name) ;


// //fg20040528: added relations to the event
Expand Down
Loading