File: testRead.cc

package info (click to toggle)
srf 0.1%2Bdfsg-4
  • links: PTS, VCS
  • area: main
  • in suites: jessie, jessie-kfreebsd, stretch
  • size: 3,964 kB
  • ctags: 183
  • sloc: cpp: 1,165; sh: 558; makefile: 37
file content (69 lines) | stat: -rw-r--r-- 1,331 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
//
#include <ios>
#include <iostream>
#include <fstream>
#include <sstream>
#include <string>
#include <stddef.h>
#include <SRF_Container.hh>
#include <SRF_ReadSet.hh>
#include <SRF_Read.hh>
#include <SRF_File.hh>

#include <stdio.h>
#include <string.h>
#include <stdlib.h>

#include <io_lib/Read.h>
#include <io_lib/misc.h>
#include <io_lib/hash_table.h>
#include <io_lib/ztr.h>
#include <zlib.h>

template <class T>
std::string to_string(T t, std::ios_base & (*f)(std::ios_base&))
{
  std::ostringstream oss;
  oss << f << t;
  return oss.str();
}


int main(int argc, char* argv[])
{
    if ( argc != 2 )
    {
        std::cout << "Usage: reader <input file>\n";
        exit(1);
    }

    SRF_File::openType mode = SRF_File::openTypeRead;
    SRF_File file( argv[1], mode );

    SRF_Container* container = file.getCurrentContainer();

    if ( container == NULL )
    {
        SRF_ReportError( "error opening container" );
        exit (1);
    }

    container->dump();

    SRF_ReadSet* readSet = container->firstReadSet( file.getFile() );

    if ( readSet == NULL )
    {
        SRF_ReportError( "error opening readset" );
        exit (1);
    }

    readSet->dump();
    
    SRF_Read* read = NULL;
    while ( ( read = readSet->getRead( file.getFile() )) != NULL )
    {
        read->dump();
    }
    return 0;
}