mirror of
https://git.rwth-aachen.de/acs/public/villas/node/
synced 2025-03-09 00:00:00 +01:00
move member initializers from header to contructor
This commit is contained in:
parent
44ef9226f1
commit
d3f31e47f0
2 changed files with 39 additions and 17 deletions
|
@ -136,22 +136,22 @@ class SlaveNode : public Node {
|
|||
protected:
|
||||
struct Server {
|
||||
// slave state
|
||||
enum { NONE, STOPPED, READY } state = NONE;
|
||||
enum { NONE, STOPPED, READY } state;
|
||||
|
||||
// config (use explicit defaults)
|
||||
std::string local_address = "0.0.0.0";
|
||||
int local_port = 2404;
|
||||
int common_address = 1;
|
||||
int low_priority_queue = 100;
|
||||
int high_priority_queue = 100;
|
||||
std::string local_address;
|
||||
int local_port;
|
||||
int common_address;
|
||||
int low_priority_queue;
|
||||
int high_priority_queue;
|
||||
|
||||
// config (use lib60870 defaults if std::nullopt)
|
||||
std::optional<int> apci_t0 = std::nullopt;
|
||||
std::optional<int> apci_t1 = std::nullopt;
|
||||
std::optional<int> apci_t2 = std::nullopt;
|
||||
std::optional<int> apci_t3 = std::nullopt;
|
||||
std::optional<int> apci_k = std::nullopt;
|
||||
std::optional<int> apci_w = std::nullopt;
|
||||
std::optional<int> apci_t0;
|
||||
std::optional<int> apci_t1;
|
||||
std::optional<int> apci_t2;
|
||||
std::optional<int> apci_t3;
|
||||
std::optional<int> apci_k;
|
||||
std::optional<int> apci_w;
|
||||
|
||||
// lib60870
|
||||
CS104_Slave slave;
|
||||
|
@ -159,13 +159,12 @@ protected:
|
|||
} server;
|
||||
|
||||
struct Output {
|
||||
// config
|
||||
bool enabled = false;
|
||||
std::vector<ASDUData> mapping = {};
|
||||
std::vector<ASDUData::Type> asdu_types = {};
|
||||
std::vector<ASDUData> mapping;
|
||||
std::vector<ASDUData::Type> asdu_types;
|
||||
|
||||
mutable std::mutex last_values_mutex;
|
||||
std::vector<SignalData> last_values = {};
|
||||
std::vector<SignalData> last_values;
|
||||
} output;
|
||||
|
||||
void createSlave() noexcept;
|
||||
|
|
|
@ -311,7 +311,8 @@ bool ASDUData::addSampleToASDU(CS101_ASDU &asdu, ASDUData::Sample sample) const
|
|||
}
|
||||
|
||||
ASDUData::ASDUData(ASDUData::Descriptor const *descriptor, int ioa, int ioa_sequence_start) : ioa(ioa), ioa_sequence_start(ioa_sequence_start), descriptor(descriptor)
|
||||
{}
|
||||
{
|
||||
}
|
||||
|
||||
void SlaveNode::createSlave() noexcept
|
||||
{
|
||||
|
@ -576,6 +577,28 @@ int SlaveNode::_write(Sample *samples[], unsigned sample_count)
|
|||
SlaveNode::SlaveNode(const std::string &name) :
|
||||
Node(name)
|
||||
{
|
||||
server.state = SlaveNode::Server::NONE;
|
||||
|
||||
// server config (use explicit defaults)
|
||||
server.local_address = "0.0.0.0";
|
||||
server.local_port = 2404;
|
||||
server.common_address = 1;
|
||||
server.low_priority_queue = 100;
|
||||
server.high_priority_queue = 100;
|
||||
|
||||
// config (use lib60870 defaults if std::nullopt)
|
||||
server.apci_t0 = std::nullopt;
|
||||
server.apci_t1 = std::nullopt;
|
||||
server.apci_t2 = std::nullopt;
|
||||
server.apci_t3 = std::nullopt;
|
||||
server.apci_k = std::nullopt;
|
||||
server.apci_w = std::nullopt;
|
||||
|
||||
// output config
|
||||
output.enabled = false;
|
||||
output.mapping = {};
|
||||
output.asdu_types = {};
|
||||
output.last_values = {};
|
||||
}
|
||||
|
||||
SlaveNode::~SlaveNode()
|
||||
|
|
Loading…
Add table
Reference in a new issue