File: OutputSampleList.hpp

package info (click to toggle)
pbseqlib 0~20161219-1
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 5,924 kB
  • ctags: 5,123
  • sloc: cpp: 82,727; makefile: 305; python: 239; sh: 8
file content (33 lines) | stat: -rw-r--r-- 767 bytes parent folder | download | duplicates (4)
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
#ifndef _SIMULATOR_OUTPUT_SAMPLE_LIST_HPP_
#define _SIMULATOR_OUTPUT_SAMPLE_LIST_HPP_

#include <vector>
#include "OutputSample.hpp"

class OutputSampleList: public std::vector<OutputSample> {
public:
    void Write(ofstream &out) {
        int nElem = this->size();
        out.write((char*)&nElem, sizeof(int));
        if (nElem > 0) {
            int i;
            for (i = 0; i < nElem; i++) {
                (*this)[i].Write(out);
            }
        }
    }

    void Read(std::ifstream &in) {
        int nElem;
        in.read((char*) &nElem, sizeof(int));
        if (nElem > 0) {
            this->resize(nElem);
            int i;
            for (i = 0; i < nElem; i++) {
                (*this)[i].Read(in);
            }
        }
    }
};

#endif