Program Listing for File swarm_iterator.hpp

Return to documentation for file (cosm/pal/ros/swarm_iterator.hpp)

#pragma once

/*******************************************************************************
 * Includes
 ******************************************************************************/
#include <string>

#include "cosm/pal/ros/swarm_manager_adaptor.hpp"
#include "cosm/hal/robot.hpp"
#include "cosm/ros/topic.hpp"
#include "cosm/pal/pal.hpp"

/*******************************************************************************
 * Namespaces/Decls
 ******************************************************************************/
namespace cosm::pal::ros {

/*******************************************************************************
 * Struct Definitions
 ******************************************************************************/
struct swarm_iterator {
  template <typename TFunction>
  static void robots(size_t n_robots,
                     const TFunction& cb) {
    for (size_t i = 0; i < n_robots; ++i) {
      auto robot_ns = cros::to_ns(rtypes::type_uuid(i));
      cb(robot_ns);
    } /* for(i..) */
  }
};

} /* namespace cosm::pal::ros */