File: HDFCmpRootGroup.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 (66 lines) | stat: -rw-r--r-- 1,753 bytes parent folder | download | duplicates (2)
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
#ifndef _BLASR_HDF_CMP_ROOT_GROUP_HPP_
#define _BLASR_HDF_CMP_ROOT_GROUP_HPP_

#include "HDFAtom.hpp"
#include "HDF2DArray.hpp"
#include "../alignment/datastructures/alignment/CmpFile.hpp"
template <typename T_Alignment>
class HDFCmpRootGroup {
 public:
	HDFGroup rootGroup;
	HDFAtom<string> version;
	HDFAtom<string> index;
	HDFAtom<string> readType;
	HDFAtom<string> commandLine;
	HDF2DArray<string> fileLog;

	~HDFCmpRootGroup() {
		rootGroup.Close();
	}

	int Initialize(H5::H5File &cmpFile) {
		if (rootGroup.Initialize(cmpFile, "/") == 0) { return 0; }
		if (rootGroup.ContainsObject("Version")) {
			if (version.Initialize(rootGroup.group, "Version") == 0) { return 0; }		
		}
		if (rootGroup.ContainsObject("Index")) {
			if (index.Initialize(rootGroup.group, "Index") == 0) { return 0; }
		}
		if (rootGroup.ContainsObject("ReadType")) {
			if (readType.Initialize(rootGroup.group, "ReadType") == 0) { return 0; }
		}
		if (rootGroup.ContainsObject("CommandLine")) {
			if (commandLine.Initialize(rootGroup.group, "CommandLine") == 0) { return 0; }
		}
		
		//
		// For now, disable file log initialization until
		// hdf2darray<string> is tested more thoroughly 
		//
		// if (fileLog.Initialize(rootGroup.group, "FileLog") == 0) {
		// return 0;}
		//
		return 1;
	}
	
	void ReadAttributes(CmpFile &cmpFile) {
		if (rootGroup.ContainsObject("Version")) {
		version.Read(cmpFile.version);
		}
		if (rootGroup.ContainsObject("Index")) {
			index.Read(cmpFile.index);
		}
		if (rootGroup.ContainsObject("ReadType")) {
      string readTypeString;
      readType.Read(readTypeString);
      cmpFile.StoreReadType(readTypeString);
		}
		if (rootGroup.ContainsObject("CommandLine")) {
		commandLine.Read(cmpFile.commandLine);
		}
	}
};
 
	

#endif