-
Notifications
You must be signed in to change notification settings - Fork 494
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
common: Added new Cable channel derived from cDatarateChannel.
This channel updates the line style based on whether the channel is disabled/enabled.
- Loading branch information
Showing
3 changed files
with
72 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
// | ||
// Copyright (C) 2013 OpenSim Ltd. | ||
// | ||
// SPDX-License-Identifier: LGPL-3.0-or-later | ||
// | ||
|
||
#include "inet/common/Cable.h" | ||
|
||
namespace inet { | ||
|
||
Define_Channel(Cable); | ||
|
||
void Cable::initialize() | ||
{ | ||
cDatarateChannel::initialize(); | ||
enabledLineStyle = par("enabledLineStyle"); | ||
disabledLineStyle = par("disabledLineStyle"); | ||
} | ||
|
||
void Cable::refreshDisplay() const | ||
{ | ||
cDatarateChannel::refreshDisplay(); | ||
getDisplayString().setTagArg("ls", 2, isDisabled() ? disabledLineStyle : enabledLineStyle); | ||
} | ||
|
||
} // namespace inet |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
// | ||
// Copyright (C) 2013 OpenSim Ltd. | ||
// | ||
// SPDX-License-Identifier: LGPL-3.0-or-later | ||
// | ||
|
||
|
||
#ifndef __INET_CABLE_H | ||
#define __INET_CABLE_H | ||
|
||
#include "inet/common/INETDefs.h" | ||
|
||
namespace inet { | ||
|
||
class INET_API Cable : public cDatarateChannel | ||
{ | ||
protected: | ||
const char *enabledLineStyle = nullptr; | ||
const char *disabledLineStyle = nullptr; | ||
|
||
protected: | ||
virtual void initialize() override; | ||
virtual void refreshDisplay() const override; | ||
}; | ||
|
||
} // namespace inet | ||
|
||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
// | ||
// Copyright (C) 2020 OpenSim Ltd. | ||
// | ||
// SPDX-License-Identifier: LGPL-3.0-or-later | ||
// | ||
|
||
|
||
package inet.common; | ||
|
||
import ned.DatarateChannel; | ||
|
||
channel Cable extends DatarateChannel | ||
{ | ||
parameters: | ||
string enabledLineStyle = default("solid"); | ||
string disabledLineStyle = default("dashed"); | ||
@class(Cable); | ||
} |