LCIO  02.17
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
SIOLCRelationHandler.cc
Go to the documentation of this file.
2 
3 #include "EVENT/LCIO.h"
5 #include "IMPL/LCFlagImpl.h"
6 
7 // -- sio headers
8 #include <sio/io_device.h>
9 #include <sio/version.h>
10 
11 namespace SIO {
12 
14  SIOObjectHandler( EVENT::LCIO::LCRELATION ) {
15  /* nop */
16  }
17 
18  //----------------------------------------------------------------------------
19 
20  void SIOLCRelationHandler::read( sio::read_device& device, EVENT::LCObject* objP, sio::version_type /*vers*/ ) {
21  auto rel = dynamic_cast<IOIMPL::LCRelationIOImpl*>( objP ) ;
22  SIO_PNTR( device , &(rel->_from ) );
23  SIO_PNTR( device , &(rel->_to ) ) ;
24  if( IMPL::LCFlagImpl(_flag).bitSet( EVENT::LCIO::LCREL_WEIGHTED ) ) {
25  SIO_SDATA( device , rel->_weight ) ;
26  }
27  }
28 
29  //----------------------------------------------------------------------------
30 
31  void SIOLCRelationHandler::write( sio::write_device& device, const EVENT::LCObject* obj ) {
32  auto rel = dynamic_cast<const EVENT::LCRelation*>( obj ) ;
33  auto from = rel->getFrom() ;
34  SIO_PNTR( device, &from ) ;
35  auto to = rel->getTo() ;
36  SIO_PNTR( device, &to ) ;
37  if( IMPL::LCFlagImpl(_flag).bitSet( EVENT::LCIO::LCREL_WEIGHTED ) ){
38  SIO_SDATA( device , rel->getWeight() ) ;
39  }
40  }
41 
42  //----------------------------------------------------------------------------
43 
45  return new IOIMPL::LCRelationIOImpl() ;
46  }
47 
48 } // namespace
The generic object that is held in an LCCollection.
Definition: LCObject.h:30
void read(sio::read_device &device, EVENT::LCObject *objP, sio::version_type vers)
Reads lcio objects from an SIO stream.
Interface for all lcio object SIO-handlers, has to be implemented for all event entities (hits...
void write(sio::write_device &device, const EVENT::LCObject *obj)
Writes lcio objects to an SIO stream.
unsigned int _flag
The collection flag.
Implementation of helper class to create and interpret the 32-bit flag word in LCCollections.
Definition: LCFlagImpl.h:15
Adding stuff needed for io (friend declarations, etc.)
A single weighted relationship between two LCObjects.
Definition: LCRelation.h:29
EVENT::LCObject * create() const
Factory method to create an object of the type of the collection.
virtual LCObject * getFrom() const =0
The &#39;from&#39; object of the given relation.