OpenDaVINCI  4.15.3
WIN32UDPFactoryWorker.h
Go to the documentation of this file.
1 
20 #ifndef OPENDAVINCI_CORE_WRAPPER_WIN32IMPL_WIN32UDPFACTORYWORKER_H_
21 #define OPENDAVINCI_CORE_WRAPPER_WIN32IMPL_WIN32UDPFACTORYWORKER_H_
22 
23 #include <iostream>
24 #include <sstream>
25 #include <string>
26 
28 
34 
35 namespace odcore {
36  namespace wrapper {
37 
38  using namespace std;
39 
41  public:
42  static odcore::io::udp::UDPSender* createUDPSender(const string &address, const uint32_t &port) {
43  return new WIN32Impl::WIN32UDPSender(address, port);
44  };
45 
46  static odcore::io::udp::UDPReceiver* createUDPReceiver(const string &address, const uint32_t &port) {
47  bool isMulticast = false;
48  string::size_type posFirstDot = address.find(".");
49  if (posFirstDot != string::npos) {
50  stringstream numericalValueStream(address.substr(0, posFirstDot));
51  uint32_t numericalValue = 0;
52  numericalValueStream >> numericalValue;
53  isMulticast = ( (numericalValue >= 224) && (numericalValue <= 239) );
54  CLOG3 << "Creating " << (isMulticast ? "multicast" : "regular") << " UDP receiver at " << address << ":" << port << "." << endl;
55  }
56  return new WIN32Impl::WIN32UDPReceiver(address, port, isMulticast);
57  };
58  };
59  }
60 } // odcore::wrapper
61 
62 #endif /*OPENDAVINCI_CORE_WRAPPER_WIN32IMPL_WIN32UDPFACTORYWORKER_H_*/
Definition: WIN32UDPReceiver.h:44
Definition: UDPSender.h:60
static odcore::io::udp::UDPReceiver * createUDPReceiver(const string &address, const uint32_t &port)
Definition: WIN32UDPFactoryWorker.h:46
#define CLOG3
Definition: opendavinci.h:224
Definition: WIN32UDPSender.h:45
Definition: NetworkLibraryProducts.h:29
#define OPENDAVINCI_API
Definition: opendavinci.h:67
static odcore::io::udp::UDPSender * createUDPSender(const string &address, const uint32_t &port)
Definition: WIN32UDPFactoryWorker.h:42
Definition: UDPReceiver.h:82
Definition: POSIXUDPReceiver.h:36