switch.h
Go to the documentation of this file.
00001 /*
00002         Aseba - an event-based framework for distributed robot control
00003         Copyright (C) 2007--2012:
00004                 Stephane Magnenat <stephane at magnenat dot net>
00005                 (http://stephane.magnenat.net)
00006                 and other contributors, see authors.txt for details
00007         
00008         This program is free software: you can redistribute it and/or modify
00009         it under the terms of the GNU Lesser General Public License as published
00010         by the Free Software Foundation, version 3 of the License.
00011         
00012         This program is distributed in the hope that it will be useful,
00013         but WITHOUT ANY WARRANTY; without even the implied warranty of
00014         MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00015         GNU Lesser General Public License for more details.
00016         
00017         You should have received a copy of the GNU Lesser General Public License
00018         along with this program. If not, see <http://www.gnu.org/licenses/>.
00019 */
00020 
00021 #ifndef ASEBA_SWITCH
00022 #define ASEBA_SWITCH
00023 
00024 #include <dashel/dashel.h>
00025 #include <map>
00026 #include "../common/types.h"
00027 
00028 namespace Aseba
00029 {
00034 
00038         class Switch: public Dashel::Hub
00039         {
00040                 public:
00046                         Switch(unsigned port, bool verbose, bool dump, bool forward, bool rawTime);
00047                         
00052                         void forwardDataFrom(Dashel::Stream* stream);
00053                         
00055                         void broadcastDummyUserMessage();
00056                         
00062                         void remapId(Dashel::Stream* stream, const uint16 localId, const uint16 targetId);
00063                         
00064                 private:
00065                         virtual void connectionCreated(Dashel::Stream *stream);
00066                         virtual void incomingData(Dashel::Stream *stream);
00067                         virtual void connectionClosed(Dashel::Stream *stream, bool abnormal);
00068 
00069                 private:
00070                         bool verbose; 
00071                         bool dump; 
00072                         bool forward; 
00073                         bool rawTime; 
00074                         
00076                         typedef std::pair<uint16, uint16> IdPair;
00078                         typedef std::map<Dashel::Stream*, IdPair> IdRemapTable;
00079                         IdRemapTable idRemapTable; 
00080         };
00081         
00083 };
00084 
00085 #endif


aseba
Author(s): Stéphane Magnenat
autogenerated on Thu Jan 2 2014 11:17:17