AtilaCalculatorSoftware  2.3.4
C++ Interface for Atila fem resources files
binary_data.h
Go to the documentation of this file.
1 /*=========================================================================
2 
3  Project: AtilaCalculatorSoftware
4  File: binary_data.h
5 
6  Copyright (c) 2020
7  All rights reserved.
8 
9 =========================================================================*/
10 #ifndef ATILACALCULATORSOFTWARE_BINARY_DATA_H
11 #define ATILACALCULATORSOFTWARE_BINARY_DATA_H
12 
13 #include "core/mesh.h"
14 #include "core/result.h"
15 #include "logger/logger.h"
16 
17 #include <QString>
18 #include <functional>
19 #include <gidpost.h>
20 #include <iostream>
21 #include <memory>
22 #include <optional>
23 #include <string>
24 #include <vector>
25 #include <zlib.h>
26 
31 class BinaryData {
32  public:
36  explicit BinaryData(const std::string& file);
37 
41  gzFile getFile();
42 
46  std::vector<Mesh>& getMeshes();
47 
51  std::vector<Result>& getResults();
52 
56  ~BinaryData();
57 
61  void readMeshes();
62 
67  std::optional<Result> readResult();
68 
74  std::vector<Result> readResults(unsigned int n = 0);
75 
76  protected:
80  gzFile file;
81 
85  std::vector<Mesh> meshes;
86 
90  std::vector<Result> results;
91 
95  const static int byteOrderCheck = 0x91d;
96 };
97 
98 #endif // ATILACALCULATORSOFTWARE_BINARY_DATA_H
std::vector< Result > & getResults()
Definition: binary_data.cpp:47
void readMeshes()
Definition: binary_data.cpp:53
std::vector< Result > readResults(unsigned int n=0)
Read the n given results, stops if there is no more result.
Definition: binary_data.cpp:109
~BinaryData()
Closes open files.
Definition: binary_data.cpp:32
BinaryData(const std::string &file)
Definition: binary_data.cpp:16
static const int byteOrderCheck
Constant value for reading check.
Definition: binary_data.h:95
std::vector< Mesh > meshes
Read meshes.
Definition: binary_data.h:85
gzFile getFile()
Definition: binary_data.cpp:44
std::vector< Mesh > & getMeshes()
Definition: binary_data.cpp:46
Load the resources file and allow to read meshes and results from it.
Definition: binary_data.h:31
std::optional< Result > readResult()
Read one result from the res gzFile.
Definition: binary_data.cpp:81
gzFile file
Opened res gzFile.
Definition: binary_data.h:80
std::vector< Result > results
Read meshes.
Definition: binary_data.h:90