[DEV] update new etk Uri API

This commit is contained in:
Edouard DUPIN 2018-10-23 22:19:32 +02:00
parent fccbf4953e
commit 9f8b23080b
4 changed files with 61 additions and 61 deletions

View File

@ -440,46 +440,46 @@ bool audio::drain::Process::processIn(void* _inData,
return false; return false;
} }
static void link(etk::FSNode& _node, const etk::String& _first, const etk::String& _op, const etk::String& _second, bool _isLink=true) { static void link(ememory::SharedPtr<etk::io::Interface>& _io, const etk::String& _first, const etk::String& _op, const etk::String& _second, bool _isLink=true) {
if (_op == "->") { if (_op == "->") {
if (_isLink) { if (_isLink) {
_node << " " << _first << " -> " << _second << ";\n"; *_io << " " << _first << " -> " << _second << ";\n";
} else { } else {
_node << " " << _first << " -> " << _second << " [style=dashed];\n"; *_io << " " << _first << " -> " << _second << " [style=dashed];\n";
} }
} else if (_op == "<-") { } else if (_op == "<-") {
_node << " " << _first << " -> " <<_second<< " [color=transparent];\n"; *_io << " " << _first << " -> " <<_second<< " [color=transparent];\n";
if (_isLink) { if (_isLink) {
_node << " " << _second << " -> " << _first << " [constraint=false];\n"; *_io << " " << _second << " -> " << _first << " [constraint=false];\n";
} else { } else {
_node << " " << _second << " -> " << _first << " [constraint=false, style=dashed];\n"; *_io << " " << _second << " -> " << _first << " [constraint=false, style=dashed];\n";
} }
} }
} }
void audio::drain::Process::generateDot(etk::FSNode& _node, void audio::drain::Process::generateDot(ememory::SharedPtr<etk::io::Interface>& _io,
int32_t _offset, int32_t _offset,
int32_t _basicID, int32_t _basicID,
etk::String& _nameIn, etk::String& _nameIn,
etk::String& _nameOut, etk::String& _nameOut,
bool _reserseGraph) { bool _reserseGraph) {
_node << " subgraph clusterNode_" << _basicID << "_process {\n"; *_io << " subgraph clusterNode_" << _basicID << "_process {\n";
_node << " label=\"Drain::Process" << (_reserseGraph?"_R":"_N") << "\";\n"; *_io << " label=\"Drain::Process" << (_reserseGraph?"_R":"_N") << "\";\n";
_node << " node [shape=ellipse];\n"; *_io << " node [shape=ellipse];\n";
if (_reserseGraph == false) { if (_reserseGraph == false) {
// ---------------------- // ----------------------
// -- STEP 1 -- // -- STEP 1 --
// ---------------------- // ----------------------
_nameIn = "INTERFACE_ALGO_" + etk::toString(_basicID) + "_in"; _nameIn = "INTERFACE_ALGO_" + etk::toString(_basicID) + "_in";
_node << " " << _nameIn << " [ label=\"format=" << etk::toString(getInputConfig().getFormat()) *_io << " " << _nameIn << " [ label=\"format=" << etk::toString(getInputConfig().getFormat())
<< "\\n freq=" << getInputConfig().getFrequency() << "\\n freq=" << getInputConfig().getFrequency()
<< "\\n channelMap=" << etk::toString(getInputConfig().getMap()) << "\\n in\" ];\n"; << "\\n channelMap=" << etk::toString(getInputConfig().getMap()) << "\\n in\" ];\n";
// ---------------------- // ----------------------
// -- STEP 2 -- // -- STEP 2 --
// ---------------------- // ----------------------
etk::String connectString = _nameIn; etk::String connectString = _nameIn;
_node << " node [shape=box];\n"; *_io << " node [shape=box];\n";
// ---------------------- // ----------------------
// -- STEP 3 -- // -- STEP 3 --
// ---------------------- // ----------------------
@ -488,46 +488,46 @@ void audio::drain::Process::generateDot(etk::FSNode& _node,
continue; continue;
} }
etk::String connectStringSecond = "ALGO_" + etk::toString(_basicID) + "__" + etk::toString(iii); etk::String connectStringSecond = "ALGO_" + etk::toString(_basicID) + "__" + etk::toString(iii);
_node << " " << connectStringSecond << " [label=\"ALGO\\ntype='" << m_listAlgo[iii]->getType() << "'"; *_io << " " << connectStringSecond << " [label=\"ALGO\\ntype='" << m_listAlgo[iii]->getType() << "'";
if (m_listAlgo[iii]->getName() != "") { if (m_listAlgo[iii]->getName() != "") {
_node << "\\nname='" << m_listAlgo[iii]->getName() << "'"; *_io << "\\nname='" << m_listAlgo[iii]->getName() << "'";
} }
etk::String tmpDesc = m_listAlgo[iii]->getDotDesc(); etk::String tmpDesc = m_listAlgo[iii]->getDotDesc();
if (tmpDesc.size() != 0) { if (tmpDesc.size() != 0) {
_node << tmpDesc; *_io << tmpDesc;
} }
_node << "\" ];\n"; *_io << "\" ];\n";
link(_node, connectString, "->", connectStringSecond); link(_io, connectString, "->", connectStringSecond);
connectString = connectStringSecond; connectString = connectStringSecond;
} }
// ---------------------- // ----------------------
// -- STEP 4 -- // -- STEP 4 --
// ---------------------- // ----------------------
_node << " node [shape=ellipse];\n"; *_io << " node [shape=ellipse];\n";
// ---------------------- // ----------------------
// -- STEP 5 -- // -- STEP 5 --
// ---------------------- // ----------------------
_nameOut = "INTERFACE_ALGO_" + etk::toString(_basicID) + "_out"; _nameOut = "INTERFACE_ALGO_" + etk::toString(_basicID) + "_out";
_node << " " << _nameOut << " [ label=\"format=" << etk::toString(getOutputConfig().getFormat()) *_io << " " << _nameOut << " [ label=\"format=" << etk::toString(getOutputConfig().getFormat())
<< "\\n freq=" << getOutputConfig().getFrequency() << "\\n freq=" << getOutputConfig().getFrequency()
<< "\\n channelMap=" << etk::toString(getOutputConfig().getMap()) << "\\n out\" ];\n"; << "\\n channelMap=" << etk::toString(getOutputConfig().getMap()) << "\\n out\" ];\n";
// ---------------------- // ----------------------
// -- STEP 6 -- // -- STEP 6 --
// ---------------------- // ----------------------
link(_node, connectString, "->", _nameOut); link(_io, connectString, "->", _nameOut);
} else { } else {
// ---------------------- // ----------------------
// -- STEP 1 -- // -- STEP 1 --
// ---------------------- // ----------------------
_nameIn = "INTERFACE_ALGO_" + etk::toString(_basicID) + "_out"; _nameIn = "INTERFACE_ALGO_" + etk::toString(_basicID) + "_out";
_node << " " << _nameIn << " [ label=\"format=" << etk::toString(getOutputConfig().getFormat()) *_io << " " << _nameIn << " [ label=\"format=" << etk::toString(getOutputConfig().getFormat())
<< "\\n freq=" << getOutputConfig().getFrequency() << "\\n freq=" << getOutputConfig().getFrequency()
<< "\\n channelMap=" << etk::toString(getOutputConfig().getMap()) << "\\n out\" ];\n"; << "\\n channelMap=" << etk::toString(getOutputConfig().getMap()) << "\\n out\" ];\n";
// ---------------------- // ----------------------
// -- STEP 2 -- // -- STEP 2 --
// ---------------------- // ----------------------
etk::String connectString = _nameIn; etk::String connectString = _nameIn;
_node << " node [shape=box];\n"; *_io << " node [shape=box];\n";
// ---------------------- // ----------------------
// -- STEP 3 -- // -- STEP 3 --
// ---------------------- // ----------------------
@ -537,73 +537,73 @@ void audio::drain::Process::generateDot(etk::FSNode& _node,
continue; continue;
} }
etk::String connectStringSecond = "ALGO_" + etk::toString(_basicID) + "__" + etk::toString(iii); etk::String connectStringSecond = "ALGO_" + etk::toString(_basicID) + "__" + etk::toString(iii);
_node << " " << connectStringSecond << " [label=\"ALGO\\ntype='" << m_listAlgo[iii]->getType() << "'"; *_io << " " << connectStringSecond << " [label=\"ALGO\\ntype='" << m_listAlgo[iii]->getType() << "'";
if (m_listAlgo[iii]->getName() != "") { if (m_listAlgo[iii]->getName() != "") {
_node << "\\nname='" << m_listAlgo[iii]->getName() << "'"; *_io << "\\nname='" << m_listAlgo[iii]->getName() << "'";
} }
etk::String tmpDesc = m_listAlgo[iii]->getDotDesc(); etk::String tmpDesc = m_listAlgo[iii]->getDotDesc();
if (tmpDesc.size() != 0) { if (tmpDesc.size() != 0) {
_node << tmpDesc; *_io << tmpDesc;
} }
_node << "\" ];\n"; *_io << "\" ];\n";
//link(_node, connectStringSecond, "<-", connectString); //link(_io, connectStringSecond, "<-", connectString);
link(_node, connectString, "<-", connectStringSecond); link(_io, connectString, "<-", connectStringSecond);
//link(_node, connectStringSecond, "->", connectString); //link(_io, connectStringSecond, "->", connectString);
connectString = connectStringSecond; connectString = connectStringSecond;
} }
// ---------------------- // ----------------------
// -- STEP 4 -- // -- STEP 4 --
// ---------------------- // ----------------------
_node << " node [shape=ellipse];\n"; *_io << " node [shape=ellipse];\n";
// ---------------------- // ----------------------
// -- STEP 5 -- // -- STEP 5 --
// ---------------------- // ----------------------
_nameOut = "INTERFACE_ALGO_" + etk::toString(_basicID) + "_in"; _nameOut = "INTERFACE_ALGO_" + etk::toString(_basicID) + "_in";
_node << " " << _nameOut << " [ label=\"format=" << etk::toString(getInputConfig().getFormat()) *_io << " " << _nameOut << " [ label=\"format=" << etk::toString(getInputConfig().getFormat())
<< "\\n freq=" << getInputConfig().getFrequency() << "\\n freq=" << getInputConfig().getFrequency()
<< "\\n channelMap=" << etk::toString(getInputConfig().getMap()) << "\\n in\" ];\n"; << "\\n channelMap=" << etk::toString(getInputConfig().getMap()) << "\\n in\" ];\n";
// ---------------------- // ----------------------
// -- STEP 6 -- // -- STEP 6 --
// ---------------------- // ----------------------
link(_node, connectString, "<-", _nameOut); link(_io, connectString, "<-", _nameOut);
} }
_node << " }\n"; *_io << " }\n";
} }
void audio::drain::Process::generateDotProcess(etk::FSNode& _node, int32_t _offset, int32_t _basicID, etk::String& _nameIn, etk::String& _nameOut, bool _reserseGraph) { void audio::drain::Process::generateDotProcess(ememory::SharedPtr<etk::io::Interface>& _io, int32_t _offset, int32_t _basicID, etk::String& _nameIn, etk::String& _nameOut, bool _reserseGraph) {
_node << " subgraph clusterNode_" << _basicID << "_process {\n"; *_io << " subgraph clusterNode_" << _basicID << "_process {\n";
_node << " label=\"Drain::Process" << (_reserseGraph?"_R":"_N") << "\";\n"; *_io << " label=\"Drain::Process" << (_reserseGraph?"_R":"_N") << "\";\n";
_node << " node [shape=ellipse];\n"; *_io << " node [shape=ellipse];\n";
if (_reserseGraph == true) { if (_reserseGraph == true) {
_nameIn = "INTERFACE_ALGO_" + etk::toString(_basicID) + "_in"; _nameIn = "INTERFACE_ALGO_" + etk::toString(_basicID) + "_in";
_node << " " << _nameIn << " [ label=\"format=" << etk::toString(getInputConfig().getFormat()) *_io << " " << _nameIn << " [ label=\"format=" << etk::toString(getInputConfig().getFormat())
<< "\\n freq=" << getInputConfig().getFrequency() << "\\n freq=" << getInputConfig().getFrequency()
<< "\\n channelMap=" << etk::toString(getInputConfig().getMap()) << "\\n in\" ];\n"; << "\\n channelMap=" << etk::toString(getInputConfig().getMap()) << "\\n in\" ];\n";
} else { } else {
_nameIn = "INTERFACE_ALGO_" + etk::toString(_basicID) + "_out"; _nameIn = "INTERFACE_ALGO_" + etk::toString(_basicID) + "_out";
_node << " " << _nameIn << " [ label=\"format=" << etk::toString(getOutputConfig().getFormat()) *_io << " " << _nameIn << " [ label=\"format=" << etk::toString(getOutputConfig().getFormat())
<< "\\n freq=" << getOutputConfig().getFrequency() << "\\n freq=" << getOutputConfig().getFrequency()
<< "\\n channelMap=" << etk::toString(getOutputConfig().getMap()) << "\\n out\" ];\n"; << "\\n channelMap=" << etk::toString(getOutputConfig().getMap()) << "\\n out\" ];\n";
} }
etk::String connectString = _nameIn; etk::String connectString = _nameIn;
_node << " node [shape=box];\n"; *_io << " node [shape=box];\n";
if (_reserseGraph == false) { if (_reserseGraph == false) {
for (size_t iii=0; iii<m_listAlgo.size(); ++iii) { for (size_t iii=0; iii<m_listAlgo.size(); ++iii) {
if (m_listAlgo[iii] == null) { if (m_listAlgo[iii] == null) {
continue; continue;
} }
etk::String connectStringSecond = "ALGO_" + etk::toString(_basicID) + "__" + etk::toString(iii); etk::String connectStringSecond = "ALGO_" + etk::toString(_basicID) + "__" + etk::toString(iii);
_node << " " << connectStringSecond << " [label=\"ALGO\\ntype='" << m_listAlgo[iii]->getType() << "'"; *_io << " " << connectStringSecond << " [label=\"ALGO\\ntype='" << m_listAlgo[iii]->getType() << "'";
if (m_listAlgo[iii]->getName() != "") { if (m_listAlgo[iii]->getName() != "") {
_node << "\\nname='" << m_listAlgo[iii]->getName() << "'"; *_io << "\\nname='" << m_listAlgo[iii]->getName() << "'";
} }
etk::String tmpDesc = m_listAlgo[iii]->getDotDesc(); etk::String tmpDesc = m_listAlgo[iii]->getDotDesc();
if (tmpDesc.size() != 0) { if (tmpDesc.size() != 0) {
_node << tmpDesc; *_io << tmpDesc;
} }
_node << "\" ];\n"; *_io << "\" ];\n";
link(_node, connectString, "->", connectStringSecond); link(_io, connectString, "->", connectStringSecond);
connectString = connectStringSecond; connectString = connectStringSecond;
} }
} else { } else {
@ -613,37 +613,37 @@ void audio::drain::Process::generateDotProcess(etk::FSNode& _node, int32_t _offs
continue; continue;
} }
etk::String connectStringSecond = "ALGO_" + etk::toString(_basicID) + "__" + etk::toString(iii); etk::String connectStringSecond = "ALGO_" + etk::toString(_basicID) + "__" + etk::toString(iii);
_node << " " << connectStringSecond << " [label=\"ALGO\\ntype='" << m_listAlgo[iii]->getType() << "'"; *_io << " " << connectStringSecond << " [label=\"ALGO\\ntype='" << m_listAlgo[iii]->getType() << "'";
if (m_listAlgo[iii]->getName() != "") { if (m_listAlgo[iii]->getName() != "") {
_node << "\\nname='" << m_listAlgo[iii]->getName() << "'"; *_io << "\\nname='" << m_listAlgo[iii]->getName() << "'";
} }
etk::String tmpDesc = m_listAlgo[iii]->getDotDesc(); etk::String tmpDesc = m_listAlgo[iii]->getDotDesc();
if (tmpDesc.size() != 0) { if (tmpDesc.size() != 0) {
_node << tmpDesc; *_io << tmpDesc;
} }
_node << "\" ];\n"; *_io << "\" ];\n";
link(_node, connectStringSecond, "<-", connectString); link(_io, connectStringSecond, "<-", connectString);
connectString = connectStringSecond; connectString = connectStringSecond;
} }
} }
_node << " node [shape=ellipse];\n"; *_io << " node [shape=ellipse];\n";
if (_reserseGraph == true) { if (_reserseGraph == true) {
_nameOut = "INTERFACE_ALGO_" + etk::toString(_basicID) + "_out"; _nameOut = "INTERFACE_ALGO_" + etk::toString(_basicID) + "_out";
_node << " " << _nameOut << " [ label=\"format=" << etk::toString(getOutputConfig().getFormat()) *_io << " " << _nameOut << " [ label=\"format=" << etk::toString(getOutputConfig().getFormat())
<< "\\n freq=" << getOutputConfig().getFrequency() << "\\n freq=" << getOutputConfig().getFrequency()
<< "\\n channelMap=" << etk::toString(getOutputConfig().getMap()) << "\\n out\" ];\n"; << "\\n channelMap=" << etk::toString(getOutputConfig().getMap()) << "\\n out\" ];\n";
} else { } else {
_nameOut = "INTERFACE_ALGO_" + etk::toString(_basicID) + "_in"; _nameOut = "INTERFACE_ALGO_" + etk::toString(_basicID) + "_in";
_node << " " << _nameOut << " [ label=\"format=" << etk::toString(getInputConfig().getFormat()) *_io << " " << _nameOut << " [ label=\"format=" << etk::toString(getInputConfig().getFormat())
<< "\\n freq=" << getInputConfig().getFrequency() << "\\n freq=" << getInputConfig().getFrequency()
<< "\\n channelMap=" << etk::toString(getInputConfig().getMap()) << "\\n in\" ];\n"; << "\\n channelMap=" << etk::toString(getInputConfig().getMap()) << "\\n in\" ];\n";
} }
if (_reserseGraph == false) { if (_reserseGraph == false) {
link(_node, connectString, "->", _nameOut); link(_io, connectString, "->", _nameOut);
} else { } else {
link(_node, _nameOut, "<-", connectString); link(_io, _nameOut, "<-", connectString);
} }
_node << " }\n"; *_io << " }\n";
} }

