adding new version of mepicsca and using unique ptr

This commit is contained in:
2026-04-30 16:54:34 +02:00
parent 6c63de1d84
commit 616f1cbf78
3 changed files with 7 additions and 9 deletions
+4 -6
View File
@@ -123,12 +123,14 @@ void ePowerSwitchEquipment::updateSocketNumber() {
format(EPOWERSWITCH_SOCKET_SET_PREFIX, i);
this->outletSetRecords.push_back(
new mEpicsCa<std::string>(epicsSetRecordName.c_str()));
std::make_unique<mEpicsCa<std::string>>(
epicsSetRecordName.c_str()));
std::string epicsGetRecordName =
format(EPOWERSWITCH_SOCKET_GET_PREFIX, i);
this->outletGetRecords.push_back(
new mEpicsCa<std::string>(epicsGetRecordName.c_str()));
std::make_unique<mEpicsCa<std::string>>(
epicsGetRecordName.c_str()));
}
if (this->numberOfOutlet > epicsOutletNumber)
@@ -137,10 +139,6 @@ void ePowerSwitchEquipment::updateSocketNumber() {
this->numberOfOutlet - epicsOutletNumber);
for (int i = epicsOutletNumber; i < this->numberOfOutlet; i++) {
mEpicsCa<std::string> *setRecord = this->outletSetRecords.back();
delete setRecord;
mEpicsCa<std::string> *getRecord = this->outletGetRecords.back();
delete getRecord;
std::string requestedVarname =
format("Socket ", i) + std::string(" requested");
+2 -2
View File
@@ -23,8 +23,8 @@ class ePowerSwitchEquipment : public TMFeEquipment {
void HandlePeriodic();
private:
std::vector<mEpicsCa<std::string> *> outletSetRecords;
std::vector<mEpicsCa<std::string> *> outletGetRecords;
std::vector<std::unique_ptr<mEpicsCa<std::string>>> outletSetRecords;
std::vector<std::unique_ptr<mEpicsCa<std::string>>> outletGetRecords;
mEpicsCa<int> outletNumberRecord;
int numberOfOutlet;