connector.h

00001 // Copyright (C) 2008,2009,2010 by Philipp Münzel. All rights reserved.
00002 // Released under the terms of the license described in license.txt
00003 
00004 #ifndef CONNECTOR_H
00005 #define CONNECTOR_H
00006 
00007 #include "dllexport.h"
00008 
00009 #include <vector>
00010 
00011 #include "canaerotypes.h"
00012 
00013 namespace SCS {
00014 
00020 template <typename Packet>
00021 class DLL_PUBLIC BusConnector
00022 {
00023 public:
00024 
00025     virtual ~BusConnector() {}
00026 
00031     virtual void send(const Packet& msg) = 0;
00032 
00037     virtual void send(const std::vector<Packet>& msg) = 0;
00038 
00043     virtual void receiveMessage(const Packet& msg) = 0;
00044 
00049     virtual void receiveMessage(const std::vector<Packet>& msg) = 0;
00050 };
00051 
00058 template <typename Packet>
00059 class DLL_PUBLIC NetworkConnector{
00060 public:
00061 
00062     virtual ~NetworkConnector() {}
00063 
00067     virtual void setListener(BusConnector<Packet>* connector) = 0;
00068 
00074     virtual void send(const void* msg, std::size_t bytes) = 0;
00075 };
00076 
00077 }
00078 
00079 #endif // CONNECTOR_H