View File

@ -7,12 +7,12 @@
#include <etk/String.hpp> #include <etk/String.hpp>
#include <etk/Vector.hpp> #include <etk/Vector.hpp>
#include <etk/io/Interface.hpp>
#include <audio/format.hpp> #include <audio/format.hpp>
#include <audio/channel.hpp> #include <audio/channel.hpp>
#include <audio/drain/Algo.hpp> #include <audio/drain/Algo.hpp>
#include <echrono/Steady.hpp> #include <echrono/Steady.hpp>
#include <ememory/memory.hpp> #include <ememory/memory.hpp>
#include <etk/os/FSNode.hpp>
namespace audio { namespace audio {
namespace drain{ namespace drain{
@ -178,9 +178,9 @@ namespace audio {
void displayAlgo(); void displayAlgo();
void updateAlgo(size_t _position); void updateAlgo(size_t _position);
public: public:
void generateDot(etk::FSNode& _node, int32_t _offset, int32_t _basicID, etk::String& _nameIn, etk::String& _nameOut, bool _reserseGraph); void generateDot(ememory::SharedPtr<etk::io::Interface>& _io, int32_t _offset, int32_t _basicID, etk::String& _nameIn, etk::String& _nameOut, bool _reserseGraph);
// TODO : Remove this one when we find a good way to do it ... // TODO : Remove this one when we find a good way to do it ...
void generateDotProcess(etk::FSNode& _node, int32_t _offset, int32_t _basicID, etk::String& _nameIn, etk::String& _nameOut, bool _reserseGraph); void generateDotProcess(ememory::SharedPtr<etk::io::Interface>& _io, int32_t _offset, int32_t _basicID, etk::String& _nameIn, etk::String& _nameOut, bool _reserseGraph);
}; };
} }
} }

View File

@ -66,7 +66,7 @@ void appl::Windows::init() {
ewol::widget::Windows::init(); ewol::widget::Windows::init();
setTitle("Drain Equalizer Profiler"); setTitle("Drain Equalizer Profiler");
m_gui = ewol::widget::Composer::create(ewol::widget::Composer::file, "DATA:gui.xml"); m_gui = ewol::widget::Composer::create(ewol::widget::Composer::file, "DATA:///gui.xml");
if (m_gui != null) { if (m_gui != null) {
setSubWidget(m_gui); setSubWidget(m_gui);
} }

View File

@ -53,7 +53,7 @@ void appl::Windows::init() {
ewol::widget::Windows::init(); ewol::widget::Windows::init();
setTitle("Drain Equalizer Profiler"); setTitle("Drain Equalizer Profiler");
m_gui = ewol::widget::Composer::create(ewol::widget::Composer::file, "DATA:gui.xml"); m_gui = ewol::widget::Composer::create(ewol::widget::Composer::file, "DATA:///gui.xml");
if (m_gui != null) { if (m_gui != null) {
setSubWidget(m_gui); setSubWidget(m_gui);
} }