Go to the documentation of this file. 1 #ifndef SOCKETCAN_INTERFACE_DUMMY_H
2 #define SOCKETCAN_INTERFACE_DUMMY_H
4 #include <unordered_map>
9 #include <boost/algorithm/string.hpp>
16 using Map = std::unordered_map<std::string, Frame>;
24 if(multi ||
map_.find(k) ==
map_.end()){
25 map_.insert( std::make_pair(boost::to_lower_copy(k), v));
33 bool add(
const std::string &k,
const Frame &v,
bool multi){
34 return add_noconv(boost::to_lower_copy(k), v, multi);
39 bool add(
const std::string &k,
const std::string &v,
bool multi){
42 bool add(
const Frame &k,
const std::string &v,
bool multi){
48 std::pair <Map::iterator, Map::iterator> r =
map_.equal_range(
tostring(msg,
true));
49 for (Map::iterator it=r.first; it!=r.second; ++it){
53 catch(
const std::out_of_range &e){
73 if (!internal_error) {
84 bool init(
const std::string &device,
bool loopback){
FrameListener::ListenerConstSharedPtr FrameListenerConstSharedPtr
std::string tostring(const Header &h, bool lc)
StateListener::ListenerConstSharedPtr StateListenerConstSharedPtr
bool add(const std::string &k, const Frame &v, bool multi)
std::function< void(const Frame &)> FrameFunc
std::shared_ptr< DummyInterface > DummyInterfaceSharedPtr
virtual FrameListenerConstSharedPtr createMsgListener(const FrameFunc &delegate)
BaseClass::ListenerConstSharedPtr createListener(const K &key, const typename BaseClass::Callable &callable)
bool add(const Frame &k, const std::string &v, bool multi)
virtual bool send(const Frame &msg)
DummyInterface(bool loopback)
virtual StateListenerConstSharedPtr createStateListener(const StateFunc &delegate)
bool add_noconv(const std::string &k, const Frame &v, bool multi)
StateDispatcher state_dispatcher_
bool add(const Frame &k, const Frame &v, bool multi)
void dispatch(const Type &obj)
virtual FrameListenerConstSharedPtr createMsgListener(const Frame::Header &h, const FrameFunc &delegate)
Frame toframe(const std::string &s)
std::function< void(const State &)> StateFunc
std::unordered_map< std::string, Frame > Map
ListenerConstSharedPtr createListener(const Callable &callable)
bool add(const std::string &k, const std::string &v, bool multi)
virtual bool doesLoopBack() const
enum can::State::DriverState driver_state
FrameDispatcher frame_dispatcher_
void dispatch(const K &key, const typename BaseClass::Type &obj)
unsigned int internal_error
driver specific error
virtual bool translateError(unsigned int internal_error, std::string &str)
bool init(const std::string &device, bool loopback)