pass const references to user handler now

This commit is contained in:
Robin Müller 2022-08-24 15:43:58 +02:00
parent 2c730c8632
commit 267466be9d
No known key found for this signature in database
GPG Key ID: 11D4952C8CCEF814
4 changed files with 36 additions and 32 deletions

View File

@ -89,7 +89,7 @@ class DestHandler {
cfdp::FileSize fileSize; cfdp::FileSize fileSize;
TransactionId transactionId; TransactionId transactionId;
PduConfig pduConf; PduConfig pduConf;
RemoteEntityCfg* remoteCfg; RemoteEntityCfg* remoteCfg = nullptr;
}; };
TransactionStep step = TransactionStep::IDLE; TransactionStep step = TransactionStep::IDLE;

View File

@ -68,9 +68,9 @@ class UserBase {
explicit UserBase(HasFileSystemIF& vfs); explicit UserBase(HasFileSystemIF& vfs);
virtual void transactionIndication(TransactionId id) = 0; virtual void transactionIndication(const TransactionId& id) = 0;
virtual void eofSentIndication(TransactionId id) = 0; virtual void eofSentIndication(const TransactionId& id) = 0;
virtual void transactionFinishedIndication(TransactionFinishedParams params) = 0; virtual void transactionFinishedIndication(const TransactionFinishedParams& params) = 0;
/** /**
* Will be called if metadata was received. * Will be called if metadata was received.
* *
@ -82,13 +82,13 @@ class UserBase {
* @param params * @param params
*/ */
virtual void metadataRecvdIndication(const MetadataRecvdParams& params) = 0; virtual void metadataRecvdIndication(const MetadataRecvdParams& params) = 0;
virtual void fileSegmentRecvdIndication(FileSegmentRecvdParams params) = 0; virtual void fileSegmentRecvdIndication(const FileSegmentRecvdParams& params) = 0;
virtual void reportIndication(TransactionId id, StatusReportIF& report) = 0; virtual void reportIndication(const TransactionId& id, StatusReportIF& report) = 0;
virtual void suspendedIndication(TransactionId id, ConditionCode code) = 0; virtual void suspendedIndication(const TransactionId& id, ConditionCode code) = 0;
virtual void resumedIndication(TransactionId id, size_t progress) = 0; virtual void resumedIndication(const TransactionId& id, size_t progress) = 0;
virtual void faultIndication(TransactionId id, ConditionCode code, size_t progress) = 0; virtual void faultIndication(const TransactionId& id, ConditionCode code, size_t progress) = 0;
virtual void abandonedIndication(TransactionId id, ConditionCode code, size_t progress) = 0; virtual void abandonedIndication(const TransactionId& id, ConditionCode code, size_t progress) = 0;
virtual void eofRecvIndication(TransactionId id) = 0; virtual void eofRecvIndication(const TransactionId& id) = 0;
private: private:
HasFileSystemIF& vfs; HasFileSystemIF& vfs;

View File

@ -1,17 +1,21 @@
#include "UserMock.h" #include "UserMock.h"
namespace cfdp {
cfdp::UserMock::UserMock(HasFileSystemIF& vfs) : UserBase(vfs) {} cfdp::UserMock::UserMock(HasFileSystemIF& vfs) : UserBase(vfs) {}
void cfdp::UserMock::transactionIndication(cfdp::TransactionId id) {} void UserMock::transactionIndication(const TransactionId& id) {}
void cfdp::UserMock::eofSentIndication(cfdp::TransactionId id) {} void UserMock::eofSentIndication(const TransactionId& id) {}
void cfdp::UserMock::abandonedIndication(cfdp::TransactionId id, cfdp::ConditionCode code, void UserMock::abandonedIndication(const TransactionId& id, cfdp::ConditionCode code,
uint64_t progress) {} uint64_t progress) {}
void cfdp::UserMock::eofRecvIndication(cfdp::TransactionId id) {} void UserMock::eofRecvIndication(const TransactionId& id) {}
void cfdp::UserMock::transactionFinishedIndication(TransactionFinishedParams finishedParams) {} void UserMock::transactionFinishedIndication(const TransactionFinishedParams& finishedParams) {}
void cfdp::UserMock::metadataRecvdIndication(const MetadataRecvdParams& params) {} void UserMock::metadataRecvdIndication(const MetadataRecvdParams& params) {}
void cfdp::UserMock::fileSegmentRecvdIndication(FileSegmentRecvdParams params) {} void UserMock::fileSegmentRecvdIndication(const FileSegmentRecvdParams& params) {}
void cfdp::UserMock::reportIndication(TransactionId id, StatusReportIF& report) {} void UserMock::reportIndication(const TransactionId& id, StatusReportIF& report) {}
void cfdp::UserMock::suspendedIndication(TransactionId id, ConditionCode code) {} void UserMock::suspendedIndication(const TransactionId& id, ConditionCode code) {}
void cfdp::UserMock::resumedIndication(TransactionId id, size_t progress) {} void UserMock::resumedIndication(const TransactionId& id, size_t progress) {}
void cfdp::UserMock::faultIndication(cfdp::TransactionId id, cfdp::ConditionCode code, void UserMock::faultIndication(const TransactionId& id, cfdp::ConditionCode code,
size_t progress) {} size_t progress) {}
}

View File

@ -8,17 +8,17 @@ class UserMock : public UserBase {
public: public:
explicit UserMock(HasFileSystemIF& vfs); explicit UserMock(HasFileSystemIF& vfs);
void transactionIndication(TransactionId id) override; void transactionIndication(const TransactionId& id) override;
void eofSentIndication(TransactionId id) override; void eofSentIndication(const TransactionId& id) override;
void abandonedIndication(TransactionId id, ConditionCode code, size_t progress) override; void abandonedIndication(const TransactionId& id, ConditionCode code, size_t progress) override;
void eofRecvIndication(TransactionId id) override; void eofRecvIndication(const TransactionId& id) override;
void transactionFinishedIndication(TransactionFinishedParams params) override; void transactionFinishedIndication(const TransactionFinishedParams& params) override;
void metadataRecvdIndication(const MetadataRecvdParams& params) override; void metadataRecvdIndication(const MetadataRecvdParams& params) override;
void fileSegmentRecvdIndication(FileSegmentRecvdParams params) override; void fileSegmentRecvdIndication(const FileSegmentRecvdParams& params) override;
void reportIndication(TransactionId id, StatusReportIF& report) override; void reportIndication(const TransactionId& id, StatusReportIF& report) override;
void suspendedIndication(TransactionId id, ConditionCode code) override; void suspendedIndication(const TransactionId& id, ConditionCode code) override;
void resumedIndication(TransactionId id, size_t progress) override; void resumedIndication(const TransactionId& id, size_t progress) override;
void faultIndication(TransactionId id, ConditionCode code, size_t progress) override; void faultIndication(const TransactionId& id, ConditionCode code, size_t progress) override;
}; };
} // namespace cfdp } // namespace cfdp