Commit c0751114 authored by Matthieu Dorier's avatar Matthieu Dorier

added hepnos-ls program

parent 93595c07
......@@ -4,5 +4,9 @@ target_link_libraries(hepnos-daemon hepnos-service yaml-cpp margo sdskv-server)
add_executable(hepnos-shutdown hepnos-shutdown.cpp)
target_link_libraries(hepnos-shutdown hepnos yaml-cpp margo)
add_executable(hepnos-ls hepnos-ls.cpp)
target_link_libraries(hepnos-ls hepnos yaml-cpp margo)
install(TARGETS hepnos-shutdown DESTINATION bin)
install(TARGETS hepnos-daemon DESTINATION bin)
install(TARGETS hepnos-ls DESTINATION bin)
#include <iostream>
#include <hepnos.hpp>
void navigate_subrun(int level, hepnos::SubRun& sr) {
for(int i=0; i < level; i++) std::cout << " ";
std::cout << "| " << sr.number() << std::endl;
for(auto& e : sr) {
for(int i=0; i < level+1; i++) std::cout << " ";
std::cout << "| " << e.number() << std::endl;
}
}
void navigate_run(int level, hepnos::Run& r) {
for(int i=0; i < level; i++) std::cout << " ";
std::cout << "| " << r.number() << std::endl;
for(auto& sr : r) {
navigate_subrun(level+1, sr);
}
}
void navigate_dataset(int level, hepnos::DataSet& ds) {
for(int i=0; i < level; i++) std::cout << " ";
std::cout << "| " << ds.name() << std::endl;
for(auto& sub_ds : ds) {
navigate_dataset(level+1, sub_ds);
}
for(auto& r : ds.runs()) {
navigate_run(level+1, r);
}
}
int main(int argc, char* argv[])
{
if(argc != 2 ) {
std::cerr << "Usage: " << argv[0] << " <connection.yaml>" << std::endl;
exit(-1);
}
hepnos::DataStore datastore(argv[1]);
for(auto& ds : datastore) {
navigate_dataset(0, ds);
}
return 0;
}
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment