22 #ifndef __M2ETIS_SIM_OMNETKEYPROVIDER_H__
23 #define __M2ETIS_SIM_OMNETKEYPROVIDER_H__
27 #include "boost/serialization/array.hpp"
48 for (
int i = 0; i < 4; ++i) {
57 std::ostringstream ret;
59 ret << int(ip[0]) <<
"." << int(ip[1]) <<
"." << int(ip[2]) <<
"." << int(ip[3])<<
":" << port;
83 void setKey(
const std::string & key) {
84 size_t ipend = key.find(
":", 0);
86 std::string locip(key.substr(0, ipend));
88 for (
unsigned int i = 0; i < 4; ++i) {
89 size_t bytend = key.find(
".", pos);
90 std::stringstream ss(key.substr(pos, bytend));
97 port = std::atoi(key.substr(ipend + 1, key.find(
":", ipend + 1) - ipend).c_str());
104 for (
unsigned int i = 0; i < 4; ++i) {
105 if (ip[i] != rval.ip[i]) {
109 if (port != rval.port) {
120 for (
unsigned int i = 0; i < 4; ++i) {
121 if (ip[i] != rval.ip[i]) {
122 if (ip[i] < rval.ip[i]) {
129 if (port != rval.port) {
130 if (port < rval.port) {
142 template<
class Archive>
143 void serialize(Archive & ar,
unsigned int version) {
void setKey(const message::Key< OmNetKeyProvider > &key)
duplicates a key
virtual ~OmNetKeyProvider()
destructor
bool equals(const message::Key< OmNetKeyProvider > &rval) const
equals operator of the key class
void setKey(const std::string &key)
creates key out of a string
friend class boost::serialization::access
std::string keytoStr() const
transforms key to a string representation
OmNetKeyProvider()
default constructor
bool smaller(const message::Key< OmNetKeyProvider > &rval) const
lesser than operator for the key