Professional Documents
Culture Documents
#if defined(__clang__)
# pragma clang diagnostic ignored "-Wshadow"
# pragma clang diagnostic ignored "-Wconversion"
# pragma clang diagnostic ignored "-Wunused-parameter"
# pragma clang diagnostic ignored "-Wc++98-compat"
# pragma clang diagnostic ignored "-Wunreachable-code-break"
# pragma clang diagnostic ignored "-Wold-style-cast"
#elif defined(__GNUC__)
# pragma GCC diagnostic ignored "-Wshadow"
# pragma GCC diagnostic ignored "-Wconversion"
# pragma GCC diagnostic ignored "-Wunused-parameter"
# pragma GCC diagnostic ignored "-Wold-style-cast"
# pragma GCC diagnostic ignored "-Wsuggest-attribute=noreturn"
# pragma GCC diagnostic ignored "-Wfloat-conversion"
#endif
#include <iostream>
#include <sstream>
#include <memory>
#include "GPSRWR_m.h"
namespace omnetpp {
// Template pack/unpack rules. They are declared *after* a1l type-specific pack
functions for multiple reasons.
// They are in the omnetpp namespace, to allow them to be found by argument-
dependent lookup via the cCommBuffer argument
// Packing/unpacking an std::vector
template<typename T, typename A>
void doParsimPacking(omnetpp::cCommBuffer *buffer, const std::vector<T,A>& v)
{
int n = v.size();
doParsimPacking(buffer, n);
for (int i = 0; i < n; i++)
doParsimPacking(buffer, v[i]);
}
// Packing/unpacking an std::set
template<typename T, typename Tr, typename A>
void doParsimPacking(omnetpp::cCommBuffer *buffer, const std::set<T,Tr,A>& s)
{
doParsimPacking(buffer, (int)s.size());
for (typename std::set<T,Tr,A>::const_iterator it = s.begin(); it != s.end(); +
+it)
doParsimPacking(buffer, *it);
}
// Packing/unpacking an std::map
template<typename K, typename V, typename Tr, typename A>
void doParsimPacking(omnetpp::cCommBuffer *buffer, const std::map<K,V,Tr,A>& m)
{
doParsimPacking(buffer, (int)m.size());
for (typename std::map<K,V,Tr,A>::const_iterator it = m.begin(); it != m.end();
++it) {
doParsimPacking(buffer, it->first);
doParsimPacking(buffer, it->second);
}
}
template<typename T>
void doParsimArrayUnpacking(omnetpp::cCommBuffer *b, T *t, int n)
{
for (int i = 0; i < n; i++)
doParsimUnpacking(b, t[i]);
}
template<typename T>
void doParsimUnpacking(omnetpp::cCommBuffer *, T& t)
{
throw omnetpp::cRuntimeError("Parsim error: No doParsimUnpacking() function for
type %s", omnetpp::opp_typename(typeid(t)));
}
} // namespace omnetpp
namespace {
template <class T> inline
typename std::enable_if<std::is_polymorphic<T>::value &&
std::is_base_of<omnetpp::cObject,T>::value, void *>::type
toVoidPtr(T* t)
{
return (void *)(static_cast<const omnetpp::cObject *>(t));
}
namespace inet {
// forward
template<typename T, typename A>
std::ostream& operator<<(std::ostream& out, const std::vector<T,A>& vec);
char buf[32];
sprintf(buf, " (size=%u)", (unsigned int)vec.size());
out.write(buf, strlen(buf));
return out;
}
EXECUTE_ON_STARTUP(
omnetpp::cEnum *e = omnetpp::cEnum::find("inet::GPSRWRForwardingMode");
if (!e) omnetpp::enums.getInstance()->add(e = new
omnetpp::cEnum("inet::GPSRWRForwardingMode"));
e->insert(GPSRWR_GREEDY_ROUTING, "GPSRWR_GREEDY_ROUTING");
e->insert(GPSRWR_PERIMETER_ROUTING, "GPSRWR_PERIMETER_ROUTING");
)
EXECUTE_ON_STARTUP(
omnetpp::cEnum *e = omnetpp::cEnum::find("inet::GPSRWRPlanarizationMode");
if (!e) omnetpp::enums.getInstance()->add(e = new
omnetpp::cEnum("inet::GPSRWRPlanarizationMode"));
e->insert(GPSRWR_NO_PLANARIZATION, "GPSRWR_NO_PLANARIZATION");
e->insert(GPSRWR_GG_PLANARIZATION, "GPSRWR_GG_PLANARIZATION");
e->insert(GPSRWR_RNG_PLANARIZATION, "GPSRWR_RNG_PLANARIZATION");
)
Register_Class(GPSRWRBeacon)
GPSRWRBeacon::GPSRWRBeacon() : ::inet::FieldsChunk()
{
}
GPSRWRBeacon::~GPSRWRBeacon()
{
}
Register_ClassDescriptor(GPSRWRBeaconDescriptor)
GPSRWRBeaconDescriptor::GPSRWRBeaconDescriptor() :
omnetpp::cClassDescriptor(omnetpp::opp_typename(typeid(inet::GPSRWRBeacon)),
"inet::FieldsChunk")
{
propertynames = nullptr;
}
GPSRWRBeaconDescriptor::~GPSRWRBeaconDescriptor()
{
delete[] propertynames;
}
Register_Class(GPSRWROption)
GPSRWROption::GPSRWROption() : ::inet::TlvOptionBase()
{
}
GPSRWROption::GPSRWROption(const GPSRWROption&
other) : ::inet::TlvOptionBase(other)
{
copy(other);
}
GPSRWROption::~GPSRWROption()
{
}
Register_ClassDescriptor(GPSRWROptionDescriptor)
GPSRWROptionDescriptor::GPSRWROptionDescriptor() :
omnetpp::cClassDescriptor(omnetpp::opp_typename(typeid(inet::GPSRWROption)),
"inet::TlvOptionBase")
{
propertynames = nullptr;
}
GPSRWROptionDescriptor::~GPSRWROptionDescriptor()
{
delete[] propertynames;
}
} // namespace inet