MaxIV-KitsControls / Libera-SinglePassE

Tango DeviceServer of the Libera SinglePass E
0 stars 1 forks source link

Business Logic Not separated in specific unit #28

Open hardion opened 11 years ago

hardion commented 11 years ago

Exemple with AttenuationLevel :

ireg.cpp long ireg::get_attenuation(...) { std::string board = "boards."; std::string level_enum; mci_LevelNodeSet.Get(level_enum); std::string levelG = ".attenuation.gain_table."; std::string dB = ".dB"; std::string mci_LevelGNodeString = board + liberaBoard + levelG

}

LiberaSinglePassE.cpp : void LiberaSinglePassE::read_AttenuationLevel(Tango::Attribute &attr) { DEBUG_STREAM << "LiberaSinglePassE::readAttenuationLevel(Tango::Attribute &attr) entering... " << endl; /----- PROTECTED REGION ID(LiberaSinglePassE::readAttenuationLevel) ENABLED START -----/

try {
    *attr_AttenuationLevel_read = static_cast<Tango::DevLong>( long ireg::get_attenuation(...) );
} catch (istd::Exception &e) {
    ERROR_STREAM << "LiberaSinglePassE::read_AttenuationLevel failed "
            << device_name << e.what() << endl;
    return;
}

//  Set the attribute value
attr.set_value(attr_AttenuationLevel_read);

/*----- PROTECTED REGION END -----*/    //  LiberaSinglePassE::read_AttenuationLevel

}

gasperjug commented 11 years ago

There is only two classes that contain business logic, those are LiberaSinglePassE.cpp and LiberaSinglePassEDataTask.cpp and they have it all over the code. If we decide to separate it from tango, a complete change would be needed.

Is this really needed, or can we live with this two exceptions?