code cleaning
This commit is contained in:
+22
-17
@@ -66,34 +66,39 @@ void powerSwitch::updateOutletNumber() {
|
||||
fMfe->Msg(MERROR, __FUNCTION__, "Unable to read outlet record number");
|
||||
}
|
||||
|
||||
if (this->numberOfOutlet < newNumberOfOutlet)
|
||||
if (this->numberOfOutlet < newNumberOfOutlet) {
|
||||
fMfe->Msg(MDEBUG, __FUNCTION__,
|
||||
"Outlet number increasing, creating %d new outlet(s)",
|
||||
newNumberOfOutlet - this->numberOfOutlet);
|
||||
|
||||
for (int i = this->numberOfOutlet; i < newNumberOfOutlet; i++) {
|
||||
std::string epicsSetRecordName;
|
||||
{
|
||||
static const std::string *str1 = &EPOWERSWITCH_OUTLET_SET_PREFIX;
|
||||
static const std::string str2 = "";
|
||||
epicsSetRecordName = insert(str1, i + 1, &str2);
|
||||
for (int i = this->numberOfOutlet; i < newNumberOfOutlet; i++) {
|
||||
std::string epicsSetRecordName;
|
||||
{
|
||||
static const std::string *str1 =
|
||||
&EPOWERSWITCH_OUTLET_SET_PREFIX;
|
||||
static const std::string str2 = "";
|
||||
epicsSetRecordName = insert(str1, i + 1, &str2);
|
||||
}
|
||||
std::string epicsGetRecordName;
|
||||
{
|
||||
static const std::string *str1 =
|
||||
&EPOWERSWITCH_OUTLET_GET_PREFIX;
|
||||
static const std::string str2 = "";
|
||||
epicsGetRecordName = insert(str1, i + 1, &str2);
|
||||
}
|
||||
this->outlets.emplace_back(i, epicsGetRecordName,
|
||||
epicsSetRecordName);
|
||||
}
|
||||
std::string epicsGetRecordName;
|
||||
{
|
||||
static const std::string *str1 = &EPOWERSWITCH_OUTLET_GET_PREFIX;
|
||||
static const std::string str2 = "";
|
||||
epicsGetRecordName = insert(str1, i + 1, &str2);
|
||||
}
|
||||
this->outlets.emplace_back(i, epicsGetRecordName, epicsSetRecordName);
|
||||
}
|
||||
|
||||
if (this->numberOfOutlet > newNumberOfOutlet)
|
||||
if (this->numberOfOutlet > newNumberOfOutlet) {
|
||||
fMfe->Msg(MDEBUG, __FUNCTION__,
|
||||
"Outlet number decreasing, destroying %d outlet(s)",
|
||||
this->numberOfOutlet - newNumberOfOutlet);
|
||||
|
||||
for (int i = newNumberOfOutlet; i < this->numberOfOutlet; i++) {
|
||||
this->outlets.pop_back();
|
||||
for (int i = newNumberOfOutlet; i < this->numberOfOutlet; i++) {
|
||||
this->outlets.pop_back();
|
||||
}
|
||||
}
|
||||
|
||||
this->numberOfOutlet = newNumberOfOutlet;
|
||||
|
||||
Reference in New Issue
Block a user