Download vendor/libigl/include/igl/FileMemoryStream.h from AVSim/simulation-package: direct link, hf CLI and curl.
- Browser
- Download file 1.68 kB
-
https://huggingface.co/datasets/AVSim/simulation-package/resolve/main/vendor/libigl/include/igl/FileMemoryStream.h
- Command line
-
hf download hf://datasets/AVSim/simulation-package/vendor/libigl/include/igl/FileMemoryStream.h
-
curl -L -o FileMemoryStream.h https://huggingface.co/datasets/AVSim/simulation-package/resolve/main/vendor/libigl/include/igl/FileMemoryStream.h
1.68 kB
| // This file is part of libigl, a simple c++ geometry processing library. | |
| // | |
| // Copyright (C) 2020 Jérémie Dumas <jeremie.dumas@ens-lyon.org> | |
| // Copyright (C) 2021 Alec Jacobson <alecjacobson@gmail.com> | |
| // | |
| // This Source Code Form is subject to the terms of the Mozilla Public License | |
| // v. 2.0. If a copy of the MPL was not distributed with this file, You can | |
| // obtain one at http://mozilla.org/MPL/2.0/. | |
| namespace igl { | |
| struct FileMemoryBuffer : public std::streambuf | |
| { | |
| char *p_start{nullptr}; | |
| char *p_end{nullptr}; | |
| size_t size; | |
| FileMemoryBuffer(char const *first_elem, size_t size) | |
| : p_start(const_cast<char *>(first_elem)), p_end(p_start + size), | |
| size(size) | |
| { | |
| setg(p_start, p_start, p_end); | |
| } | |
| pos_type seekoff( | |
| off_type off, | |
| std::ios_base::seekdir dir, | |
| std::ios_base::openmode which) override | |
| { | |
| if (dir == std::ios_base::cur) | |
| { | |
| gbump(static_cast<int>(off)); | |
| }else | |
| { | |
| setg(p_start,(dir==std::ios_base::beg ? p_start : p_end) + off,p_end); | |
| } | |
| return gptr() - p_start; | |
| } | |
| pos_type seekpos(pos_type pos, std::ios_base::openmode which) override | |
| { | |
| return seekoff(pos, std::ios_base::beg, which); | |
| } | |
| }; | |
| struct FileMemoryStream : virtual FileMemoryBuffer, public std::istream | |
| { | |
| FileMemoryStream( char const *first_elem, size_t size) | |
| : FileMemoryBuffer(first_elem, size), | |
| std::istream( static_cast<std::streambuf *>(this)) | |
| {} | |
| }; | |
| } | |