fix atomic
This commit is contained in:
@@ -8,6 +8,94 @@
|
||||
#include "../include/reHDD.h"
|
||||
using namespace std;
|
||||
|
||||
// Copy constructor
|
||||
Drive::Drive(const Drive &other)
|
||||
: state(other.state.load()),
|
||||
connectionType(other.connectionType.load()),
|
||||
sShredSpeed(other.sShredSpeed.load()),
|
||||
bWasShredded(other.bWasShredded),
|
||||
bWasShredStarted(other.bWasShredStarted),
|
||||
bWasChecked(other.bWasChecked),
|
||||
bWasDeleted(other.bWasDeleted),
|
||||
bIsOffline(other.bIsOffline),
|
||||
u32DriveChecksumAfterShredding(other.u32DriveChecksumAfterShredding),
|
||||
sPath(other.sPath),
|
||||
u32Timestamp(other.u32Timestamp),
|
||||
d32TaskPercentage(other.d32TaskPercentage),
|
||||
u32TimestampTaskStart(other.u32TimestampTaskStart),
|
||||
u32TaskDuration(other.u32TaskDuration),
|
||||
sSmartData(other.sSmartData)
|
||||
{
|
||||
}
|
||||
|
||||
// Copy assignment operator
|
||||
Drive &Drive::operator=(const Drive &other)
|
||||
{
|
||||
if (this != &other)
|
||||
{
|
||||
state = other.state.load();
|
||||
connectionType = other.connectionType.load();
|
||||
sShredSpeed = other.sShredSpeed.load();
|
||||
bWasShredded = other.bWasShredded;
|
||||
bWasShredStarted = other.bWasShredStarted;
|
||||
bWasChecked = other.bWasChecked;
|
||||
bWasDeleted = other.bWasDeleted;
|
||||
bIsOffline = other.bIsOffline;
|
||||
u32DriveChecksumAfterShredding = other.u32DriveChecksumAfterShredding;
|
||||
sPath = other.sPath;
|
||||
u32Timestamp = other.u32Timestamp;
|
||||
d32TaskPercentage = other.d32TaskPercentage;
|
||||
u32TimestampTaskStart = other.u32TimestampTaskStart;
|
||||
u32TaskDuration = other.u32TaskDuration;
|
||||
sSmartData = other.sSmartData;
|
||||
}
|
||||
return *this;
|
||||
}
|
||||
|
||||
// Move constructor
|
||||
Drive::Drive(Drive &&other) noexcept
|
||||
: state(other.state.load()),
|
||||
connectionType(other.connectionType.load()),
|
||||
sShredSpeed(other.sShredSpeed.load()),
|
||||
bWasShredded(other.bWasShredded),
|
||||
bWasShredStarted(other.bWasShredStarted),
|
||||
bWasChecked(other.bWasChecked),
|
||||
bWasDeleted(other.bWasDeleted),
|
||||
bIsOffline(other.bIsOffline),
|
||||
u32DriveChecksumAfterShredding(other.u32DriveChecksumAfterShredding),
|
||||
sPath(std::move(other.sPath)),
|
||||
u32Timestamp(other.u32Timestamp),
|
||||
d32TaskPercentage(other.d32TaskPercentage),
|
||||
u32TimestampTaskStart(other.u32TimestampTaskStart),
|
||||
u32TaskDuration(other.u32TaskDuration),
|
||||
sSmartData(std::move(other.sSmartData))
|
||||
{
|
||||
}
|
||||
|
||||
// Move assignment operator
|
||||
Drive &Drive::operator=(Drive &&other) noexcept
|
||||
{
|
||||
if (this != &other)
|
||||
{
|
||||
state = other.state.load();
|
||||
connectionType = other.connectionType.load();
|
||||
sShredSpeed = other.sShredSpeed.load();
|
||||
bWasShredded = other.bWasShredded;
|
||||
bWasShredStarted = other.bWasShredStarted;
|
||||
bWasChecked = other.bWasChecked;
|
||||
bWasDeleted = other.bWasDeleted;
|
||||
bIsOffline = other.bIsOffline;
|
||||
u32DriveChecksumAfterShredding = other.u32DriveChecksumAfterShredding;
|
||||
sPath = std::move(other.sPath);
|
||||
u32Timestamp = other.u32Timestamp;
|
||||
d32TaskPercentage = other.d32TaskPercentage;
|
||||
u32TimestampTaskStart = other.u32TimestampTaskStart;
|
||||
u32TaskDuration = other.u32TaskDuration;
|
||||
sSmartData = std::move(other.sSmartData);
|
||||
}
|
||||
return *this;
|
||||
}
|
||||
|
||||
string Drive::getPath(void)
|
||||
{
|
||||
return sPath;
|
||||
|
||||
Reference in New Issue
Block a user