Commit e253f0bd authored by Sonja Happ's avatar Sonja Happ
Browse files

code cleanup, removing comments and additional debug log messages

parent 599e481b
......@@ -105,38 +105,35 @@ Villas_interface::Villas_interface(villas_node_config *_config, IO_object *IO_ob
IO->log_info("Villas_interface: Memory pool allocation for " + std::to_string(meta.size())+ " signals and blocksize=" + std::to_string(blocksize));
ret = pool_init(p, 1024, blocksize, &(memory_heap));
if (ret) {
//IO->log_info("Villas_interface: pool_init failed for node " + _name +
//" and node type " + std::string(type->name) + " with return value " + std::to_string(ret));
throw std::runtime_error("Villas_interface: pool_init failed for node " + _name +
" and node type " + std::string(type->name) + " with return value " + std::to_string(ret));
}
// init VILLASnode based on config from above
IO->log_info("Calling node_init");
IO->log_info("Villas_interface: node_init");
ret = node_init(n, type);
if (ret) {
throw std::runtime_error("Villas_interface: node_init failed for node " + _name +
" and node type " + std::string(type->name) + " with return value " + std::to_string(ret));
}
}
//parse configuration of node
IO->log_info("Villas_interface: parsing provided node configuration");
IO->log_info("Villas_interface: parsing node configuration");
n->name = strdup(_name.c_str());
n->in.enabled = 1;
n->out.enabled = 1;
n->out.vectorize = 1; //only one sample at a time
n->in.vectorize = 1;
IO->log_info("Villas_interface: parsing config for " + std::string(type->name));
if(std::string(type->name) == "mqtt") {
//configure the node for mqtt
IO->log_info("parsing config for mqtt");
//set mqtt parameters
auto *m = (mqtt *) n->_vd;
//set broker
IO->log_info("Setting the broker");
m->host = strdup(_config->type_config.mqtt_conf->broker.c_str()) ;
//set publish topic (if any)
......@@ -163,27 +160,21 @@ Villas_interface::Villas_interface(villas_node_config *_config, IO_object *IO_ob
m->pool.state = State::DESTROYED;
//lookup the format type for this mqtt node
IO->log_info("lookup the format type of this node");
m->formatter = villas::node::FormatFactory::make(_config->format_name);
IO->log_info("parsing completed for mqtt");
}
else if (std::string(type->name) == "nanomsg") {
//configure_node_nanomsg(); //configure the node for nanomsg
//configure the node for nanomsg
// set nanomsg parameters
auto *m = (nanomsg *) n->_vd;
ret = vlist_init(&m->out.endpoints);
if (ret) {
//IO->log_info("Villas_interface: vlist_init of out.endpoints failed for node " + _name +
// " with return value " + std::to_string(ret));
throw std::runtime_error("Villas_interface: vlist_init of out.endpoints failed for node " + _name +
" with return value " + std::to_string(ret));
}
ret = vlist_init(&m->in.endpoints);
if (ret) {
//IO->log_info("Villas_interface: vlist_init of in.endpoints failed for node " + _name +
//" with return value " + std::to_string(ret));
throw std::runtime_error("Villas_interface: vlist_init of in.endpoints failed for node " + _name +
" with return value " + std::to_string(ret));
}
......@@ -201,7 +192,6 @@ Villas_interface::Villas_interface(villas_node_config *_config, IO_object *IO_ob
}
}
m->formatter = villas::node::FormatFactory::make(_config->format_name);
IO->log_info("parsing completed for nanomsg");
} else {
//IO->log_info("Villas_interface: Error: node type " + std::string(type->name) + " not supported by DistAIX.");
throw std::runtime_error("Villas_interface: Error in node " + _name + ": node type "
......@@ -212,7 +202,7 @@ Villas_interface::Villas_interface(villas_node_config *_config, IO_object *IO_ob
// generate list of signals for villas node based on meta information of message type
// configures behavior-specific input and output signals
// this does the job of "node_direction_parse(...)"
IO->log_info("configuring signals based on meta infos");
IO->log_info("Villas_interface: configure signals");
for(auto & i : meta){
SignalType sig_type;
......@@ -249,21 +239,17 @@ Villas_interface::Villas_interface(villas_node_config *_config, IO_object *IO_ob
n->out.state = State::PARSED;
//check node
IO->log_info("Calling node_check");
IO->log_info("Villas_interface: node_check");
ret = node_check(n);
if (ret) {
//IO->log_info("Villas_interface: node_check failed for node " + _name +
//" and node type " + std::string(type->name) + " with return value " + std::to_string(ret));
throw std::runtime_error("Villas_interface: node_check failed for node " + _name +
" and node type " + std::string(type->name) + " with return value " + std::to_string(ret));
}
//prepare node
IO->log_info("Calling node_prepare");
IO->log_info("Villas_interface: node_prepare");
ret = node_prepare(n);
if (ret) {
//IO->log_info("Villas_interface: node_prepare failed for node " + _name +
//" and node type " + std::string(type->name) + " with return value " + std::to_string(ret));
throw std::runtime_error("Villas_interface: node_prepare failed for node " + _name +
" and node type " + std::string(type->name) + " with return value " + std::to_string(ret));
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment