Skip to content

Commit

Permalink
Refactor and simplify c/dtors
Browse files Browse the repository at this point in the history
  • Loading branch information
GiovanniGrieco committed Jun 16, 2024
1 parent 3e496eb commit 2e6308e
Show file tree
Hide file tree
Showing 193 changed files with 74 additions and 1,031 deletions.
13 changes: 2 additions & 11 deletions src/application/drone-client-application.cc
Original file line number Diff line number Diff line change
Expand Up @@ -77,18 +77,9 @@ DroneClientApplication::GetTypeId()
}

DroneClientApplication::DroneClientApplication()
: m_sequenceNumber{0},
m_state{CLOSED}
{
NS_LOG_FUNCTION(this);

m_state = CLOSED;
m_sequenceNumber = 0;
}

DroneClientApplication::~DroneClientApplication()
{
NS_LOG_FUNCTION(this);

m_state = CLOSED;
}

void
Expand Down
7 changes: 0 additions & 7 deletions src/application/drone-client-application.h
Original file line number Diff line number Diff line change
Expand Up @@ -75,14 +75,7 @@ class DroneClientApplication : public Application
*/
static TypeId GetTypeId(void);

/**
* \brief default constructor
*/
DroneClientApplication();
/**
* \brief default destructor
*/
virtual ~DroneClientApplication();

protected:
/**
Expand Down
13 changes: 2 additions & 11 deletions src/application/drone-server-application.cc
Original file line number Diff line number Diff line change
Expand Up @@ -58,18 +58,9 @@ DroneServerApplication::GetTypeId()
}

DroneServerApplication::DroneServerApplication()
: m_state{SERVER_CLOSED},
m_sequenceNumber{0}
{
NS_LOG_FUNCTION(this);

m_state = SERVER_CLOSED;
m_sequenceNumber = 0;
}

DroneServerApplication::~DroneServerApplication()
{
NS_LOG_FUNCTION(this);

m_state = SERVER_CLOSED;
}

void
Expand Down
2 changes: 0 additions & 2 deletions src/application/drone-server-application.h
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,6 @@ class DroneServerApplication : public Application
static TypeId GetTypeId();

DroneServerApplication();
virtual ~DroneServerApplication();

protected:
virtual void DoDispose();

Expand Down
6 changes: 0 additions & 6 deletions src/application/nat-application.cc
Original file line number Diff line number Diff line change
Expand Up @@ -65,12 +65,6 @@ NatApplication::GetTypeId()
NatApplication::NatApplication()
: m_curNatPort{1}
{
NS_LOG_FUNCTION_NOARGS();
}

NatApplication::~NatApplication()
{
NS_LOG_FUNCTION_NOARGS();
}

void
Expand Down
2 changes: 0 additions & 2 deletions src/application/nat-application.h
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,6 @@ class NatApplication : public Application
// virtual void DoDispose ();

NatApplication();
virtual ~NatApplication();

bool RecvPktFromIntNetDev(Ptr<NetDevice> netdev,
Ptr<const Packet> pkt,
uint16_t protocol,
Expand Down
6 changes: 0 additions & 6 deletions src/application/random-udp-application.cc
Original file line number Diff line number Diff line change
Expand Up @@ -75,12 +75,6 @@ RandomUdpApplication::RandomUdpApplication()
: m_sendEvent{EventId()},
m_seqNum{0}
{
NS_LOG_FUNCTION(this);
}

RandomUdpApplication::~RandomUdpApplication()
{
NS_LOG_FUNCTION(this);
}

void
Expand Down
5 changes: 0 additions & 5 deletions src/application/random-udp-application.h
Original file line number Diff line number Diff line change
Expand Up @@ -39,11 +39,6 @@ class RandomUdpApplication : public Application
* \brief Default constructor
*/
RandomUdpApplication();
/**
* \brief Default destructor
*/
virtual ~RandomUdpApplication();

