Skip to content

Commit

Permalink
update linux build shared_ptr of abstract class
Browse files Browse the repository at this point in the history
  • Loading branch information
admercs committed Mar 4, 2024
1 parent 6a647e1 commit 861c943
Show file tree
Hide file tree
Showing 17 changed files with 23 additions and 19 deletions.
1 change: 1 addition & 0 deletions MavLinkCom/include/AdHocConnection.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
class Port;

namespace mavlinkcom_impl {

class AdHocConnectionImpl;
}

Expand Down
1 change: 1 addition & 0 deletions MavLinkCom/include/MavLinkConnection.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
class Port;

namespace mavlinkcom_impl {

class MavLinkConnectionImpl;
class MavLinkTcpServerImpl;
class MavLinkNodeImpl;
Expand Down
1 change: 1 addition & 0 deletions MavLinkCom/include/MavLinkDebugLog.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
#include <string>

namespace mavlinkcom {

class MavLinkDebugLog {
public:
virtual void log(int level, const std::string &message) {
Expand Down
1 change: 1 addition & 0 deletions MavLinkCom/include/MavLinkFtpClient.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
#include <vector>

namespace mavlinkcom_impl {

class MavLinkFtpClientImpl;
}

Expand Down
1 change: 1 addition & 0 deletions MavLinkCom/include/MavLinkLog.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
#define MAVLINK_STX_MAVLINK1 0xFE // marker for old protocol

namespace mavlinkcom {

// This abstract class defines the interface for logging MavLinkMessages.
class MavLinkLog {
public:
Expand Down
2 changes: 2 additions & 0 deletions MavLinkCom/include/MavLinkMessageBase.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,11 @@
#include <stdint.h>
#include <string>
namespace mavlinkcom_impl {

class MavLinkConnectionImpl;
class MavLinkNodeImpl;
} // namespace mavlinkcom_impl

namespace mavlinkcom {
class MavLinkConnection;

Expand Down
2 changes: 2 additions & 0 deletions MavLinkCom/include/MavLinkNode.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,10 @@
#include <vector>

namespace mavlinkcom_impl {

class MavLinkNodeImpl;
}

namespace mavlinkcom {

struct MavLinkParameter {
Expand Down
1 change: 1 addition & 0 deletions MavLinkCom/include/MavLinkTcpServer.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
#include <string>

namespace mavlinkcom_impl {

class MavLinkTcpServerImpl;
}

Expand Down
1 change: 1 addition & 0 deletions MavLinkCom/include/MavLinkVehicle.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
#include <vector>

namespace mavlinkcom_impl {

class MavLinkVehicleImpl;
}

Expand Down
2 changes: 2 additions & 0 deletions MavLinkCom/include/MavLinkVideoStream.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,11 @@
#include <vector>

namespace mavlinkcom_impl {

class MavLinkVideoClientImpl;
class MavLinkVideoServerImpl;
} // namespace mavlinkcom_impl

namespace mavlinkcom {

// This class implements the client side of a video stream request
Expand Down
1 change: 1 addition & 0 deletions MavLinkCom/include/UdpSocket.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
#include <string>

namespace mavlinkcom_impl {

class UdpSocketImpl;
}

Expand Down
1 change: 1 addition & 0 deletions MavLinkCom/include/VehicleState.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
#include <vector>

namespace mavlinkcom {

typedef struct _VehicleState {
typedef unsigned long long uint64_t;
typedef unsigned char uint8_t;
Expand Down
12 changes: 4 additions & 8 deletions MavLinkCom/src/impl/AdHocConnectionImpl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,7 @@ std::shared_ptr<AdHocConnection> AdHocConnectionImpl::connectLocalUdp(const std:
std::string localAddr, int localPort) {
std::shared_ptr<UdpClientPort> socket = std::make_shared<UdpClientPort>();
socket->connect(localAddr, localPort, "", 0);
std::shared_ptr<Port> port = socket;
return createConnection(nodeName, port);
return createConnection(nodeName, std::shared_ptr<Port>(socket));
}

std::shared_ptr<AdHocConnection> AdHocConnectionImpl::connectRemoteUdp(const std::string &nodeName,
Expand All @@ -52,8 +51,7 @@ std::shared_ptr<AdHocConnection> AdHocConnectionImpl::connectRemoteUdp(const std

std::shared_ptr<UdpClientPort> socket = std::make_shared<UdpClientPort>();
socket->connect(local, 0, remoteAddr, remotePort);
std::shared_ptr<Port> port = socket;
return createConnection(nodeName, port);
return createConnection(nodeName, std::shared_ptr<Port>(socket));
}

std::shared_ptr<AdHocConnection> AdHocConnectionImpl::connectTcp(const std::string &nodeName, std::string localAddr,
Expand All @@ -66,8 +64,7 @@ std::shared_ptr<AdHocConnection> AdHocConnectionImpl::connectTcp(const std::stri

std::shared_ptr<TcpClientPort> socket = std::make_shared<TcpClientPort>();
socket->connect(local, 0, remoteIpAddr, remotePort);
std::shared_ptr<Port> port = socket;
return createConnection(nodeName, port);
return createConnection(nodeName, std::shared_ptr<Port>(socket));
}

std::shared_ptr<AdHocConnection> AdHocConnectionImpl::connectSerial(const std::string &nodeName, std::string name,
Expand All @@ -82,8 +79,7 @@ std::shared_ptr<AdHocConnection> AdHocConnectionImpl::connectSerial(const std::s
if (initString.size() > 0) {
serial->write(reinterpret_cast<const uint8_t *>(initString.c_str()), static_cast<int>(initString.size()));
}
std::shared_ptr<Port> port = serial;
return createConnection(nodeName, port);
return createConnection(nodeName, std::shared_ptr<Port>(serial));
}

void AdHocConnectionImpl::startListening(std::shared_ptr<AdHocConnection> parent, const std::string &nodeName,
Expand Down
12 changes: 4 additions & 8 deletions MavLinkCom/src/impl/MavLinkConnectionImpl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,7 @@ std::shared_ptr<MavLinkConnection> MavLinkConnectionImpl::connectLocalUdp(const
const std::string &localAddr, int localPort) {
std::shared_ptr<UdpClientPort> socket = std::make_shared<UdpClientPort>();
socket->connect(localAddr, localPort, "", 0);
std::shared_ptr<Port> port = socket;
return createConnection(nodeName, port);
return createConnection(nodeName, std::shared_ptr<Port>(socket));
}

std::shared_ptr<MavLinkConnection> MavLinkConnectionImpl::connectRemoteUdp(const std::string &nodeName,
Expand All @@ -61,8 +60,7 @@ std::shared_ptr<MavLinkConnection> MavLinkConnectionImpl::connectRemoteUdp(const
}
std::shared_ptr<UdpClientPort> socket = std::make_shared<UdpClientPort>();
socket->connect(local, 0, remoteAddr, remotePort);
std::shared_ptr<Port> port = socket;
return createConnection(nodeName, port);
return createConnection(nodeName, std::shared_ptr<Port>(socket));
}

std::shared_ptr<MavLinkConnection> MavLinkConnectionImpl::connectTcp(const std::string &nodeName,
Expand All @@ -75,8 +73,7 @@ std::shared_ptr<MavLinkConnection> MavLinkConnectionImpl::connectTcp(const std::
}
std::shared_ptr<TcpClientPort> socket = std::make_shared<TcpClientPort>();
socket->connect(local, 0, remoteIpAddr, remotePort);
std::shared_ptr<Port> port = socket;
return createConnection(nodeName, port);
return createConnection(nodeName, std::shared_ptr<Port>(socket));
}

std::string MavLinkConnectionImpl::acceptTcp(std::shared_ptr<MavLinkConnection> parent, const std::string &nodeName,
Expand Down Expand Up @@ -110,8 +107,7 @@ std::shared_ptr<MavLinkConnection> MavLinkConnectionImpl::connectSerial(const st
if (initString.size() > 0) {
serial->write(reinterpret_cast<const uint8_t *>(initString.c_str()), static_cast<int>(initString.size()));
}
std::shared_ptr<Port> port = serial;
return createConnection(nodeName, port);
return createConnection(nodeName, std::shared_ptr<Port>(serial));
}

void MavLinkConnectionImpl::startListening(std::shared_ptr<MavLinkConnection> parent, const std::string &nodeName,
Expand Down
1 change: 0 additions & 1 deletion MavLinkCom/src/impl/MavLinkNodeImpl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
#include "Utils.hpp"

using namespace mavlink_utils;

using namespace mavlinkcom_impl;

const int heartbeatMilliseconds = 1000;
Expand Down
1 change: 0 additions & 1 deletion MavLinkCom/src/impl/MavLinkVehicleImpl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
#define PACKET_PAYLOAD 253 // hard coded in MavLink code - do not change

using namespace mavlink_utils;

using namespace mavlinkcom_impl;

void mavlink_euler_to_quaternion(float roll, float pitch, float yaw, float quaternion[4]) {
Expand Down
1 change: 0 additions & 1 deletion MavLinkCom/src/impl/MavLinkVideoStreamImpl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
#define PACKET_PAYLOAD 253 // hard coded in MavLink code - do not change

using namespace mavlink_utils;

using namespace mavlinkcom_impl;

//================================= CLIENT ==============================================================
Expand Down

0 comments on commit 861c943

Please sign in to comment.