Deprecate Channel::GetChannelX() in favor of Channel::GetX()

This commit is contained in:
Alexey Rybalchenko 2019-05-13 16:06:28 +02:00 committed by Dennis Klein
parent 73ccefa4cb
commit 3538d9f410
3 changed files with 10 additions and 13 deletions

View File

@ -81,17 +81,17 @@ class FairMQChannel
/// Get channel name
/// @return Returns full channel name (e.g. "data[0]")
std::string GetChannelName() const { return GetName(); } // TODO: deprecate this in favor of following
std::string GetName() const;
std::string GetChannelName() const __attribute__((deprecated("Use GetName()"))) { return GetName(); }
std::string GetName() const ;
/// Get channel prefix
/// @return Returns channel prefix (e.g. "data" in "data[0]")
std::string GetChannelPrefix() const { return GetPrefix(); } // TODO: deprecate this in favor of following
std::string GetChannelPrefix() const __attribute__((deprecated("Use GetPrefix()"))) { return GetPrefix(); }
std::string GetPrefix() const;
/// Get channel index
/// @return Returns channel index (e.g. 0 in "data[0]")
std::string GetChannelIndex() const { return GetIndex(); } // TODO: deprecate this in favor of following
std::string GetChannelIndex() const __attribute__((deprecated("Use GetIndex()"))) { return GetIndex(); }
std::string GetIndex() const;
/// Get socket type
@ -200,7 +200,7 @@ class FairMQChannel
/// Set channel name
/// @param name Arbitrary channel name
void UpdateChannelName(const std::string& name) { UpdateName(name); } // TODO: deprecate this in favor of following
void UpdateChannelName(const std::string& name) __attribute__((deprecated("Use UpdateName()"))) { UpdateName(name); }
void UpdateName(const std::string& name);
/// Checks if the configured channel settings are valid (checks the validity parameter, without running full validation (as oposed to ValidateChannel()))
@ -209,10 +209,7 @@ class FairMQChannel
/// Validates channel configuration
/// @return true if channel settings are valid, false otherwise.
bool ValidateChannel() // TODO: deprecate this
{
return Validate();
}
bool ValidateChannel() __attribute__((deprecated("Use Validate()"))) { return Validate(); }
/// Validates channel configuration
/// @return true if channel settings are valid, false otherwise.

View File

@ -293,7 +293,7 @@ void FairMQDevice::ConnectWrapper()
this_thread::sleep_for(chrono::milliseconds(sleepTimeInMS));
for (auto& chan : fUninitializedConnectingChannels) {
string key{"chans." + chan->GetChannelPrefix() + "." + chan->GetChannelIndex() + ".address"};
string key{"chans." + chan->GetPrefix() + "." + chan->GetIndex() + ".address"};
string newAddress = fConfig->GetValue<string>(key);
if (newAddress != chan->GetAddress()) {
chan->UpdateAddress(newAddress);
@ -322,7 +322,7 @@ void FairMQDevice::AttachChannels(vector<FairMQChannel*>& chans)
auto itr = chans.begin();
while (itr != chans.end()) {
if ((*itr)->ValidateChannel()) {
if ((*itr)->Validate()) {
(*itr)->Init();
if (AttachChannel(**itr)) {
(*itr)->SetModified(false);

View File

@ -85,8 +85,8 @@ TEST(Channel, Validation)
ASSERT_EQ(channel2.IsValid(), true);
ASSERT_EQ(channel2.Validate(), true);
channel2.UpdateChannelName("Kanal");
ASSERT_EQ(channel2.GetChannelName(), "Kanal");
channel2.UpdateName("Kanal");
ASSERT_EQ(channel2.GetName(), "Kanal");
channel2.ResetChannel();
ASSERT_EQ(channel2.IsValid(), false);