audio-blockEngine/eaudiofx/flow/Base.cpp
Edouard DUPIN c01b518f05 [DEV] set compilation back ...
- update ejson
- update ememory
- umdate lutin
- umdate ewol
- update gale
2016-10-04 21:20:40 +02:00

79 lines
2.9 KiB
C++

/** @file
* @author Edouard DUPIN
* @copyright 2014, Edouard DUPIN, all right reserved
* @license APACHE v2.0 (see license file)
*/
#include <eaudiofx/debug.hpp>
#include <eaudiofx/flow/Interface.hpp>
#include <eaudiofx/flow/Base.hpp>
#include <eaudiofx/core/Block.hpp>
eaudiofx::flow::Base::Base(eaudiofx::flow::Interface& _flowInterfaceLink,
bool _input,
const std::string& _name,
const std::string& _description,
const std::string& _formatAvaillable) :
m_flowInterfaceLink(_flowInterfaceLink),
m_name(_name),
m_description(_description),
m_input(_input) {
m_ref = ememory::makeShared<BaseReference>(this);
// add a reference on the current signal ...
m_flowInterfaceLink.flowAdd(this);
m_formatAvaillable.parse(_formatAvaillable);
EAUDIOFX_INFO("Create flow : '" << m_name << "' mode:'" << (m_input==true?"input":"output") << "' prop:");
m_formatAvaillable.display();
}
eaudiofx::flow::Base::~Base() {
m_ref->removeBase();
EAUDIOFX_INFO("Remove flow : '" << m_name << "' mode:'" << (m_input==true?"input":"output") << "'");
};
std::ostream& eaudiofx::flow::operator <<(std::ostream& _os, const eaudiofx::flow::Base& _obj) {
_os << _obj.getName();
return _os;
}
void eaudiofx::flow::Base::link() {
EAUDIOFX_INFO(" link flow : '" << m_name << "' mode:'" << (m_input==true?"input":"output") << "' (no code)");
}
int32_t eaudiofx::flow::Base::checkCompatibility() {
EAUDIOFX_INFO(" check flow : '" << m_name << "' (no code)");
return -1;
}
void eaudiofx::flow::Base::getInputBuffer() {
EAUDIOFX_INFO(" get Buffers : '" << m_name << "' (no code)");
}
// due to the fact it acces at the block interface, we need to write it here ...
ememory::SharedPtr<eaudiofx::flow::BaseReference> eaudiofx::flow::Base::getFlowReference(const std::string& _blockName,
const std::string& _flowLinkName) {
ememory::SharedPtr<eaudiofx::flow::BaseReference> out;
if (_flowLinkName == "") {
EAUDIOFX_INFO(" Get flow : " << _blockName << ":" << _flowLinkName << " nothing to do ==> no connection ...");
}
ememory::SharedPtr<eaudiofx::Block> blockRemote = m_flowInterfaceLink.getBlockNamed(_blockName);
if (blockRemote == nullptr) {
EAUDIOFX_ERROR(" Get flow : '" << m_name << "' mode:'input' to " << _blockName << ":" << _flowLinkName << " Error no remote block");
} else {
out = blockRemote->getFlowReference(_flowLinkName);
if (out == nullptr) {
EAUDIOFX_ERROR(" Get flow : '" << m_name << "' mode:'input' to " << _blockName << ":" << _flowLinkName << " Error no Flow found");
} else {
EAUDIOFX_INFO(" Get flow : " << _blockName << ":" << _flowLinkName);
}
}
return out;
}
/*
ememory::SharedPtr<eaudiofx::Block> eaudiofx::flow::Base::getBlockNamed(const std::string& _name) {
EAUDIOFX_ERROR("NEED to call Parrent ...");
return nullptr;
}
*/