protected:
/**
* \brief Initialize the Object registered as TypeId
Expand Down
10 changes: 0 additions & 10 deletions src/application/tcp-client-server-application.cc
Original file line number Diff line number Diff line change
Expand Up @@ -59,16 +59,6 @@ TcpClientServerApplication::GetTypeId()
return tid;
}

TcpClientServerApplication::TcpClientServerApplication()
{
NS_LOG_FUNCTION(this);
}

TcpClientServerApplication::~TcpClientServerApplication()
{
NS_LOG_FUNCTION(this);
}

void
TcpClientServerApplication::StartApplication()
{
Expand Down
3 changes: 0 additions & 3 deletions src/application/tcp-client-server-application.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,6 @@ class TcpClientServerApplication : public Application
{
public:
static TypeId GetTypeId();
TcpClientServerApplication();
virtual ~TcpClientServerApplication();

protected:
virtual void StartApplication();
virtual void StopApplication();
Expand Down
10 changes: 0 additions & 10 deletions src/application/tcp-echo-server-application.cc
Original file line number Diff line number Diff line change
Expand Up @@ -47,16 +47,6 @@ TcpEchoServerApplication::GetTypeId()
return tid;
}

TcpEchoServerApplication::TcpEchoServerApplication()
{
NS_LOG_FUNCTION(this);
}

TcpEchoServerApplication::~TcpEchoServerApplication()
{
NS_LOG_FUNCTION(this);
}

void
TcpEchoServerApplication::StartApplication()
{
Expand Down
3 changes: 0 additions & 3 deletions src/application/tcp-echo-server-application.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,6 @@ class TcpEchoServerApplication : public TcpClientServerApplication
{
public:
static TypeId GetTypeId();
TcpEchoServerApplication();
virtual ~TcpEchoServerApplication();

protected:
virtual void StartApplication();
virtual void ReceivedDataCallback(Ptr<Socket> s);
Expand Down
6 changes: 0 additions & 6 deletions src/application/tcp-storage-client-application.cc
Original file line number Diff line number Diff line change
Expand Up @@ -58,12 +58,6 @@ TcpStorageClientApplication::GetTypeId()
TcpStorageClientApplication::TcpStorageClientApplication()
: m_seqNum{0}
{
NS_LOG_FUNCTION(this);
}

TcpStorageClientApplication::~TcpStorageClientApplication()
{
NS_LOG_FUNCTION(this);
}

void
Expand Down
2 changes: 0 additions & 2 deletions src/application/tcp-storage-client-application.h
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,6 @@ class TcpStorageClientApplication : public TcpClientServerApplication
public:
static TypeId GetTypeId();
TcpStorageClientApplication();
virtual ~TcpStorageClientApplication();

protected:
virtual void DoInitialize();
virtual void StartApplication();
Expand Down
10 changes: 0 additions & 10 deletions src/application/tcp-stub-client-application.cc
Original file line number Diff line number Diff line change
Expand Up @@ -48,16 +48,6 @@ TcpStubClientApplication::GetTypeId()
return tid;
}

TcpStubClientApplication::TcpStubClientApplication()
{
NS_LOG_FUNCTION(this);
}

TcpStubClientApplication::~TcpStubClientApplication()
{
NS_LOG_FUNCTION(this);
}

void
TcpStubClientApplication::DoInitialize()
{
Expand Down
3 changes: 0 additions & 3 deletions src/application/tcp-stub-client-application.h
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,6 @@ class TcpStubClientApplication : public TcpStorageClientApplication
{
public:
static TypeId GetTypeId();
TcpStubClientApplication();
virtual ~TcpStubClientApplication();

protected:
virtual void DoInitialize();
virtual void StartApplication();
Expand Down
14 changes: 4 additions & 10 deletions src/application/udp-echo-client-application.cc
Original file line number Diff line number Diff line change
Expand Up @@ -62,17 +62,11 @@ UdpEchoClientApplication::GetTypeId(void)
}

UdpEchoClientApplication::UdpEchoClientApplication()
: m_sent{0},
m_totalTx{0},
m_socket{0},
m_sendEvent{EventId()}
{
NS_LOG_FUNCTION(this);
m_sent = 0;
m_totalTx = 0;
m_socket = 0;
m_sendEvent = EventId();
}

UdpEchoClientApplication::~UdpEchoClientApplication()
{
NS_LOG_FUNCTION(this);
}

void
Expand Down
3 changes: 0 additions & 3 deletions src/application/udp-echo-client-application.h
Original file line number Diff line number Diff line change
Expand Up @@ -45,9 +45,6 @@ class UdpEchoClientApplication : public Application
static TypeId GetTypeId(void);

UdpEchoClientApplication();

virtual ~UdpEchoClientApplication();

/**
* \brief set the remote address and port
* \param ip remote IP address
Expand Down
4 changes: 0 additions & 4 deletions src/configuration/base/double-vector.cc
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,6 @@ namespace ns3

ATTRIBUTE_HELPER_CPP(DoubleVector);

DoubleVector::DoubleVector()
{
}

DoubleVector::DoubleVector(std::vector<double> coeffs)
{
for (auto c : coeffs)
Expand Down
2 changes: 1 addition & 1 deletion src/configuration/base/double-vector.h
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ class DoubleVector
public:
typedef std::vector<double>::const_iterator Iterator;

DoubleVector();
DoubleVector() = default;
DoubleVector(std::vector<double> coefficients);
DoubleVector(const DoubleVector& a);

Expand Down
4 changes: 0 additions & 4 deletions src/configuration/base/int-vector.cc
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,6 @@ namespace ns3

ATTRIBUTE_HELPER_CPP(IntVector);

IntVector::IntVector()
{
}

IntVector::IntVector(std::vector<int> coeffs)
{
for (auto c : coeffs)
Expand Down
2 changes: 1 addition & 1 deletion src/configuration/base/int-vector.h
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ class IntVector
public:
typedef std::vector<int>::const_iterator Iterator;

IntVector();
IntVector() = default;
IntVector(std::vector<int> coefficients);
IntVector(const IntVector& a);

Expand Down
4 changes: 0 additions & 4 deletions src/configuration/base/model-configuration-matrix.cc
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,6 @@ namespace ns3

ATTRIBUTE_HELPER_CPP(ModelConfigurationMatrix);

ModelConfigurationMatrix::ModelConfigurationMatrix()
{
}

ModelConfigurationMatrix::ModelConfigurationMatrix(ModelConfigurationVector conf)
: m_confs{conf}
{
Expand Down
2 changes: 1 addition & 1 deletion src/configuration/base/model-configuration-matrix.h
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ class ModelConfigurationMatrix
typedef std::vector<ModelConfigurationVector>::iterator MutableIterator;

/** Default constructor. Create an empty vector of IRS Patches. */
ModelConfigurationMatrix();
ModelConfigurationMatrix() = default;
/**
* Create a new ModelConfigurationMatrix with exactly one Patch which has been
* previously istantiated. This single Patch is specified by a smart pointer.
Expand Down
4 changes: 0 additions & 4 deletions src/configuration/base/model-configuration-vector.cc
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,6 @@ namespace ns3

ATTRIBUTE_HELPER_CPP(ModelConfigurationVector);

ModelConfigurationVector::ModelConfigurationVector()
{
}

ModelConfigurationVector::ModelConfigurationVector(ModelConfiguration conf)
: m_confs{conf}
{
Expand Down
2 changes: 1 addition & 1 deletion src/configuration/base/model-configuration-vector.h
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ class ModelConfigurationVector
typedef std::vector<ModelConfiguration>::iterator MutableIterator;

/** Default constructor. Create an empty vector of IRS Patches. */
ModelConfigurationVector();
ModelConfigurationVector() = default;
/**
* Create a new ModelConfigurationVector with exactly one Patch which has been
* previously istantiated. This single Patch is specified by a smart pointer.
Expand Down
4 changes: 1 addition & 3 deletions src/configuration/base/model-configuration.h
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,7 @@ class ModelConfiguration
std::string name;
Ptr<AttributeValue> value;

Attribute() = default;

Attribute() = default;
Attribute(std::string name, Ptr<AttributeValue> value)
: name{name},
value{value}
Expand Down Expand Up @@ -73,7 +72,6 @@ class ModelConfiguration
const AttributeVector attributes,
const ModelConfigurationVector aggregates);

/** Default destructor */
~ModelConfiguration();

