halapi hierarchichalalignmentformatapi

- Main Page
- Namespaces
- Classes
- Files

- File List

hdf5_impl/hdf5BottomSegmentType.h

    00001 /*
    00002  * Copyright (C) 2012 by Glenn Hickey (hickey@soe.ucsc.edu)
    00003  *
    00004  * Released under the MIT license, see LICENSE.txt
    00005  */
    00006
    00007 #ifndef _HDF5BOTTOMSEGMENTTYPE_H
    00008 #define _HDF5BOTTOMSEGMENTTYPE_H
    00009
    00010 #include <sstream>
    00011 #include "bottomSegmentType.h"
    00012 #include "rawH5ExternalArray.h"
    00013 #include "rawH5ExternalArrayTraits.h"
    00014
    00015
    00016 namespace hal {
    00017
    00021 struct BottomSegmentType<RawH5ExternalArray>
    00022 {
    00023    typedef ArrayTraits<RawH5ExternalArray>::size_type size_type;
    00024    typedef ArrayTraits<RawH5ExternalArray>::index_type index_type;
    00025    typedef ArrayTraits<RawH5ExternalArray>::bool_type bool_type;
    00026    typedef ArrayTraits<RawH5ExternalArray>::h5index_type h5index_type;
    00027    typedef ArrayTraits<RawH5ExternalArray>::h5bool_type h5bool_type;
    00028
    00031    static H5::CompType getTypeInfo(size_type numChildren);
    00032
    00033    static size_type getGenomeIndexOffset();
    00034    static size_type getLengthOffset();
    00035    static size_type getTopIndexOffset();
    00036    static size_type getTopOffsetOffset();
    00037    static size_type getChildIndexOffset(size_type i);
    00038    static size_type getChildInverseOffset(size_type i);
    00039 };
    00040
    00041 // INLINE MEMBERS
    00042
    00043 inline size_type BottomSegmentType<RawH5ExternalArray>::getGenomeIndexOffset()
    00044 {
    00045   return 0;
    00046 }
    00047
    00048 inline size_type BottomSegmentType<RawH5ExternalArray>::getLengthOffset()
    00049 {
    00050   return sizeof(index_type);
    00051 }
    00052
    00053 inline size_type BottomSegmentType<RawH5ExternalArray>::getTopIndexOffset()
    00054 {
    00055   return 2 * sizeof(index_type);
    00056 }
    00057
    00058 inline size_type BottomSegmentType<RawH5ExternalArray>::getTopOffsetOffset()
    00059 {
    00060   return 3 * sizeof(index_type);
    00061 }
    00062
    00063 inline size_type BottomSegmentType<RawH5ExternalArray>::
    00064 getChildIndexOffset(size_type i)
    00065 {
    00066   return 3 * sizeof(index_type) + (sizeof(index_type) + sizeof(bool_type)) * i;
    00067 }
    00068
    00069 inline size_type BottomSegmentType<RawH5ExternalArray>::
    00070 getChildInverseOffset(size_type i)
    00071 {
    00072   return getChildIndexOffset(i) + sizeof(bool_type);
    00073 }
    00074
    00075 inline H5::CompType BottomSegmentType<RawH5ExternalArray>::getTypeInfo(
    00076   hsize_t numChildren)
    00077 {
    00078   H5::CompType dataType;
    00079   dataType.insertMember("genomeIdx", getGenomeIndexOffset(), h5index_type);
    00080   dataType.insertMember("length", getLengthOffset(), h5index_type);
    00081   dataType.insertMember("topIdx", getTopIndexOffset(), h5index_type);
    00082   dataType.insertMember("topOffset", getTopOffsetOffset(), h5index_type);
    00083   for(H5::hsize_t i = 0; i < numChildren; ++i)
    00084   {
    00085     std::stringstream ss;
    00086     ss << i;
    00087     H5::H5std_string number = ss.str();
    00088     dataType.insertMember("childIdx" + number, getChildIndexOffset(i),
    00089                           h5index_type);
    00090     dataType.insertMember("reverseFlag" + number, getChildInverseOffset(i),
    00091                           h5bool_type);
    00092   }
    00093   return dataType;
    00094 }
    00095
    00096 }
    00097 #endif

All Classes Namespaces Functions Variables Typedefs Friends