Main Page | Modules | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members | Related Pages | Examples

VehicleNetConfig.h

Go to the documentation of this file.
00001 //////////////////////////////////////////////////////////////////////////////
00002 /*! \file VehicleNetConfig.h
00003  *  \brief Declares the VehicleNetConfig class, which manages the UDP network configuration.
00004  *  \author     $Author: rsharo $
00005  *  \version $Revision: 1.1 $
00006  *  \date    $Date: 2003/12/17 22:52:17 $
00007 *////////////////////////////////////////////////////////////////////////////
00008 
00009 #ifndef __VEHICLE_NET_CONFIG__
00010 #define __VEHICLE_NET_CONFIG__
00011 
00012 #include "Utils/SystemDefs.h"
00013 #include "ace/INET_Addr.h"
00014 
00015 #include "Utils/SystemProperties.h"
00016 
00017 class VehicleNetConfig
00018 {
00019         struct VehicleMapping
00020         {
00021                 explicit VehicleMapping(SystemDefs::VehicleID_t vehicleID=0,
00022                         const char *vehicleName="",
00023                         const ACE_INET_Addr &netAddress=ACE_INET_Addr())
00024                         : m_vehicleID(vehicleID), m_vehicleName(strdup(vehicleName)),
00025                           m_netAddress(netAddress)
00026                 {
00027                 }
00028 
00029                 explicit VehicleMapping(const VehicleMapping &rhs)
00030                         : m_vehicleID(rhs.m_vehicleID), m_vehicleName(rhs.m_vehicleName),
00031                           m_netAddress(rhs.m_netAddress)
00032                 {
00033                 }
00034 
00035                 ~VehicleMapping() { }
00036 
00037                 SystemDefs::VehicleID_t m_vehicleID;
00038                 std::string                             m_vehicleName;
00039                 ACE_INET_Addr                   m_netAddress;
00040         };
00041 
00042 public:
00043         VehicleNetConfig();
00044         explicit VehicleNetConfig(const char *mySectionName);
00045 
00046         virtual ~VehicleNetConfig();
00047 
00048         int Init(const char *mySectionName = "Vehicle Network");
00049 
00050         const ACE_INET_Addr &GetMulticastAddress() const { return m_mcastAddr; }
00051         const char *GetMulticastInterface() const { return m_pMcastInterface; }
00052         bool MulticastLoopbackEnabled() { return m_loopbackEnabled; }
00053         int MulticastTimeToLive() { return m_timeToLive; }
00054 
00055         const ACE_INET_Addr &GetVehicleAddress(SystemDefs::VehicleID_t vehicleID) const;
00056         SystemDefs::VehicleID_t VehicleAddressToID(const ACE_INET_Addr &addr) const;
00057 
00058 protected:
00059         int                              m_numMappings;
00060         VehicleMapping  *m_pMyMapping;
00061         VehicleMapping   m_unknownMapping;
00062         ACE_INET_Addr    m_mcastAddr;
00063         char                    *m_pMcastInterface;
00064         bool                     m_loopbackEnabled;
00065         int                              m_timeToLive;
00066 };
00067 
00068 #endif
00069 

Generated on Wed Sep 5 12:54:27 2007 for DSACSS Operational Code by  doxygen 1.3.9.1