• Classes
  • Modules
  • Namespaces
  • Files
  • Related Pages
  • File List
  • File Members

bulkDataNTConfiguration.h

Go to the documentation of this file.
00001 #ifndef _BULK_DATA_NT_CONFIGURATION_H_
00002 #define _BULK_DATA_NT_CONFIGURATION_H_
00003 
00004 /*******************************************************************************
00005 * ALMA - Atacama Large Millimiter Array
00006 * (c) European Southern Observatory, 2011
00007 *
00008 * This library is free software; you can redistribute it and/or
00009 * modify it under the terms of the GNU Lesser General Public
00010 * License as published by the Free Software Foundation; either
00011 * version 2.1 of the License, or (at your option) any later version.
00012 *
00013 * This library is distributed in the hope that it will be useful,
00014 * but WITHOUT ANY WARRANTY; without even the implied warranty of
00015 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00016 * Lesser General Public License for more details.
00017 *
00018 * You should have received a copy of the GNU Lesser General Public
00019 * License along with this library; if not, write to the Free Software
00020 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307  USA
00021 *
00022 * "@(#) $Id: bulkDataNTConfiguration.h,v 1.41 2013/01/18 07:47:50 bjeram Exp $"
00023 *
00024 * who       when        what
00025 * --------  ---------   ----------------------------------------------
00026 * rtobar    011-08-01   created
00027 */
00028 
00029 #ifndef __cplusplus
00030 #error This is a C++ include file and cannot be used from plain C
00031 #endif
00032 
00033 #include <map>
00034 #include <string>
00035 
00036 namespace AcsBulkdata
00037 {
00038 
00044 bool isBulkDataNTEnabled();
00045 
00047 //  ... but can be later split if needed
00048 class DDSConfiguration
00049 {
00050         friend class BulkDataNTDDS;
00051         friend class BulkDataNTStream;
00052         friend class BulkDataNTDDSSubscriber;
00053         friend class BulkDataNTDDSPublisher;
00054         friend class BulkDataConfigurationParser;
00055 public:
00056         DDSConfiguration();
00057 
00062         std::string getQosLibrary() const {     return libraryQos; }
00063 
00070         void setQosLibrary(std::string libraryQos) {            this->libraryQos = libraryQos;  }
00071 
00076         std::string getQosProfile() const {     return profileQos;      }
00077 
00084         void setQosProfile(std::string profileQos) {    this->profileQos = profileQos;  }
00085 
00089         static const char* const DEFAULT_LIBRARY;
00093         static const char* const DEFAULT_SENDER_STREAM_PROFILE;
00097         static const char* const DEFAULT_SENDER_FLOW_PROFILE;
00101         static const char* const DEFAULT_RECEIVER_STREAM_PROFILE;
00105         static const char* const DEFAULT_RECEIVER_FLOW_PROFILE;
00109         static const char* const DEFAULT_API_CREATE_PROFILE;
00113         static short debugLevel;
00114 
00115         std::string getStringProfileQoS() {
00116                 return stringProfileQoS;
00117         }
00118 
00119 protected:
00123         static void setDebugLevelFromEnvVar();
00127         static void setDDSLogVerbosity();
00128         std::string libraryQos;
00130         std::string profileQos;
00132 
00137         void setStringProfileQoS(char* cfg, const char* defaultProfile);
00144         void setStringProfileQoS(char* profileName, char* cfg,
00145                         const char* defaultProfile);
00146         std::string stringProfileQoS;
00148         // QoS that follow can be hardcoded, but is more flexible in this way.
00149         static bool ignoreUserProfileQoS; //when true USER_QOS_PROFILES.xml in current folder would not be loaded
00150         static bool ignoreEnvironmentProfileQoS; //when true NDDS_QOS_PROFILES will be ignored
00151         static unsigned int DDSLogVerbosity; // log level for RTI DDS, the type should be NDDS_Config_LogVerbosity
00152         static const char* const DEFAULT_QoS_FILE;
00153         static std::string urlProfileQoS;
00154 
00156         void fillUrlProfileQoS(const char*suffix=NULL);
00158         bool findProfileQoS(const char* path, const char*suffix=NULL);
00159 };//DDSConfiguration
00160 
00161 
00163 class StreamConfiguration : public DDSConfiguration
00164 {
00165         friend class BulkDataNTStream;
00166         friend class BulkDataConfigurationParser;
00167 public:
00168         StreamConfiguration();
00169 
00170         bool isParticipantPerStream() const {   return participantPerStream;    }
00171         void setParticipantPerStream(bool participantPerStream) {       this->participantPerStream = participantPerStream;      }
00172 
00173     static bool DEFAULT_PARTICIPANT_PER_STREAM;
00174 protected:
00175         bool participantPerStream;  
00176 };//StreamConfiguration
00177 
00178 
00179 /****************************************/
00180 /* Sender-side configuration structures */
00181 /****************************************/
00182 
00184 class  SenderFlowConfiguration : public DDSConfiguration
00185 {
00186 public:
00187         SenderFlowConfiguration();
00188 
00193         void setDDSSenderFlowQoS(char *cfg);
00194 
00200         void setDDSSenderFlowQoS(char *profileName, char* cfg);
00201 
00202 
00203         double getACKsTimeout() const;
00204     double getSendFrameTimeout() const;
00205     void setACKsTimeout(double acKsTimeout);
00206     void setSendFrameTimeout(double frameTimeout);
00207         double getThrottling() const;
00208         void setThrottling(double throttling);
00209 
00210     static double DEFAULT_SENDFRAME_TIMEOUT;
00211     static double DEFAULT_ACKs_TIMEOUT;
00212 
00213     static double DEFAULT_THROTTLING;
00214 protected:
00215     double sendFrameTimeout;
00216         double ACKsTimeout;
00217         double throttling;
00218 };
00219 
00222 class SenderStreamConfiguration : public StreamConfiguration
00223 {
00224 public:
00225         SenderStreamConfiguration();
00226 
00231         void setDDSSenderStreamQoS(char *cfg);
00232 
00238         void setDDSSenderStreamQoS(char *profileName, char* cfg);
00239 
00240 
00241         //      std::map<const char *, BulkDataNTSenderFlowConfiguration> flows;
00242 };
00243 
00244 
00245 /******************************************/
00246 /* Receiver-side configuration structures */
00247 /******************************************/
00248 
00252 enum ReceiverType {
00253         NORMAL    = 0x1,
00254         IMPORTANT = 0x2,
00255         CRITICAL  = 0x4
00256 };
00257 
00259 class ReceiverFlowConfiguration : public DDSConfiguration
00260 {
00261 public:
00262         ReceiverFlowConfiguration();
00263 
00268         void setDDSReceiverFlowQoS(char *cfg);
00269 
00275         void setDDSReceiverFlowQoS(char *profileName, char* cfg);
00276 
00277         double getCbReceiveProcessTimeout() const;
00278     void setCbReceiveProcessTimeout(double cbReceiveProcessTimeout);
00279 
00280     double getCbReceiveAvgProcessTimeout() const;
00281     void setCbReceiveAvgProcessTimeout(double cbReceiveAvgProcessTimeout);
00282 
00283     bool isEnableMulticast() const;
00284     void setEnableMulticast(bool enableMulticast);
00285 
00286     std::string getMulticastAddress() const;
00287     void setMulticastAddress(std::string multicastAddress);
00288 
00289     unsigned short getUnicastPort() const;
00290     void setUnicastPort(unsigned short);
00291 
00293     static const char* const DEFAULT_MULTICAST_ADDRESS;
00294 
00296     static double DEFAULT_CBRECEIVE_PROCESS_TIMEOUT;
00297 
00299     static double DEFAULT_CBRECEIVE_AVG_PROCESS_TIMEOUT;
00300 
00301     static bool DEFAULT_ENABLE_MULTICAST; 
00302 
00303     static unsigned short DEFAULT_UNICAST_PORT;  
00304 
00305 protected:
00306     double cbReceiveProcessTimeout; 
00307     double cbReceiveAvgProcessTimeout; 
00308     bool enableMulticast; 
00309     std::string multicastAddress; 
00310     unsigned short unicastPort; 
00311 };
00312 
00315 class ReceiverStreamConfiguration : public StreamConfiguration
00316 {
00317 public:
00318 
00319         ReceiverStreamConfiguration();
00320 
00325         void setDDSReceiverStreamQoS(char *cfg);
00326 
00332         void setDDSReceiverStreamQoS(char *profileName, char* cfg);
00333 
00334         bool isUseIncrementUnicastPort() const { return useIncrementUnicastPort;        }
00335         void setUseIncrementUnicastPort(bool usePort) { this->useIncrementUnicastPort = usePort;}
00336 
00337         unsigned short getBaseUnicastPort() const {     return baseUnicastPort; }
00338         void setBaseUnicastPort(unsigned short port) { this->baseUnicastPort = port;    }
00339 
00340         static bool DEFAULT_USE_INCREMENT_UNICAST_PORT; 
00341 
00342         static unsigned short DEFAULT_BASE_UNICAST_PORT;  
00343 protected:
00344         ReceiverType type;
00347         unsigned short baseUnicastPort;
00348         bool useIncrementUnicastPort; 
00349 };//ReceiverStreamConfiguration
00350 
00351 };
00352 
00353 #endif 

Generated on Mon May 4 2015 08:27:43 for ACS-2015.4 C++ API by  doxygen 1.7.0