Skip to content
Snippets Groups Projects
Commit a47eda93 authored by Brad Sawatzky's avatar Brad Sawatzky
Browse files

Snapshot of the evio 4.4.6 release

This is a snapshot of the evio 4.4.6 release as published at:
  https://coda.jlab.org/drupal/system/files/evio-4.4.6.tgz

It is reproduced with permission in this git repository for the purposes
as a build dependence (via submodule) for the Hall A and C analyzers.

The upstream DAQ Group evio repository is private, but can be found here:
  https://github.com/JeffersonLab/evio

At some point we plan to replaces this ancilliary repo with a pointer to a
tagged release off the DAQ group's repo.

-- Brad Sawatzky <brads@jlab.org>
parents
No related branches found
No related tags found
No related merge requests found
Showing
with 1805 additions and 0 deletions
# Editor lint
.#*
*~
*.sw?
CHANGES 0 → 100644
jevio-4.3.1.jar differences from previous jar :
-check lengths when parsing evio so bad values are caught if possible
-fix bug if trying to unpack strings from rawbytes with too few bytes
-fix bug which did not take padding into account when getting data buffer of EvioNode
-fix bug in which after adding a structure with EvioCompactStructureHandler,
the node list was not updated
jevio-4.3.2.jar
-fix bug in which the displayed event # in graphical viewer did not correspond
to the actual event number (bug was in EvioReader)
-fix bug in which the "next" button in graphical viewer did silly things when
at max event number
-made members of EventTreeMenu protected instead of package or private
scope for subclassing purposes
jevio-4.3.3.jar
-same as the previous jar
jevio-4.3.4.jar
-fix bug EvioCompactReader in which parsing fails
when bank/seg/tagseg has last child with data len = 0
(back ported from 4.4.4)
******** NEW VERSION MINOR VERSION *********
jevio-4.4.jar
-improve performance including replacing LinkedLists with ArrayLists or arrays
-fix bug in Java CompactEventBuilder class that miswrites data into direct ByteBuffers (11/13/14)
-fix bug in Java CompactEventBuilder class that miswrites segment header (11/19/14)
-fix bug in EvioCompactStructureHandler.getNodes() throwing NullPointerException (12/8/14)
-add constructor to EvioCompactStructureHandler with EvioNode argument (12/8/14)
-in EvioReader, bomb proof against bad format files, fix bug in which last block's events
are not indexed, reduce initial memory usage (12/10/14)
jevio-4.4.1.jar
-fix major bug in ByteDataTransformer.toByteArray(). If arg is a ByteBuffer obtained from
slice(), its backing array cannot be used to copy into byte array since it copies wrong
data! (1/8/2015)
-fix major bug in EvioCompactStructureHandler.getData() which did not account for padding
in byte and short data (1/8/2015)
jevio-4.4.2.jar
-fix bug in EventParser & EvioEvent that add other evio structures when EvioReader.parseEvent()
or EventParser.parseEvent() are called more than once on an event.
jevio-4.4.3.jar
-fix bug in parsing composite data in which N=0 acts as N=1.
-add EventWriter.writeEvent() method for EvioNode object
jevio-4.4.4.jar
-fix bug EvioCompactReader in which parsing fails
when bank/seg/tagseg has last child with data len = 0
jevio-4.4.5.jar
- same as previous
- implement sequential reading instead of ignoring the
flag in EvioReader constructor.
- cut way back on EvioNode default memory usage (6/17/2015)
jevio-4.4.6.jar
- add getMap() method to iterate through EvioXMLDictionary contents.
Add EvioDictionaryEntry class to help accomplish that. (8/18/2015)
- fix bug which started block header number at 0 instead of 1 (9/3/2015)
C CODE
evio-4.3.3
- fix flags for Mac OSX compilation (9/22/2014)
evio-4.4
- fix performance problem writing files.
No longer force a written event to physical disk. (10/7/14)
- fix bug in C lib that miswrites 6th word of block header - event type (11/5/14)
evio-4.4.4
- fix bug in C++ that does not set padding correctly
- fix lots of compiler warnings
evio-4.4.5
- fix problems compiling on Mac
README 0 → 100644
evio Software Package
Evio stands for event input/output and contains libraries which read & write
data in it own unique format. It was created and is maintained by the Data
Acquisition (DAQ) Group at Thomas Jefferson National Accelerator Facility
(Jefferson Lab). It was originally used in the online DAQ as part of their
CODA software, but is now being used offline and in other applications as
well.
There is a C library as well as a C++ library which is primarily a
wrapper around the C. There are a few utility programs included.
The Java version is a jar file containing all the capabilities
of the C and C++ libraries with a more extensive, user-friendly
interface. It contains a GUI for looking at evio format data.
If you only plan to run C/C++ applications you can skip the Java
installation. If you only plan to use Java applications you can
you can skip the C/C++ installation.
1) Getting & Installing evio
The evio package, including documentation, can be found on the
JLab Data Acquisition Group CODA wiki at http://coda.jlab.org.
To install all of evio, download the evio-4.x.tar.gz
file (or whatever version happens to be current) and untar it.
This will give you a full evio distribution with the top level
directory being evio-4.x. The documentation, is available on the
above-mentioned web site but also exists in the doc subdirectory
of the full distribution.
Note that for C/C++, only Linux, Solaris, and Darwin (Mac OSX)
operating systems are supported. The libraries and executables
are placed into the $CODA/<arch>/lib and bin subdirectories
(eg. ...Linux-x86_64/lib). Be sure to change your LD_LIBRARY_PATH
environmental variable to include the correct lib directory.
2) C/C++ code
Compiling using SCons (make is no longer supported)
From the SCons website:
"SCons is an Open Source software
construction tool -- that is, a next-generation build tool.
Think of SCons as an improved, cross-platform substitute for
the classic Make utility with integrated functionality similar
to autoconf/automake and compiler caches such as ccache. In short,
SCons is an easier, more reliable and faster way to build software."
SCons is written in python, thus to use this build system with evio,
both python and SCons packages need previous installation. If your
system does not have one or the other, go to the http://www.python.org/
and http://www.scons.org/ websites for downloading.
The SCons files needed for compiling are already included as part of
the evio distribution. To compile, the user needs merely to run "scons"
in the top level evio directory. To compile and install libraries and
header files, first define the CODA environmental variable containing
the directory in which to install things and then run "scons install".
The following is a table of SCons compilation options:
scons -h print out help
scons -c remove all generated files
scons install make C and C++ library code;
place libraries in architecture-specific lib directory
place binaries in architecture-specific bin directory
directory and headers in an include directory
scons -c install uninstall libs, headers, and binaries
scons tar create a tar file (evio-4.x.tgz) of the evio top level
directory and put in ./tar directory
scons doc generate html documentation from doxygen
comments in the source code and put in ./doc directory
scons undoc remove the doc/doxygen/C & CC
directories with all the generated documentation
scons --dbg compile with debug flag
scons --32bits compile 32bit libraries & executables on 64bit system
scons --vx5.5 cross compile for vxworks version 5.5
scons --vx6.0 cross compile for vxworks version 6.0
scons --prefix=<dir> use base directory <dir> when doing install.
Defaults to CODA environmental variable.
Libs go in <dir>/<arch>/lib, headers in <dir>/<arch>/include
and executables in <dir>/<arch>/bin
scons --incdir=<dir> copy header files to directory <dir> when doing install
(takes precedence over --prefix or default location)
scons --libdir=<dir> copy library files to directory <dir> when doing install
(takes precedence over --prefix or default location)
scons --bindir=<dir> copy executable files to directory <dir> when doing install
(takes precedence over --prefix or default location)
You can see these options by running "scons -h"
Note that currently only Linux, Solaris, and Darwin (Mac OSX)
operating systems are fully supported. The libraries and executables
are placed into the $CODA/<arch>/lib and bin subdirectories
(eg. ...Linux-x86_64/lib). Be sure to change your LD_LIBRARY_PATH
environmental variable to include the correct lib directory.
All libraries and a limited set of executables are also supported for
vxworks versions 5.5 and 6.0 .
3) JAVA
One can download the jevio-4.x.jar file from the CODA website or it can
be generated from the general evio distribution. In either case,
put the jar file into your classpath and run your java application.
If you're using the jar file from the CODA website, java version 1.6 or
higher is necessary since it was compiled with version 1.6. If
generating it, use java version 1.5 or higher to compile.
If you wish to recompile the java part of evio, ant must be installed
on your system (http://ant.apache.org). First extract the package files
from the general evio tar file:
# download evio-4.x.tar.gz into <top>
$ cd <top>
$ tar -fxz evio-4.x.tar.gz
$ cd evio-4.x
$ ant
To get a list of options with ant, type "ant help":
ant help - print out usage
ant env - print out build file variables' values
ant compile - compile java files
ant clean - remove class files
ant cleanall - remove all generated files
ant jar - compile and create jar file
ant install - create jar file and install into 'prefix'
ant if given on command line by -Dprefix=dir',
ant else install into CODA if defined
ant uninstall - remove jar file previously installed into 'prefix'
ant if given on command line by -Dprefix=dir',
ant else installed into CODA if defined
ant all - clean, compile and create jar file
ant javadoc - create javadoc documentation
ant developdoc - create javadoc documentation for developer
ant undoc - remove all javadoc documentation
ant prepare - create necessary directories
To generate a new evio jar file, type "ant jar" which will
create the file and place it in <top>/build/lib .
4) Documentation
All documentation is available from http://coda.jlab.org.
However, if using the downloaded distribution, some of the documentation
needs to be generated and some already exists. For existing docs look in
doc/users_guide for pdf and Microsoft Word format documents.
Some of the documentation is in the source code itself and must be generated
and placed into its own directory.
The java code is documented with, of course, javadoc and the C/C++ code is
documented with doxygen comments (identical to javadoc comments).
To generate all the these docs, from the top level directory type:
"scons doc"
To remove it all type:
"scons undoc"
The javadoc is placed in the doc/javadoc directory.
The doxygen docs for C code are placed in the doc/doxygen/C/html directory,
and the doxygen docs for C++ code are placed in the doc/doxygen/CC/html directory.
To view the html documentation, just point your browser to the index.html
file in each of those directories.
Alternatively, just the java documentation can be generated by typing
"ant javadoc"
for user-level documentation, or
"ant developdoc"
for developer-level documentation. To remove it:
"ant undoc"
5) Problems
Carl Timmer - timmer@jlab.org
6) Copyright
For any issues regarding use and copyright, read the NOTICE file.
# evio Software Package 4.4.6
This is a snapshot of the evio 4.4.6 release as published at:
https://coda.jlab.org/drupal/system/files/evio-4.4.6.tgz
It is reproduced with permission in this git repository for the purposes
as a build dependence (via submodule) for the Hall A and C analyzers.
The upstream DAQ Group evio repository is private, but can be found here:
https://github.com/JeffersonLab/evio
At some point we plan to replaces this ancilliary repo with a pointer to a
tagged release off the DAQ group's repo.
-- Brad Sawatzky <brads@jlab.org>
################################
# scons build system file
################################
#
# Much of this file can be used as a boilerplate build file.
#
# The parts that are dependent on the details of the software
# package being compiled are:
#
# 1) the name and version of this software package
# 2) the needed header files and libraries
# 3) what type of documentation needs to be installed
# 4) the scons files to be run in the source directories
#
################################
# Get various python modules
import re, sys, os, string, subprocess, SCons.Node.FS
from subprocess import Popen, PIPE
# Get useful python functions we wrote
import coda
# Created files & dirs will have this permission
os.umask(002)
# Software version
versionMajor = '4'
versionMinor = '4.6'
# Determine the os and machine names
uname = os.uname();
platform = uname[0]
machine = uname[4]
osname = os.getenv('CODA_OSNAME', platform + '-' + machine)
# Create an environment while importing the user's PATH.
# This allows us to get to the vxworks compiler for example.
# So for vxworks, make sure the tools are in your PATH
env = Environment(ENV = {'PATH' : os.environ['PATH']})
################################
# 64 or 32 bit operating system?
################################
# How many bits is the operating system?
# For Linux 64 bit x86 machines, the "machine' variable is x86_64,
# but for Darwin or Solaris there is no obvious check so run
# a configure-type test.
is64bits = coda.is64BitMachine(env, platform, machine)
if is64bits:
print "We're on a 64-bit machine"
else:
print "We're on a 32-bit machine"
#############################################
# Command line options (view with "scons -h")
#############################################
Help('\n-D build from subdirectory of package\n')
Help('\nlocal scons OPTIONS:\n')
# debug option
AddOption('--dbg', dest='ddebug', default=False, action='store_true')
debug = GetOption('ddebug')
if debug: print "Enable debugging"
Help('--dbg compile with debug flag\n')
# vxworks 5.5 option
AddOption('--vx5.5', dest='doVX55', default=False, action='store_true')
useVxworks55 = GetOption('doVX55')
if useVxworks55: print "Use vxWorks version 5.5"
Help('--vx5.5 cross compile for vxworks 5.5\n')
# vxworks 6.0 option
AddOption('--vx6.0', dest='doVX60', default=False, action='store_true')
useVxworks60 = GetOption('doVX60')
if useVxworks60: print "Use vxWorks version 6.0"
Help('--vx6.0 cross compile for vxworks 6.0\n')
# 32 bit option
AddOption('--32bits', dest='use32bits', default=False, action='store_true')
use32bits = GetOption('use32bits')
if use32bits: print "use 32-bit libs & executables even on 64 bit system"
Help('--32bits compile 32bit libs & executables on 64bit system\n')
# install directory option
AddOption('--prefix', dest='prefix', nargs=1, default='', action='store')
prefix = GetOption('prefix')
Help('--prefix=<dir> use base directory <dir> when doing install\n')
# include install directory option
AddOption('--incdir', dest='incdir', nargs=1, default=None, action='store')
incdir = GetOption('incdir')
Help('--incdir=<dir> copy header files to directory <dir> when doing install\n')
# library install directory option
AddOption('--libdir', dest='libdir', nargs=1, default=None, action='store')
libdir = GetOption('libdir')
Help('--libdir=<dir> copy library files to directory <dir> when doing install\n')
# binary install directory option
AddOption('--bindir', dest='bindir', nargs=1, default=None, action='store')
bindir = GetOption('bindir')
Help('--bindir=<dir> copy binary files to directory <dir> when doing install\n')
#########################
# Compile flags
#########################
# 2 possible versions of vxWorks
useVxworks = False
if useVxworks55:
useVxworks = True
vxVersion = 5.5
elif useVxworks60:
useVxworks = True
vxVersion = 6.0
# Debug/optimization flags
debugSuffix = ''
if debug:
debugSuffix = '-dbg'
# Compile with -g and add debugSuffix to all executable names
env.Append(CCFLAGS = '-g', PROGSUFFIX = debugSuffix)
elif platform == 'SunOS':
env.Append(CCFLAGS = '-xO3')
else:
env.Append(CCFLAGS = '-O3')
# Take care of 64/32 bit issues
if is64bits:
# Setup 64 bit machine to compile either 32 or 64 bit libs & executables
coda.configure32bits(env, use32bits, platform)
elif not use32bits:
use32bits = True
execLibs = ['']
# If using vxworks ...
if useVxworks:
use32bits = True
osname = 'vxworks'+ str(vxVersion) + '-ppc'
if not coda.configureVxworks(env, vxVersion, platform):
print '\nCannot set enviroment for vxWorks ' + str(vxVersion) + ', exiting\n'
Exit(0)
else:
# Platform dependent quantities. Default to standard Linux libs.
execLibs = ['pthread', 'expat', 'z', 'dl', 'm']
if platform == 'SunOS':
execLibs = ['m', 'posix4', 'pthread', 'dl', 'expat', 'z']
env.Append(CCFLAGS = ['-mt'])
env.Append(CPPDEFINES = ['_GNU_SOURCE', '_REENTRANT', '_POSIX_PTHREAD_SEMANTICS', 'SunOS'])
elif platform == 'Darwin':
execLibs = ['pthread', 'dl', 'expat', 'z']
env.Append(CPPDEFINES = ['Darwin'], SHLINKFLAGS = ['-multiply_defined','suppress','-undefined','dynamic_lookup'])
env.Append(CCFLAGS = ['-fmessage-length=0'])
if is64bits and use32bits and not useVxworks:
osname = osname + '-32'
print "OSNAME =", osname
# hidden sub directory into which variant builds go
archDir = '.' + osname + debugSuffix
#########################
# Install stuff
#########################
libInstallDir = ""
binInstallDir = ""
incInstallDir = ""
archIncInstallDir = ""
# If a specific installation dir for includes is not specified
# on the command line, then the architecture specific include
# dir is a link to local ../common/include directory.
archIncLocalLink = None
if (incdir == None):
archIncLocalLink = '../common/include'
# If we going to install ...
if 'install' in COMMAND_LINE_TARGETS:
# Determine installation directories
installDirs = coda.getInstallationDirs(osname, prefix, incdir, libdir, bindir)
mainInstallDir = installDirs[0]
osDir = installDirs[1]
incInstallDir = installDirs[2]
archIncInstallDir = installDirs[3]
libInstallDir = installDirs[4]
binInstallDir = installDirs[5]
# Create the include directories (make symbolic link if possible)
coda.makeIncludeDirs(incInstallDir, archIncInstallDir, osDir, archIncLocalLink)
print 'Main install dir = ', mainInstallDir
print 'bin install dir = ', binInstallDir
print 'lib install dir = ', libInstallDir
print 'inc install dirs = ', incInstallDir, ", ", archIncInstallDir
else:
print 'No installation being done'
print
# use "install" on command line to install libs & headers
Help('install install libs, headers, and binaries\n')
# uninstall option
Help('install -c uninstall libs, headers, and binaries\n')
###############################
# Documentation (un)generation
###############################
if 'doc' in COMMAND_LINE_TARGETS:
coda.generateDocs(env, True, True, True, "java/org/jlab/coda/jevio")
if 'undoc' in COMMAND_LINE_TARGETS:
coda.removeDocs(env)
# use "doc" on command line to create tar file
Help('doc create javadoc (in ./doc)\n')
# use "undoc" on command line to create tar file
Help('undoc remove javadoc (in ./doc)\n')
#########################
# Tar file
#########################
if 'tar' in COMMAND_LINE_TARGETS:
if platform == 'SunOS':
print '\nMake tar file from Linux or MacOS please\n'
Exit(0)
coda.generateTarFile(env, 'evio', versionMajor, versionMinor)
# use "tar" on command line to create tar file
Help('tar create tar file (in ./tar)\n')
######################################################
# Lower level scons files (software package dependent)
######################################################
# Make available to lower level scons files
Export('env archDir incInstallDir libInstallDir binInstallDir archIncInstallDir execLibs debugSuffix')
# Run lower level build files
#if useVxworks:
# env.SConscript('src/libsrc/SConscript.vx', variant_dir='src/libsrc/'+archDir, duplicate=0)
# env.SConscript('src/libsrc++/SConscript.vx', variant_dir='src/libsrc++/'+archDir, duplicate=0)
#else:
env.SConscript('src/libsrc/SConscript', variant_dir='src/libsrc/'+archDir, duplicate=0)
if not useVxworks:
env.SConscript('src/libsrc++/SConscript', variant_dir='src/libsrc++/'+archDir, duplicate=0)
env.SConscript('src/execsrc/SConscript', variant_dir='src/execsrc/'+archDir, duplicate=0)
env.SConscript('src/examples/SConscript', variant_dir='src/examples/'+archDir, duplicate=0)
env.SConscript('src/test/SConscript', variant_dir='src/test/'+archDir, duplicate=0)
build.xml 0 → 100644
<?xml version="1.0" encoding="UTF-8"?>
<project name="jevio" default="compile" basedir=".">
<!-- environmental variables -->
<property environment="env"/>
<!-- Version -->
<property name="evio.version" value="4.4.6" />
<!-- Debug -->
<property name="javac.debug" value="on" />
<!-- Directories/Files -->
<property name="src.dir" value="java" />
<property name="build.dir" value="build" />
<property name="build.classes" value="${build.dir}/classes" />
<property name="build.lib" value="${build.dir}/lib" />
<property name="doc.dir" value="doc/javadoc" />
<property name="jarName" value="jevio-${evio.version}.jar" />
<property name="allJarNames" value="jevio-*.jar" />
<property name="jarPath" value="${build.lib}/${jarName}" />
<!-- Set Classpath, ignore caller's classpath -->
<property name="build.sysclasspath" value="ignore" />
<path id="classpath" />
<!-- Targets -->
<!-- Help -->
<target name="help">
<echo message="Usage: ant [ant options] &lt;target1&gt; [target2 | target3 | ...]" />
<echo message="" />
<echo message=" targets:" />
<echo message=" help - print out usage" />
<echo message=" env - print out build file variables' values" />
<echo message=" compile - compile java files" />
<echo message=" clean - remove class files" />
<echo message=" cleanall - remove all generated files" />
<echo message=" jar - compile and create jar file" />
<echo message=" install - create jar file and install into 'prefix'" />
<echo message=" if given on command line by -Dprefix=dir'," />
<echo message=" else install into CODA if defined" />
<echo message=" uninstall - remove jar file previously installed into 'prefix'" />
<echo message=" if given on command line by -Dprefix=dir'," />
<echo message=" else installed into CODA if defined" />
<echo message=" all - clean, compile and create jar file" />
<echo message=" javadoc - create javadoc documentation" />
<echo message=" developdoc - create javadoc documentation for developer" />
<echo message=" undoc - remove all javadoc documentation" />
<echo message=" prepare - create necessary directories" />
</target>
<!-- Environment -->
<target name="env">
<echo message="Ant environment:" />
<echo message="" />
<echo message=" src.dir = ${src.dir}" />
<echo message=" build.dir = ${build.dir}" />
<echo message=" build.lib = ${build.lib}" />
<echo message=" build.classes = ${build.classes}" />
<echo message=" doc.dir = ${doc.dir}" />
<echo message=" javac.debug = ${javac.debug}" />
<echo message=" classpath = ${env.CLASSPATH}" />
</target>
<!-- ************************************************************* -->
<target name="installCheck" >
<!-- Test to see if -Dprefix=<dir> used on command line -->
<condition property="prefixDefined">
<isset property="prefix"/>
</condition>
<!-- Test to see if CODA environmental variable defined -->
<condition property="codaDefined">
<isset property="env.CODA"/>
</condition>
<!-- Test to see if no installation directory defined -->
<condition property="noInstallDir">
<and>
<not>
<isset property="prefix"/>
</not>
<not>
<isset property="env.CODA"/>
</not>
</and>
</condition>
</target>
<!-- ************************************************************* -->
<!-- Prepare things by creating directories -->
<target name="prepare" depends="installCheck" >
<mkdir dir="${build.dir}" />
<mkdir dir="${build.classes}" />
<mkdir dir="${build.lib}" />
<antcall target="preparePrefixDir"/>
<antcall target="prepareCodaDir"/>
</target>
<target name="preparePrefixDir" if="prefixDefined">
<mkdir dir="${prefix}/jar" />
</target>
<target name="prepareCodaDir" if="codaDefined">
<mkdir dir="${env.CODA}/common/jar" />
</target>
<!-- Clean by removing class files -->
<target name="clean" description="Remove all class files">
<delete failonerror="no" >
<fileset dir="${build.classes}" includes="**/*.class" />
</delete>
</target>
<!-- Clean by removing build & doc directories -->
<target name="cleanall" depends="clean" description="Remove all generated files.">
<delete dir="${build.dir}" failonerror="no" />
<delete dir="${doc.dir}" failonerror="no" />
</target>
<!-- Compile all source -->
<target name="compile" depends="prepare" description="Compiles all source code.">
<javac destdir="${build.classes}" debug="${javac.debug}" optimize="yes" >
<src path="${src.dir}" />
<classpath refid="classpath" />
</javac>
</target>
<!-- Javadoc -->
<target name="javadoc" description="Create javadoc.">
<mkdir dir="${doc.dir}" />
<javadoc packagenames="org.jlab.coda.jevio"
sourcepath="java"
access="public"
destdir="${doc.dir}"
use="true" >
<classpath refid="classpath" />
</javadoc>
</target>
<!-- Javadoc for developer -->
<target name="developdoc" description="Create javadoc for developer.">
<mkdir dir="${doc.dir}" />
<javadoc packagenames="org.jlab.coda.jevio"
sourcepath="java"
access="package"
destdir="${doc.dir}"
use="true" >
<classpath refid="classpath" />
</javadoc>
</target>
<!-- Removing Javadoc -->
<target name="undoc" description="remove all javadoc.">
<delete dir="${doc.dir}" />
</target>
<!-- Create Jar file -->
<target name="jar" depends="compile" description="Generates jar file.">
<jar jarfile="${jarPath}" manifest="${src.dir}/org/jlab/coda/jevio/manifest.mf">
<fileset dir="${build.classes}" excludes="*.class" />
</jar>
</target>
<!-- Clean, compile, and create jar -->
<target name="all" depends="clean,jar" description="Cleans, compile, then builds jar file." />
<!-- Install Jar file -->
<target name="install" depends="jar,installCheck" description="Installs jar file.">
<antcall target="error"/>
<antcall target="installInPrefix"/>
<antcall target="installInCODA"/>
</target>
<!-- Install in prefix -->
<target name="installInPrefix" if="prefixDefined">
<echo>Install ${jarName} into ${prefix}</echo>
<delete>
<fileset dir="${prefix}/jar" includes="${allJarNames}" />
</delete>
<copy file="${jarPath}" todir="${prefix}/jar"/>
</target>
<!-- Install in $CODA -->
<target name="installInCODA" unless="prefixDefined" if="codaDefined">
<echo>Install ${jarName} into ${env.CODA}/common/jar</echo>
<delete>
<fileset dir="${env.CODA}/common/jar" includes="${allJarNames}" />
</delete>
<copy file="${jarPath}" todir="${env.CODA}/common/jar"/>
</target>
<!-- No installation directory defined -->
<target name="error" if="noInstallDir">
<fail message="CODA env var not defined and -Dprefix not used, jar NOT installed" />
</target>
<!-- Uninstall Jar file -->
<target name="uninstall" depends="installCheck" description="Uninstalls jar file.">
<antcall target="error2"/>
<antcall target="uninstallFromPrefix"/>
<antcall target="uninstallFromCODA"/>
</target>
<!-- Uninstall from prefix -->
<target name="uninstallFromPrefix" if="prefixDefined">
<echo>Remove ${jarName} from ${prefix}</echo>
<delete file="${prefix}/jar/${jarName}"/>
</target>
<!-- Uninstall from $CODA -->
<target name="uninstallFromCODA" unless="prefixDefined" if="codaDefined">
<echo>Remove ${jarName} from ${env.CODA}/common/jar</echo>
<delete file="${env.CODA}/common/jar/${jarName}"/>
</target>
<!-- No installation directory defined to uninstall from -->
<target name="error2" if="noInstallDir">
<fail message="Installation directory not defined, jar NOT installed" />
</target>
</project>
coda.py 0 → 100644
####################################################
# Python functions to support CODA scons build files
####################################################
import re, sys, glob, os, string, subprocess
from os import sep, symlink
from subprocess import Popen, PIPE
from SCons.Script import Configure
from SCons.Builder import Builder
################
# File handling
################
def recursiveDirs(root) :
"""Return a list of all subdirectories of root, top down,
including root, but without .svn and .<arch> directories"""
return filter( (lambda a : (a.rfind( ".svn")==-1) and \
(a.rfind( ".Linux")==-1) and \
(a.rfind( ".SunOS")==-1) and \
(a.rfind( ".Darwin")==-1) and \
(a.rfind( ".vxworks")==-1)), [ a[0] for a in os.walk(root)] )
def unique(list) :
"""Remove duplicates from list"""
return dict.fromkeys(list).keys()
def scanFiles(dir, accept=["*.cpp"], reject=[]) :
"""Return a list of selected files from a directory & its subdirectories"""
sources = []
paths = recursiveDirs(dir)
for path in paths :
for pattern in accept :
sources+=glob.glob(path+"/"+pattern)
for pattern in reject :
sources = filter( (lambda a : a.rfind(pattern)==-1 ), sources )
return unique(sources)
def subdirsContaining(root, patterns):
"""Return a list of subdirectories containing files of the given pattern"""
dirs = unique(map(os.path.dirname, scanFiles(root, patterns)))
dirs.sort()
return dirs
###################
# Operating System
###################
def CheckHas64Bits(context, flags):
"""Define configure-type test function to
see if operating system is 64 or 32 bits"""
context.Message( 'Checking for 64/32 bits ...' )
lastCCFLAGS = context.env['CCFLAGS']
lastLFLAGS = context.env['LINKFLAGS']
context.env.Append(CCFLAGS = flags, LINKFLAGS = flags)
# (C) program to run to check for bits
ret = context.TryRun("""
#include <stdio.h>
int main(int argc, char **argv) {
printf(\"%d\", 8*sizeof(0L));
return 0;
}
""", '.c')
# Restore original flags
context.env.Replace(CCFLAGS = lastCCFLAGS, LINKFLAGS = lastLFLAGS)
# If program successfully ran ...
if ret[0]:
context.Result(ret[1])
if ret[1] == '64':
return 64
return 32
# Else if program did not run ...
else:
# Don't know if it's a 32 or 64 bit operating system
context.Result('failed')
return 0
def is64BitMachine(env, platform, machine):
"""Determine if machine has 64 or 32 bit architecture"""
if platform == 'Linux' and machine == 'x86_64':
return True
else:
ccflags = ''
if platform == 'SunOS':
ccflags = '-xarch=amd64'
# Run the test
conf = Configure( env, custom_tests = { 'CheckBits' : CheckHas64Bits } )
ret = conf.CheckBits(ccflags)
env = conf.Finish()
if ret < 1:
print 'Cannot run test, assume 64 bit system'
return True
elif ret == 64:
# Test shows 64 bit system'
return True
else:
# Test shows 32 bit system'
return False
def configure32bits(env, use32bits, platform):
"""Setup environment on 64 bit machine to handle 32 or 64 bit libs and executables."""
if platform == 'SunOS':
if not use32bits:
if machine == 'sun4u':
env.Append(CCFLAGS = ['-xarch=native64', '-xcode=pic32'],
LINKFLAGS = ['-xarch=native64', '-xcode=pic32'])
else:
env.Append(CCFLAGS = ['-xarch=amd64'],
LINKFLAGS = ['-xarch=amd64'])
elif platform == 'Darwin':
if not use32bits:
env.Append(CCFLAGS = [],
LINKFLAGS = ['-Wl', '-bind_at_load'])
elif platform == 'Linux':
if use32bits:
env.Append(CCFLAGS = ['-m32'], LINKFLAGS = ['-m32'])
return
def configureVxworks(env, vxVersion, platform):
"""Setup everything for vxWorks cross compilation."""
## Figure out which version of vxworks is being used.
## Do this by finding out which ccppc is first in our PATH.
#vxCompilerPath = Popen('which ccppc', shell=True, stdout=PIPE, stderr=PIPE).communicate()[0]
## Then ty to grab the major version number from the PATH
#matchResult = re.match('/site/vxworks/(\\d).+', vxCompilerPath)
#if matchResult != None:
## Test if version number was obtained
#try:
#vxVersion = int(matchResult.group(1))
#except IndexError:
#print 'ERROR finding vxworks version, set to 6 by default\n'
vxInc = ''
if vxVersion == 5.5:
vxbase = '/site/vxworks/5.5/ppc'
vxInc = [vxbase + '/target/h']
env.Append(CPPDEFINES = ['VXWORKS_5'])
elif vxVersion == 6.0:
vxbase = '/site/vxworks/6.0/ppc/gnu/3.3.2-vxworks60'
vxInc = ['/site/vxworks/6.0/ppc/vxworks-6.0/target/h',
'/site/vxworks/6.0/ppc/vxworks-6.0/target/h/wrn/coreip']
env.Append(CPPDEFINES = ['VXWORKS_6'])
else:
print 'Unknown version of vxWorks, exiting'
return 0
if platform == 'Linux':
if vxVersion == 5.5:
vxbin = vxbase + '/host/x86-linux/bin/'
else:
vxbin = vxbase + '/x86-linux2/bin/'
elif platform == 'SunOS':
if vxVersion >= 6:
print '\nVxworks 6.x compilation not allowed on solaris'
return 0
vxbin = vxbase + '/host/sun4-solaris2/bin/'
if machine == 'i86pc':
print '\nVxworks compilation not allowed on x86 solaris'
return 0
else:
print '\nVxworks compilation not allowed on ' + platform
return 0
# If the supplied vxworks path is bad, rely
# on the PATH to find vxworks executables
if not os.path.exists(vxbin):
vxbin = ''
env.Replace(SHLIBSUFFIX = '.o')
# Get rid of -shared and use -r
env.Replace(SHLINKFLAGS = '-r')
# Redefine SHCFLAGS/SHCCFLAGS to get rid of -fPIC (in Linux)
vxFlags = '-fno-builtin -fvolatile -fstrength-reduce -mlongcall -mcpu=604'
env.Replace(SHCFLAGS = vxFlags)
env.Replace(SHCCFLAGS = vxFlags)
env.Append(CFLAGS = vxFlags)
env.Append(CCFLAGS = vxFlags)
env.Append(CPPPATH = vxInc)
env.Append(CPPDEFINES = ['CPU=PPC604', 'VXWORKS', '_GNU_TOOL', 'VXWORKSPPC', 'POSIX_MISTAKE', 'NO_RW_LOCK'])
env['CC'] = vxbin + 'ccppc'
env['CXX'] = vxbin + 'g++ppc'
env['SHLINK'] = vxbin + 'ldppc'
env['AR'] = vxbin + 'arppc'
env['RANLIB'] = vxbin + 'ranlibppc'
return 1
###########################
# Installation Directories
###########################
def getInstallationDirs(osname, prefix, incdir, libdir, bindir):
"""Determine installation directories."""
# Get CODA env variable if any
codaHomeEnv = os.getenv('CODA','')
# The installation directory is the user-specified "prefix"
# by first choice, "CODA" secondly.
# Any user specified command line installation path overrides default
if (prefix == None) or (prefix == ''):
# prefix not defined try CODA env var
if codaHomeEnv == "":
if (incdir == None) or (libdir == None) or (bindir == None):
print "\nNeed to define CODA, or use the --prefix option,"
print "or all the --incdir, --libdir, and --bindir options.\n"
raise SystemExit
else:
prefix = codaHomeEnv
osDir = prefix + "/" + osname
# Set our install directories
if incdir != None:
incDir = incdir
archIncDir = incdir
else:
incDir = prefix + '/common/include'
archIncDir = osDir + '/include'
if libdir != None:
libDir = libdir
else:
libDir = osDir + '/lib'
if bindir != None:
binDir = bindir
else:
binDir = osDir + '/bin'
# Return absolute paths in list
return [os.path.abspath(prefix),
os.path.abspath(osDir),
os.path.abspath(incDir),
os.path.abspath(archIncDir),
os.path.abspath(libDir),
os.path.abspath(binDir)]
###########################
# Include File Directories
###########################
def makeIncludeDirs(includeDir, archIncludeDir, archDir, archIncLocalLink):
"""Function to make include directories"""
#
# Create main include dir if it doesn't exist
#
if not os.path.exists(includeDir):
os.makedirs(includeDir)
# Make sure it's a directory (if we didn't create it)
elif not os.path.isdir(includeDir):
print
print "Error:", includeDir, "is NOT a directory"
print
raise SystemExit
if includeDir == archIncludeDir:
return
#
# If an install has never been done, the arch dir needs
# to be made first so the symbolic link can be created.
#
if not os.path.exists(archDir):
try:
os.makedirs(archDir)
except OSError:
return
elif not os.path.isdir(archDir):
print
print "Error:", archDir, "is NOT a directory"
print
raise SystemExit
#
# If the architecture include dir does NOT exist,
# make link to include dir
#
if not os.path.exists(archIncludeDir):
# Create symbolic link: symlink(source, linkname)
try:
if (archIncLocalLink == None) or (archIncLocalLink == ''):
symlink(includeDir, archIncludeDir)
else:
symlink(archIncLocalLink, archIncludeDir)
except OSError:
# Failed to create symbolic link, so
# just make it a regular directory
os.makedirs(archIncludeDir)
elif not os.path.isdir(archIncludeDir):
print
print "Error:", archIncludeDir, "is NOT a directory"
print
raise SystemExit
return
###########
# JAVA JNI
###########
def configureJNI(env):
"""Configure the given environment for compiling Java Native Interface
c or c++ language files."""
# first look for a shell variable called JAVA_HOME
java_base = os.environ.get('JAVA_HOME')
if not java_base:
if sys.platform == 'darwin':
# Apple's OS X has its own special java base directory
java_base = '/System/Library/Frameworks/JavaVM.framework'
else:
# Search for the java compiler
print "JAVA_HOME environment variable not set. Searching for javac to find jni.h ..."
if not env.get('JAVAC'):
print "The Java compiler must be installed and in the current path, exiting"
return 0
jcdir = os.path.dirname(env.WhereIs('javac'))
if not jcdir:
print " not found, exiting"
return 0
# assuming the compiler found is in some directory like
# /usr/jdkX.X/bin/javac, java's home directory is /usr/jdkX.X
java_base = os.path.join(jcdir, "..")
print " found, dir = " + java_base
if sys.platform == 'darwin':
# Apple does not use Sun's naming convention
java_headers = [os.path.join(java_base, 'Headers')]
java_libs = [os.path.join(java_base, 'Libraries')]
else:
# linux
java_headers = [os.path.join(java_base, 'include')]
java_libs = [os.path.join(java_base, 'lib')]
# Sun's windows and linux JDKs keep system-specific header
# files in a sub-directory of include
if java_base == '/usr' or java_base == '/usr/local':
# too many possible subdirectories. Just use defaults
java_headers.append(os.path.join(java_headers[0], 'linux'))
java_headers.append(os.path.join(java_headers[0], 'solaris'))
else:
# add all subdirs of 'include'. The system specific headers
# should be in there somewhere
java_headers = recursiveDirs(java_headers[0])
# add Java's include and lib directory to the environment
env.Append(CPPPATH = java_headers)
# (only need the headers right now so comment out next line)
#env.Append(LIBPATH = java_libs)
# add any special platform-specific compilation or linking flags
# (only need the headers right now so comment out next lines)
#if sys.platform == 'darwin':
# env.Append(SHLINKFLAGS = '-dynamiclib -framework JavaVM')
# env['SHLIBSUFFIX'] = '.jnilib'
# Add extra potentially useful environment variables
#env['JAVA_HOME'] = java_base
#env['JNI_CPPPATH'] = java_headers
#env['JNI_LIBPATH'] = java_libs
return 1
###################
# Documentation
###################
def generateDocs(env, doC=False, doCPP=False, doJava=False, javaDir=''):
"""Generate and install generated documentation (doxygen & javadoc)."""
if doC:
# Function that does the documentation creation
def docGeneratorC(target, source, env):
cmd = 'doxygen doc/doxygen/DoxyfileC'
pipe = Popen(cmd, shell=True, env={"TOPLEVEL": "./"}, stdout=PIPE).stdout
return
# Doc files builders
docBuildC = Builder(action = docGeneratorC)
env.Append(BUILDERS = {'DocGenC' : docBuildC})
# Generate documentation
env.Alias('doc', env.DocGenC(target = ['#/doc/doxygen/C/html/index.html'],
source = scanFiles("src/libsrc", accept=["*.[ch]"]) ))
if doCPP:
def docGeneratorCC(target, source, env):
cmd = 'doxygen doc/doxygen/DoxyfileCC'
pipe = Popen(cmd, shell=True, env={"TOPLEVEL": "./"}, stdout=PIPE).stdout
return
docBuildCC = Builder(action = docGeneratorCC)
env.Append(BUILDERS = {'DocGenCC' : docBuildCC})
env.Alias('doc', env.DocGenCC(target = ['#/doc/doxygen/CC/html/index.html'],
source = scanFiles("src/libsrc++", accept=["*.[ch]", "*.cc", "*.hxx"]) ))
if doJava:
def docGeneratorJava(target, source, env):
cmd = 'ant javadoc'
output = os.popen(cmd).read()
return
docBuildJava = Builder(action = docGeneratorJava)
env.Append(BUILDERS = {'DocGenJava' : docBuildJava})
env.Alias('doc', env.DocGenJava(target = ['#/doc/javadoc/index.html'],
source = scanFiles(javaDir, accept=["*.java"]) ))
return 1
def removeDocs(env):
"""Remove all generated documentation (doxygen & javadoc)."""
def docRemover(target, source, env):
cmd = 'rm -fr doc/javadoc doc/doxygen/C doc/doxygen/CC'
output = os.popen(cmd).read()
return
docRemoveAll = Builder(action = docRemover)
env.Append(BUILDERS = {'DocRemove' : docRemoveAll})
# remove documentation
env.Alias('undoc', env.DocRemove(target = ['#/.undoc'], source = None))
return 1
###################
# Tar file
###################
def generateTarFile(env, baseName, majorVersion, minorVersion):
"""Generate a gzipped tar file of the current directory."""
# Function that does the tar. Note that tar on Solaris is different
# (more primitive) than tar on Linux and MacOS. Solaris tar has no -z option
# and the exclude file does not allow wildcards. Thus, stick to Linux for
# creating the tar file.
def tarballer(target, source, env):
dirname = os.path.basename(os.path.abspath('.'))
cmd = 'tar -X tar/tarexclude -C .. -c -z -f ' + str(target[0]) + ' ./' + dirname
pipe = Popen(cmd, shell=True, stdin=PIPE).stdout
return pipe
# name of tarfile (software package dependent)
tarfile = 'tar/' + baseName + '-' + majorVersion + '.' + minorVersion + '.tgz'
# Use a Builder instead of env.Tar() since I can't make that work.
# It runs into circular dependencies since we copy tar file to local
# ./tar directory
tarBuild = Builder(action = tarballer)
env.Append(BUILDERS = {'Tarball' : tarBuild})
env.Alias('tar', env.Tarball(target = tarfile, source = None))
return 1
File added
File added
package org.jlab.coda.jevio;
import java.nio.ByteBuffer;
import java.nio.ByteOrder;
/**
* This the header for an evio bank structure (<code>EvioBank</code>). It does not contain the raw data, just the
* header. Note: since an "event" is really just the outermost bank, this is also the header for an
* <code>EvioEvent</code>.
*
* @author heddle
*
*/
public final class BankHeader extends BaseStructureHeader {
/**
* Null constructor.
*/
public BankHeader() {
}
/**
* Constructor
* @param tag the tag for the bank header.
* @param dataType the data type for the content of the bank.
* @param num sometimes, but not necessarily, an ordinal enumeration.
*/
public BankHeader(int tag, DataType dataType, int num) {
super(tag, dataType, num);
}
/**
* {@inheritDoc}
*/
public int getHeaderLength() {return 2;}
/**
* {@inheritDoc}
*/
protected void toArray(byte[] bArray, int offset, ByteOrder order) {
try {
// length first
ByteDataTransformer.toBytes(length, order, bArray, offset);
if (order == ByteOrder.BIG_ENDIAN) {
ByteDataTransformer.toBytes((short)tag, order, bArray, offset+4);
// lowest 6 bits are dataType, upper 2 bits are padding
bArray[offset+6] = (byte)((dataType.getValue() & 0x3f) | (padding << 6));
bArray[offset+7] = (byte)number;
}
else {
bArray[offset+4] = (byte)number;
bArray[offset+5] = (byte)((dataType.getValue() & 0x3f) | (padding << 6));
ByteDataTransformer.toBytes((short)tag, order, bArray, offset+6);
}
}
catch (EvioException e) {e.printStackTrace();}
}
/**
* Obtain a string representation of the bank header.
*
* @return a string representation of the bank header.
*/
@Override
public String toString() {
StringBuffer sb = new StringBuffer(512);
sb.append(String.format("bank length: %d\n", length));
sb.append(String.format("number: %d\n", number));
sb.append(String.format("data type: %s\n", getDataTypeName()));
sb.append(String.format("tag: %d\n", tag));
sb.append(String.format("padding: %d\n", padding));
return sb.toString();
}
/**
* Write myself out a byte buffer. This write is relative--i.e., it uses the current position of the buffer.
*
* @param byteBuffer the byteBuffer to write to.
* @return the number of bytes written, which for a BankHeader is 8.
*/
public int write(ByteBuffer byteBuffer) {
byteBuffer.putInt(length);
if (byteBuffer.order() == ByteOrder.BIG_ENDIAN) {
byteBuffer.putShort((short)tag);
byteBuffer.put((byte)((dataType.getValue() & 0x3f) | (padding << 6)));
byteBuffer.put((byte)number);
}
else {
byteBuffer.put((byte)number);
byteBuffer.put((byte)((dataType.getValue() & 0x3f) | (padding << 6)));
byteBuffer.putShort((short)tag);
}
return 8;
}
}
This diff is collapsed.
package org.jlab.coda.jevio;
import java.nio.ByteOrder;
/**
* This the header for the base structure (<code>BaseStructure</code>). It does not contain the raw data, just the
* header. The three headers for the actual structures found in evio (BANK, SEGMENT, and TAGSEMENT) all extend this.
*
* @author heddle
*
*/
public abstract class BaseStructureHeader implements Cloneable, IEvioWriter {
/**
* The length of the structure in ints. This never includes the
* first header word itself (which contains the length).
*/
protected int length;
/**
* The structure tag.
*/
protected int tag;
/**
* The data type of the structure.
*/
protected DataType dataType;
/**
* The amount of padding bytes when storing short or byte data.
* Allowed value is 0, 1, 2, or 3 (0,2 for shorts and 0-3 for bytes)
* and is stored in the upper 2 bits of the dataType when written out.
*/
protected int padding;
/**
* The number represents an unsigned byte. Only Banks have a number
* field in their header, so this is only relevant for Banks.
*/
protected int number;
/**
* Null constructor.
*/
public BaseStructureHeader() {
}
/**
* Constructor
* @param tag the tag for the header.
* @param dataType the enum data type for the content of the structure.
*/
public BaseStructureHeader(int tag, DataType dataType) {
this(tag, dataType, 0);
}
/**
* Constructor
* @param tag the tag for the header.
* @param dataType the data type for the content of the structure.
* @param num sometimes, but not necessarily, an ordinal enumeration.
*/
public BaseStructureHeader(int tag, DataType dataType, int num) {
this.tag = tag;
this.dataType = dataType;
setNumber(num);
}
/**
* Clone this object by passing responsibility to the Object class
* which creates a bitwise copy which is fine since all fields are
* ints or enums.
*/
public Object clone() {
try {
return super.clone();
}
catch (CloneNotSupportedException e) {
return null;
}
}
/**
* Get the number. Only Banks have a number field in their header, so this is only relevant for Banks.
*
* @return the number.
*/
public int getNumber() {
return number;
}
/**
* Set the number. Only Banks have a number field in their header, so this is only relevant for Banks.
*
* @param number the number.
*/
public void setNumber(int number) {
//num is really an unsigned byte
if (number < 0) {
number += 256;
}
this.number = number & 0xff;
}
/**
* Get the data type for the structure.
*
* @return the data type for the structure.
*/
public int getDataTypeValue() {
return dataType.getValue();
}
/**
* Set the numeric data type for the structure.
*
* @param dataType the dataTtype for the structure.
*/
void setDataType(int dataType) {
this.dataType = DataType.getDataType(dataType);
}
/**
* Set the numeric data type for the structure.
*
* @param dataType the dataTtype for the structure.
*/
public void setDataType(DataType dataType) {
this.dataType = dataType;
}
/**
* Returns the data type for data stored in this structure as a <code>DataType</code> enum.
*
* @return the data type for data stored in this structure as a <code>DataType</code> enum.
* @see DataType
*/
public DataType getDataType() {
return dataType;
}
/**
* Returns the data type as a string.
*
* @return the data type as a string.
*/
public String getDataTypeName() {
return dataType.name();
}
/**
* Get the amount of padding bytes when storing short or byte data.
* Value is 0, 1, 2, or 3 for bytes and 0 or 2 for shorts.
* @return number of padding bytes
*/
public int getPadding() {
return padding;
}
/**
* Set the amount of padding bytes when storing short or byte data.
* Allowed value is 0, 1, 2, or 3 for bytes and 0 or 2 for shorts.
* @param padding amount of padding bytes when storing short or byte data (0-3).
*/
protected void setPadding(int padding) {
this.padding = padding;
}
/**
* Get the length of the structure in ints, not counting the length word.
*
* @return Get the length of the structure in ints (not counting the length word).
*/
public int getLength() {
return length;
}
/**
* Set the length of the structure in ints, not counting the length word.
*
* @param length the length of the structure in ints, not counting the length word.
*/
public void setLength(int length) {
this.length = length;
}
/**
* Get the length of the structure's header in ints. This includes the first header word itself
* (which contains the length) and in the case of banks, it also includes the second header word.
*
* @return Get the length of the structure's header in ints.
*/
public abstract int getHeaderLength();
/**
* Write myself out as a byte array of evio format data
* into the given byte array in the specified byte order.
*/
protected abstract void toArray(byte[] bArray, int offset, ByteOrder order);
/**
* Get the structure tag.
*
* @return the structure tag.
*/
public int getTag() {
return tag;
}
/**
* Set the structure tag.
*
* @param tag the structure tag.
*/
public void setTag(int tag) {
this.tag = tag;
}
/**
* Obtain a string representation of the structure header.
*
* @return a string representation of the structure header.
*/
@Override
public String toString() {
StringBuffer sb = new StringBuffer(512);
sb.append(String.format("structure length: %d\n", length));
sb.append(String.format("data type: %s\n", getDataTypeName()));
sb.append(String.format("tag: %d\n", tag));
sb.append(String.format("padding: %d\n", padding));
return sb.toString();
}
/**
* Convenience method to return the byte value of an integer. Although
* the parameter is an Integer, use "autoboxing" to pass in a primitive. I.e.,
* byteValue(3) works just fine.
* @param integer the integer whose byte value is needed. Can pass in a primitive int.
* @return the byte value of the integer.
*/
public byte byteValue(Integer integer) {
return integer.byteValue();
}
/**
* Convenience method to return the short value of an integer. Although
* the parameter is an Integer, use "autoboxing" to pass in a primitive. I.e.,
* shortValue(3345) works just fine.
* @param integer the integer whose short value is needed. Can pass in a primitive int.
* @return the short value of the integer.
*/
public short shortValue(Integer integer) {
return integer.shortValue();
}
}
This diff is collapsed.
This diff is collapsed.
package org.jlab.coda.jevio;
import java.util.ArrayList;
/**
* This class is used to store relevant info about an evio block
* along with its position in a buffer, without having to de-serialize anything.
*
* @author timmer
* Date: 11/13/12
*/
final class BlockNode {
/** Block's length value (32-bit words). */
int len;
/** Number of events in block. */
int count;
/** Position of block in file/buffer. */
int pos;
/**
* Place of this block in file/buffer. First block = 0, second = 1, etc.
* Useful for appending banks to EvioEvent object.
*/
int place;
/** Next block in file/buffer (simple linked list). */
BlockNode nextBlock;
/** List of all event nodes in block. */
ArrayList<EvioNode> allEventNodes;
//----------------------------------
// Constructor (package accessible)
//----------------------------------
/** Constructor which creates list containing all events in this block. */
BlockNode() {
allEventNodes = new ArrayList<EvioNode>(1000);
}
//-------------------------------
// Methods
//-------------------------------
public void clearLists() {
allEventNodes.clear();
}
}
package org.jlab.coda.jevio;
import java.nio.ByteBuffer;
import java.util.ArrayList;
/**
* This class is used to store relevant info about an
* evio version 4 format buffer.
*
* @author timmer
* Date: 2/5/14
*/
public final class BufferNode {
/** ByteBuffer associated with this node. */
ByteBuffer buffer;
/** Blocks contained in the buffer. */
ArrayList<BlockNode> blockNodes;
/**
* If top-level event node, was I scanned and all my blocks
* already placed into lists?
*/
boolean scanned;
//----------------------------------
// Constructor (package accessible)
//----------------------------------
/**
* Constructor which stores buffer and creates list of block nodes.
* @param buffer buffer with evio version 4 file-format data.
*/
BufferNode(ByteBuffer buffer) {
this.buffer = buffer;
blockNodes = new ArrayList<BlockNode>(1000);
}
//-------------------------------
// Methods
//-------------------------------
public void clearLists() {
blockNodes.clear();
}
//-------------------------------
// Getters
//-------------------------------
/**
* Get the byte buffer.
* @return byte buffer.
*/
public ByteBuffer getBuffer() {
return buffer;
}
}
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment