Line data Source code
1 : #ifndef FELIX_BUS_H_ 2 : #define FELIX_BUS_H_ 3 : 4 : #include <string> 5 : #include <vector> 6 : #include "elink.hpp" 7 : #include "log.hpp" 8 : #include "felixbus/felixbus.hpp" 9 : 10 : class FelixBus; 11 : 12 : /** 13 : * Inteface class for felix-bus (medium for e-link advertisement) 14 : */ 15 27 : class Bus 16 : { 17 : public: 18 : /** 19 : * Felix-bus constructor. The bus filename is generated automatically 20 : * using the DMA buffer identifier. 21 : * 22 : * @param bus_dir bus directory. 23 : * @param bus_group bus group name. 24 : * @param dmaid DMA buffer number. 25 : * @param verbose option for the felix-bus. 26 : */ 27 : explicit Bus(const std::string& bus_dir, const std::string& bus_group, int dmaid, bool verbose); 28 : 29 : /** 30 : * Felix-bus constructor with ad-hoc filename. 31 : * 32 : * @param bus_dir bus directory. 33 : * @param bus_group bus group name. 34 : * @param filename bus file name, to set a custom file name. 35 : * @param verbose option for the felix-bus. 36 : */ 37 : explicit Bus(const std::string& bus_dir, const std::string& bus_group, const std::string& filename, bool verbose); 38 : 39 : Bus(const Bus &) = delete; 40 : Bus &operator=(const Bus &) = delete; 41 : 42 : /** 43 : * Publish on the current bus a list of e-links 44 : * 45 : * @param elinks vector of elinks. 46 : * @param ip local ip for the advertising application. 47 : * @param num_pages number of network buffers the client shall allocate. 48 : * @param page_size size of network buffers the client shall allocate. 49 : * @param pubsub publish/subscribe or send/receive? 50 : * @param unbuffered let the client know if unbuffer communication is used. 51 : */ 52 : bool publish(const std::vector<Elink> &elinks, 53 : const std::string &ip, uint32_t port, 54 : uint32_t num_pages = 0, uint32_t page_size = 0, 55 : bool pubsub = true, bool unbuffered = false); 56 : private: 57 : std::string m_felix_bus_path; 58 : felixbus::FelixBus m_bus; 59 : }; 60 : 61 : #endif /* FELIX_BUS_H_ */