| 126 | string colouredString(string str, string colour, string option) { return option + colour + str + RESET; } |
| 127 | |
| 128 | bool createDirs(string folderPath, map<string, map<string, string>> sensor_info) { |
| 129 | path p(folderPath); |
| 130 | bool res = true; |
| 131 | if (exists(p)) { |
| 132 | cout << colouredString("\tCleaning previous dataset...", RED, REGULAR); |
| 133 | remove_all(p); |
| 134 | cout << colouredString("\t[DONE!]", GREEN, REGULAR) << endl; |
| 135 | } |
| 136 | |
| 137 | cout << colouredString("\tCreating dataset folder...", RED, REGULAR); |
| 138 | res = res && create_directories(p); |
| 139 | cout << colouredString("\t[DONE!]", GREEN, REGULAR) << endl; |
| 140 | |
| 141 | for (auto& iterator : sensor_info) { |
| 142 | std::stringstream sensor_folder; |
| 143 | sensor_folder << folderPath; |
| 144 | if (iterator.second.find(DATADIR) != iterator.second.end()) { |
| 145 | sensor_folder << "/" << iterator.second[DATADIR]; |
| 146 | } else { |
| 147 | sensor_folder << "/" << iterator.second[NAME]; |
| 148 | } |
| 149 | path sensor_path(sensor_folder.str()); |
| 150 | |
| 151 | res = res && create_directories(sensor_path); |
| 152 | } |
| 153 | |
| 154 | return res; |
| 155 | } |
| 156 | |
| 157 | void writeCameraHeader(shared_ptr<std::ofstream> file) { |
| 158 | *file << "#timestamp [ns]," |
no test coverage detected