Line data Source code
1 : /* 2 : Copyright 2018-2024, Barcelona Supercomputing Center (BSC), Spain 3 : Copyright 2015-2024, Johannes Gutenberg Universitaet Mainz, Germany 4 : 5 : This software was partially supported by the 6 : EC H2020 funded project NEXTGenIO (Project ID: 671951, www.nextgenio.eu). 7 : 8 : This software was partially supported by the 9 : ADA-FS project under the SPPEXA project funded by the DFG. 10 : 11 : This file is part of GekkoFS' POSIX interface. 12 : 13 : GekkoFS' POSIX interface is free software: you can redistribute it and/or 14 : modify it under the terms of the GNU Lesser General Public License as 15 : published by the Free Software Foundation, either version 3 of the License, 16 : or (at your option) any later version. 17 : 18 : GekkoFS' POSIX interface is distributed in the hope that it will be useful, 19 : but WITHOUT ANY WARRANTY; without even the implied warranty of 20 : MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 21 : GNU Lesser General Public License for more details. 22 : 23 : You should have received a copy of the GNU Lesser General Public License 24 : along with GekkoFS' POSIX interface. If not, see 25 : <https://www.gnu.org/licenses/>. 26 : 27 : SPDX-License-Identifier: LGPL-3.0-or-later 28 : */ 29 : 30 : #ifndef GEKKOFS_OPEN_DIR_HPP 31 : #define GEKKOFS_OPEN_DIR_HPP 32 : 33 : #include <string> 34 : #include <vector> 35 : 36 : #include <client/open_file_map.hpp> 37 : 38 : namespace gkfs::filemap { 39 : 40 8270 : class DirEntry { 41 : private: 42 : std::string name_; 43 : FileType type_; 44 : 45 : public: 46 : DirEntry(const std::string& name, FileType type); 47 : 48 : const std::string& 49 : name(); 50 : 51 : FileType 52 : type(); 53 : }; 54 : 55 28 : class OpenDir : public OpenFile { 56 : private: 57 : std::vector<DirEntry> entries; 58 : 59 : 60 : public: 61 : explicit OpenDir(const std::string& path); 62 : 63 : void 64 : add(const std::string& name, const FileType& type); 65 : 66 : const DirEntry& 67 : getdent(unsigned int pos); 68 : 69 : size_t 70 : size(); 71 : }; 72 : 73 : } // namespace gkfs::filemap 74 : 75 : #endif // GEKKOFS_OPEN_DIR_HPP