| 20 | namespace |
| 21 | { |
| 22 | std::string ReadFile(const std::string& filename) |
| 23 | { |
| 24 | std::string contents; |
| 25 | vtksys::ifstream stream(filename.c_str(), std::ios::binary); |
| 26 | if (stream) |
| 27 | { |
| 28 | stream.seekg(0, std::ios::end); |
| 29 | const std::size_t flength = stream.tellg(); |
| 30 | stream.seekg(0, std::ios::beg); |
| 31 | std::vector<char> data(flength + 1 + (flength + 1) % 8); // padded for better alignment. |
| 32 | stream.read(data.data(), flength); |
| 33 | data[flength] = '\0'; |
| 34 | contents = data.data(); |
| 35 | } |
| 36 | return contents; |
| 37 | } |
| 38 | } |
| 39 | |
| 40 | RealDescriptor::RealDescriptor() = default; |