1 package org.lcsim.lcio;
2
3 import hep.io.sio.SIOInputStream;
4 import hep.io.sio.SIOOutputStream;
5 import java.io.IOException;
6 import org.lcsim.event.MCParticle;
7
8
9
10
11
12 class SIOMCParticleBlockHandler extends AbstractBlockHandler
13 {
14 public String getType() { return "MCParticle"; }
15 public Class getClassForType() { return MCParticle.class; }
16 LCIOCallback addCollectionElements(LCIOEvent event, final LCIOCollection collection, SIOInputStream in, final int n, final int version) throws IOException
17 {
18 for (int i = 0; i < n; i++)
19 collection.add(new SIOMCParticle(in, collection.getFlags(), version));
20
21 return new LCIOCallback()
22 {
23 public void callback()
24 {
25 for (int i = 0; i < n; i++)
26 ((SIOMCParticle) collection.get(i)).resolve(version);
27 }
28 };
29 }
30
31 void writeCollectionElement(Object element, SIOOutputStream out, int flags) throws IOException
32 {
33 SIOMCParticle.write((MCParticle) element, out, flags);
34 }
35 }