/**
Expand Down
4 changes: 0 additions & 4 deletions src/configuration/base/str-vec.cc
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,6 @@ namespace ns3

ATTRIBUTE_HELPER_CPP(StrVec);

StrVec::StrVec()
{
}

StrVec::StrVec(std::vector<std::string> strs)
{
for (auto s : strs)
Expand Down
2 changes: 1 addition & 1 deletion src/configuration/base/str-vec.h
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ class StrVec
public:
typedef std::vector<std::string>::const_iterator Iterator;

StrVec();
StrVec() = default;
StrVec(std::vector<std::string> coefficients);
StrVec(const StrVec& a);

Expand Down
8 changes: 3 additions & 5 deletions src/configuration/base/vector.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,6 @@ namespace ns3
#include <typeinfo>
#include <vector>

// #include <typetraits>

/**
* Output streamer for std::vector<T>
* \tparam T type of the vector elements
Expand Down Expand Up @@ -88,9 +86,9 @@ class VectorValue : public AttributeValue

class VectorChecker : public AttributeChecker
{
public:
virtual void SetChecker(Ptr<const AttributeChecker> checker) = 0;
virtual Ptr<const AttributeChecker> GetChecker(void) const = 0;
public:
virtual void SetChecker(Ptr<const AttributeChecker> checker) = 0;
virtual Ptr<const AttributeChecker> GetChecker(void) const = 0;
};

/**
Expand Down
4 changes: 0 additions & 4 deletions src/configuration/entity-configuration.cc
Original file line number Diff line number Diff line change
Expand Up @@ -57,10 +57,6 @@ EntityConfiguration::EntityConfiguration(std::vector<Ptr<NetdeviceConfiguration>
{
}

EntityConfiguration::~EntityConfiguration()
{
}

const std::vector<Ptr<NetdeviceConfiguration>>&
EntityConfiguration::GetNetDevices() const
{
Expand Down
Loading

0 comments on commit 2e6308e

Please sign in to comment.