[DEV] update etk null

This commit is contained in:
Edouard DUPIN 2018-06-19 22:31:29 +02:00
parent 859417e4fe
commit 8a16ccf72a
12 changed files with 74 additions and 74 deletions

View File

@ -12,7 +12,7 @@
audio::blockEngine::GeneratorFile::GeneratorFile() :
m_file(nullptr) {
m_file(null) {
// set output :
m_io.insert(
etk::Pair<etk::String, audio::blockEngine::Block::IOProperty>(
@ -33,7 +33,7 @@ int32_t audio::blockEngine::GeneratorFile::pull(double _currentTime, int32_t _re
}
audio::blockEngine::BufferStream* buffer = dynamic_cast<audio::blockEngine::BufferStream*>(it->second.m_buffer);
//ABE_ERROR("Generate data, request : " << _request << " at time : " << _currentTime);
if (buffer == nullptr) {
if (buffer == null) {
// !! impossible case => a buffer can not be removed ...
ABE_ERROR("Buffer has been removed... OR change type ...");
return audio::blockEngine::ERR_FAIL;
@ -41,7 +41,7 @@ int32_t audio::blockEngine::GeneratorFile::pull(double _currentTime, int32_t _re
//request outpuffer needed size :
buffer->setProperty(_request);
uint8_t* data = buffer->getData();
if (m_file == nullptr) {
if (m_file == null) {
ABE_ERROR("Buffer output error ==> !!ERROR!!");
return audio::blockEngine::ERR_FAIL;
}
@ -53,7 +53,7 @@ int32_t audio::blockEngine::GeneratorFile::pull(double _currentTime, int32_t _re
int32_t audio::blockEngine::GeneratorFile::init() {
m_file = new etk::FSNode("DATA:menu.wav");
if (m_file == nullptr) {
if (m_file == null) {
ABE_ERROR("Can not allocate the input file ...");
return audio::blockEngine::ERR_FAIL;
}
@ -66,17 +66,17 @@ int32_t audio::blockEngine::GeneratorFile::init() {
int32_t audio::blockEngine::GeneratorFile::unInit() {
if (m_file == nullptr) {
if (m_file == null) {
return audio::blockEngine::ERR_NONE;
}
if (m_file->fileClose() == false) {
ABE_ERROR("Can not close the input file ...");
delete(m_file);
m_file = nullptr;
m_file = null;
return audio::blockEngine::ERR_FAIL;
}
delete(m_file);
m_file = nullptr;
m_file = null;
return audio::blockEngine::ERR_NONE;
}

View File

@ -33,7 +33,7 @@ int32_t audio::blockEngine::GeneratorSignal::pull(double _currentTime, int32_t _
}
audio::blockEngine::BufferAudioRaw* buffer = dynamic_cast<audio::blockEngine::BufferAudioRaw*>(it->second.m_buffer);
//ABE_ERROR("Generate data, request : " << _request << " at time : " << _currentTime);
if (buffer == nullptr) {
if (buffer == null) {
// !! impossible case => a buffer can not be removed ...
ABE_ERROR("Buffer has been removed... OR change type ...");
return audio::blockEngine::ERR_FAIL;

View File

@ -8,7 +8,7 @@
audio::blockEngine::ReceiverFile::ReceiverFile() :
m_file(nullptr),
m_file(null),
m_channels(4),
m_frequency(16000),
m_requestSize(256),
@ -20,14 +20,14 @@ audio::blockEngine::ReceiverFile::ReceiverFile() :
audio::blockEngine::Block::IOProperty(
audio::blockEngine::Block::ioInput,
"{ type:'audio', compression:'raw', frequency:16000, channel:4, format:'int16_t' }",
nullptr
null
) ) );
}
int32_t audio::blockEngine::ReceiverFile::init() {
m_file = new etk::FSNode("ouput.raw");
if (m_file == nullptr) {
if (m_file == null) {
ABE_ERROR("Can not allocate the output file ...");
return audio::blockEngine::ERR_FAIL;
}
@ -40,17 +40,17 @@ int32_t audio::blockEngine::ReceiverFile::init() {
int32_t audio::blockEngine::ReceiverFile::unInit() {
ABE_DEBUG("un-init Stream ...");
if (m_file == nullptr) {
if (m_file == null) {
return audio::blockEngine::ERR_NONE;
}
if (m_file->fileClose() == false) {
ABE_ERROR("Can not close the input file ...");
delete(m_file);
m_file = nullptr;
m_file = null;
return audio::blockEngine::ERR_FAIL;
}
delete(m_file);
m_file = nullptr;
m_file = null;
return audio::blockEngine::ERR_NONE;
};
@ -75,7 +75,7 @@ int32_t audio::blockEngine::ReceiverFile::pull(double _currentTime, int32_t _req
}
audio::blockEngine::BufferStream* buffer = dynamic_cast<audio::blockEngine::BufferStream*>(it->second.m_buffer);
//ABE_ERROR("Generate data, request : " << _request << " at time : " << _currentTime);
if (buffer == nullptr) {
if (buffer == null) {
// !! impossible case => a buffer can not be removed ...
ABE_ERROR("Buffer has been removed... OR change type ...");
return audio::blockEngine::ERR_FAIL;
@ -83,7 +83,7 @@ int32_t audio::blockEngine::ReceiverFile::pull(double _currentTime, int32_t _req
//request outpuffer needed size :
buffer->setProperty(_request);
uint8_t* data = buffer->getData();
if (m_file == nullptr) {
if (m_file == null) {
ABE_ERROR("Buffer output error ==> !!ERROR!!");
return audio::blockEngine::ERR_FAIL;
}

View File

@ -48,7 +48,7 @@ void audio::blockEngine::ReceiverRiver::onDataNeeded(void* _data,
int32_t audio::blockEngine::ReceiverRiver::algoInit() {
ABE_DEBUG("Intanciate audio::river Manager ...");
m_manager = audio::river::Manager::create("eaudio-fx-output");
if (m_manager == nullptr) {
if (m_manager == null) {
ABE_ERROR("Can not intanciate RIVER interface");
return audio::blockEngine::ERR_FAIL;
}
@ -60,8 +60,8 @@ int32_t audio::blockEngine::ReceiverRiver::algoInit() {
channelMap,
audio::format_int16,
"speaker");
if(m_interface == nullptr) {
ABE_ERROR("nullptr interface");
if(m_interface == null) {
ABE_ERROR("null interface");
return audio::blockEngine::ERR_FAIL;
}
// set callback mode ...
@ -79,8 +79,8 @@ int32_t audio::blockEngine::ReceiverRiver::algoInit() {
int32_t audio::blockEngine::ReceiverRiver::algoUnInit() {
ABE_DEBUG("un-init Stream ...");
if(m_interface == nullptr) {
ABE_ERROR("nullptr interface");
if(m_interface == null) {
ABE_ERROR("null interface");
return audio::blockEngine::ERR_FAIL;
}
m_interface.reset();
@ -90,8 +90,8 @@ int32_t audio::blockEngine::ReceiverRiver::algoUnInit() {
int32_t audio::blockEngine::ReceiverRiver::algoStart() {
ABE_DEBUG("Start stream ...");
if(m_interface == nullptr) {
ABE_ERROR("nullptr interface");
if(m_interface == null) {
ABE_ERROR("null interface");
return audio::blockEngine::ERR_FAIL;
}
m_interface->start();
@ -100,8 +100,8 @@ int32_t audio::blockEngine::ReceiverRiver::algoStart() {
int32_t audio::blockEngine::ReceiverRiver::algoStop() {
ABE_DEBUG("Stop Stream ...");
if(m_interface == nullptr) {
ABE_ERROR("nullptr interface");
if(m_interface == null) {
ABE_ERROR("null interface");
return audio::blockEngine::ERR_FAIL;
}
m_interface->stop();

View File

@ -23,9 +23,9 @@ ememory::SharedPtr<audio::blockEngine::Block> audio::blockEngine::Block::getBloc
ememory::SharedPtr<audio::blockEngine::Block> out;
ABE_INFO(" get block : " << _name);
ewol::ObjectShared parrent = m_parent.lock();
if (parrent != nullptr) {
if (parrent != null) {
ememory::SharedPtr<audio::blockEngine::Block> parrentBlock = ememory::dynamicPointerCast<audio::blockEngine::Block>(parrent);
if (parrentBlock != nullptr) {
if (parrentBlock != null) {
return parrentBlock->getBlockNamed(_name);
} else {
ABE_INFO(" Parent is not a Block ...");

View File

@ -15,7 +15,7 @@ audio::blockEngine::BlockMeta::BlockMeta() {
audio::blockEngine::BlockMeta::~BlockMeta() {
// TODO : Unlink all ...
for (auto &it : m_list) {
if (it == nullptr) {
if (it == null) {
continue;
}
ememory::SharedPtr<audio::blockEngine::Block> tmp = it;
@ -26,28 +26,28 @@ audio::blockEngine::BlockMeta::~BlockMeta() {
ememory::SharedPtr<audio::blockEngine::Block> audio::blockEngine::BlockMeta::getBlock(const etk::String& _name) {
if (_name.size() == 0) {
return nullptr;
return null;
}
for (auto &it : m_list) {
if (it == nullptr) {
if (it == null) {
continue;
}
if (it->propertyName.get() == _name) {
return it;
}
}
return nullptr;
return null;
}
int32_t audio::blockEngine::BlockMeta::addBlock(ememory::SharedPtr<audio::blockEngine::Block> _block) {
if (_block == nullptr) {
ABE_ERROR("[" << getId() << "] Add nullptr block");
if (_block == null) {
ABE_ERROR("[" << getId() << "] Add null block");
return audio::blockEngine::ERR_INPUT_NULL;
}
if (_block->propertyName.get().size() > 0 ) {
// Check if name exist :
for (auto &it : m_list) {
if (it == nullptr) {
if (it == null) {
continue;
}
if (it->propertyName.get() == _block->propertyName.get()) {
@ -78,7 +78,7 @@ int32_t audio::blockEngine::BlockMeta::linkBlock(const etk::String& _generatorBl
const etk::String& _receiverIoName) {
// TODO : proxy IOs
ememory::SharedPtr<audio::blockEngine::Block> receive = getBlock(_receiverBlockName);
if (receive == nullptr) {
if (receive == null) {
ABE_ERROR("Can not find destination block : '" << _receiverBlockName << "'");
return audio::blockEngine::ERR_FAIL;
}
@ -101,7 +101,7 @@ int32_t audio::blockEngine::BlockMeta::algoInit() {
ABE_INFO("[" << getId() << "]Init Meta block : '" << propertyName << "'");
int32_t ret = audio::blockEngine::ERR_NONE;
for (auto &it : m_list) {
if (it == nullptr) {
if (it == null) {
continue;
}
if (it->algoInit() != audio::blockEngine::ERR_NONE) {
@ -117,7 +117,7 @@ int32_t audio::blockEngine::BlockMeta::algoInit() {
int32_t audio::blockEngine::BlockMeta::algoUnInit() {
int32_t ret = audio::blockEngine::ERR_NONE;
for (auto &it : m_list) {
if (it == nullptr) {
if (it == null) {
continue;
}
if (it->algoUnInit() != audio::blockEngine::ERR_NONE) {
@ -135,7 +135,7 @@ int32_t audio::blockEngine::BlockMeta::algoStart() {
ABE_INFO("[" << getId() << "] Start Meta block : '" << propertyName << "'");
int32_t ret = audio::blockEngine::ERR_NONE;
for (auto &it : m_list) {
if (it == nullptr) {
if (it == null) {
continue;
}
if (it->algoStart() != audio::blockEngine::ERR_NONE) {
@ -152,7 +152,7 @@ int32_t audio::blockEngine::BlockMeta::algoStop() {
ABE_INFO("[" << getId() << "] Stop Meta block : '" << propertyName << "'");
int32_t ret = audio::blockEngine::ERR_NONE;
for (auto &it : m_list) {
if (it == nullptr) {
if (it == null) {
continue;
}
if (it->algoStop() != audio::blockEngine::ERR_NONE) {
@ -177,7 +177,7 @@ ememory::SharedPtr<audio::blockEngine::Block> audio::blockEngine::BlockMeta::get
}
// find in sub elements.
for (auto &it : m_list) {
if (it == nullptr) {
if (it == null) {
continue;
}
ABE_DEBUG(" check : " << it->propertyName.get());
@ -194,7 +194,7 @@ void audio::blockEngine::BlockMeta::flowLinkInput() {
ABE_INFO("[" << getId() << "] Meta block Link: '" << propertyName << "'");
// find in sub elements.
for (auto &it : m_list) {
if (it == nullptr) {
if (it == null) {
continue;
}
it->flowLinkInput();
@ -208,7 +208,7 @@ void audio::blockEngine::BlockMeta::flowCheckAllCompatibility() {
ABE_INFO("[" << getId() << "] Meta block check compatibilities: '" << propertyName << "'");
// find in sub elements.
for (auto &it : m_list) {
if (it == nullptr) {
if (it == null) {
continue;
}
it->flowCheckAllCompatibility();
@ -221,7 +221,7 @@ void audio::blockEngine::BlockMeta::flowAllocateOutput() {
ABE_INFO("[" << getId() << "] Meta block allocate output: '" << propertyName << "'");
// find in sub elements.
for (auto &it : m_list) {
if (it == nullptr) {
if (it == null) {
continue;
}
it->flowAllocateOutput();
@ -234,7 +234,7 @@ void audio::blockEngine::BlockMeta::flowGetInput() {
ABE_INFO("[" << getId() << "] Meta block get input ... : '" << propertyName << "'");
// find in sub elements.
for (auto &it : m_list) {
if (it == nullptr) {
if (it == null) {
continue;
}
it->flowGetInput();

View File

@ -57,11 +57,11 @@ ememory::SharedPtr<audio::blockEngine::flow::BaseReference> audio::blockEngine::
ABE_INFO(" Get flow : " << _blockName << ":" << _flowLinkName << " nothing to do ==> no connection ...");
}
ememory::SharedPtr<audio::blockEngine::Block> blockRemote = m_flowInterfaceLink.getBlockNamed(_blockName);
if (blockRemote == nullptr) {
if (blockRemote == null) {
ABE_ERROR(" Get flow : '" << m_name << "' mode:'input' to " << _blockName << ":" << _flowLinkName << " Error no remote block");
} else {
out = blockRemote->getFlowReference(_flowLinkName);
if (out == nullptr) {
if (out == null) {
ABE_ERROR(" Get flow : '" << m_name << "' mode:'input' to " << _blockName << ":" << _flowLinkName << " Error no Flow found");
} else {
ABE_INFO(" Get flow : " << _blockName << ":" << _flowLinkName);
@ -73,6 +73,6 @@ ememory::SharedPtr<audio::blockEngine::flow::BaseReference> audio::blockEngine::
/*
ememory::SharedPtr<audio::blockEngine::Block> audio::blockEngine::flow::Base::getBlockNamed(const etk::String& _name) {
ABE_ERROR("NEED to call Parrent ...");
return nullptr;
return null;
}
*/

View File

@ -90,13 +90,13 @@ namespace audio {
protected:
Base* m_basePointer;
public:
BaseReference(Base* _base = nullptr) :
BaseReference(Base* _base = null) :
m_basePointer(_base) {
// nothing to do ...
}
~BaseReference() {}
void removeBase() {
m_basePointer = nullptr;
m_basePointer = null;
}
inline Base* getBase() const {
return m_basePointer;

View File

@ -40,7 +40,7 @@ namespace audio {
void set(const ememory::SharedPtr<audio::blockEngine::Buffer>& _data){
m_data.reset();
ememory::SharedPtr<T> check = ememory::dynamicPointerCast<T>(_data);
if (check == nullptr) {
if (check == null) {
ABE_ERROR("can not set buffer as flow (type uncompatible)");
return;
}
@ -85,7 +85,7 @@ namespace audio {
ABE_INFO(" link flow : '" << Base::m_name << "' mode:'input' to " << m_blockName << ":" << m_flowName);
ememory::SharedPtr<BaseReference> remoteFlow = Base::getFlowReference(m_blockName, m_flowName);
m_remoteFlow = remoteFlow;
if (remoteFlow == nullptr) {
if (remoteFlow == null) {
ABE_ERROR(" link flow : '" << Base::m_name << "' mode:'input' to " << m_blockName << ":" << m_flowName << " Error no Flow found");
return;
}
@ -125,8 +125,8 @@ namespace audio {
list.pushBack(Base::getCapabilities());
for (auto &it : m_remoteFlow) {
ememory::SharedPtr<BaseReference> tmp = it.lock();
if (tmp != nullptr) {
if (tmp->getBase() != nullptr) {
if (tmp != null) {
if (tmp->getBase() != null) {
list.pushBack(tmp->getBase()->getCapabilities());
}
}

View File

@ -18,20 +18,20 @@ audio::blockEngine::flow::Interface::~Interface() {
// note this pointer is not allocated and not free at the end of the class
void audio::blockEngine::flow::Interface::flowAdd(audio::blockEngine::flow::Base* _pointerOnFlow) {
if (_pointerOnFlow == nullptr) {
ABE_ERROR("Try to link a nullptr flow");
if (_pointerOnFlow == null) {
ABE_ERROR("Try to link a null flow");
return;
}
m_list.pushBack(_pointerOnFlow);
}
void audio::blockEngine::flow::Interface::flowRemove(audio::blockEngine::flow::Base* _pointerOnFlow) {
if (_pointerOnFlow == nullptr) {
ABE_ERROR("Try to unlink a nullptr flow");
if (_pointerOnFlow == null) {
ABE_ERROR("Try to unlink a null flow");
return;
}
for (auto it(m_list.begin()); it != m_list.end(); ++it) {
if (*it == nullptr) {
if (*it == null) {
continue;
}
if (*it == _pointerOnFlow) {
@ -45,7 +45,7 @@ void audio::blockEngine::flow::Interface::flowRemove(audio::blockEngine::flow::B
etk::Vector<etk::String> audio::blockEngine::flow::Interface::flowGetAll() const {
etk::Vector<etk::String> out;
for (auto &it : m_list) {
if(it != nullptr) {
if(it != null) {
out.pushBack(it->getName());
}
}
@ -61,7 +61,7 @@ void audio::blockEngine::flow::Interface::flowSetLinkWith(const etk::String& _fl
const etk::String& _blockName,
const etk::String& _flowLinkName) {
for (auto &it : m_list) {
if( it != nullptr
if( it != null
&& it->getName() == _flowName) {
it->setLink(_blockName, _flowLinkName);
return;
@ -73,7 +73,7 @@ void audio::blockEngine::flow::Interface::flowSetLinkWith(const etk::String& _fl
void audio::blockEngine::flow::Interface::flowLinkInput() {
ABE_INFO(" Block update the flows links (" << m_list.size() << " flows)");
for (auto &it : m_list) {
if(it != nullptr) {
if(it != null) {
it->link();
}
}
@ -82,7 +82,7 @@ void audio::blockEngine::flow::Interface::flowLinkInput() {
void audio::blockEngine::flow::Interface::flowCheckAllCompatibility() {
ABE_INFO(" Block Check the flows Capabilities (" << m_list.size() << " flows)");
for (auto &it : m_list) {
if(it != nullptr) {
if(it != null) {
it->checkCompatibility();
}
}
@ -95,7 +95,7 @@ void audio::blockEngine::flow::Interface::flowAllocateOutput() {
void audio::blockEngine::flow::Interface::flowGetInput() {
ABE_WARNING(" Block Get input data pointers");
for (auto &it : m_list) {
if(it != nullptr) {
if(it != null) {
it->getInputBuffer();
}
}
@ -105,7 +105,7 @@ void audio::blockEngine::flow::Interface::flowGetInput() {
ememory::SharedPtr<audio::blockEngine::flow::BaseReference> audio::blockEngine::flow::Interface::getFlowReference(const etk::String& _flowName) {
ememory::SharedPtr<audio::blockEngine::flow::BaseReference> out;
for (auto &it : m_list) {
if( it != nullptr
if( it != null
&& it->getName() == _flowName) {
out = it->getReference();
break;

View File

@ -75,7 +75,7 @@ namespace audio {
* @return The block requested if it exist.
*/
virtual ememory::SharedPtr<audio::blockEngine::Block> getBlockNamed(const etk::String& _name) {
return nullptr;
return null;
}
ememory::SharedPtr<audio::blockEngine::flow::BaseReference> getFlowReference(const etk::String& _name);
public:

View File

@ -49,7 +49,7 @@ void appl::Windows::init() {
composition += "</sizer>\n";
m_composer = ewol::widget::Composer::create();
if (m_composer == nullptr) {
if (m_composer == null) {
APPL_CRITICAL(" An error occured ... in the windows creatrion ...");
return;
}
@ -69,13 +69,13 @@ void appl::Windows::onCallbackPlay() {
#if 0
APPL_INFO("Play Requested ...");
m_process = audio::blockEngine::Processing::create();
if (m_process == nullptr) {
if (m_process == null) {
APPL_ERROR("can not create processing ...");
return;
}
APPL_INFO("Create Generator ...");
ememory::SharedPtr<audio::blockEngine::GeneratorFile> generator = audio::blockEngine::GeneratorFile::create();
if (generator == nullptr) {
if (generator == null) {
APPL_ERROR("can not create Generator ...");
return;
}
@ -84,7 +84,7 @@ void appl::Windows::onCallbackPlay() {
APPL_INFO("Create DECODER ...");
ememory::SharedPtr<audio::blockEngine::BlockDecoder> decoder = audio::blockEngine::BlockDecoder::create();
if (decoder == nullptr) {
if (decoder == null) {
APPL_ERROR("can not create Generator ...");
return;
}
@ -93,7 +93,7 @@ void appl::Windows::onCallbackPlay() {
APPL_INFO("Create Receiver ...");
ememory::SharedPtr<audio::blockEngine::ReceiverRtAudio> receiver = audio::blockEngine::ReceiverRtAudio::create();
if (receiver == nullptr) {
if (receiver == null) {
APPL_ERROR("can not create Receiver ...");
return;
}
@ -108,14 +108,14 @@ void appl::Windows::onCallbackPlay() {
#else
APPL_INFO("Play Requested ...");
m_process = audio::blockEngine::Processing::create();
if (m_process == nullptr) {
if (m_process == null) {
APPL_ERROR("can not create processing ...");
return;
}
m_process->propertyName.set("main Process");
APPL_INFO("Create Generator Sinus");
ememory::SharedPtr<audio::blockEngine::GeneratorSignal> generator = audio::blockEngine::GeneratorSignal::create();
if (generator == nullptr) {
if (generator == null) {
APPL_ERROR("can not create Generator ...");
return;
}
@ -124,7 +124,7 @@ void appl::Windows::onCallbackPlay() {
APPL_INFO("Create Receiver ...");
ememory::SharedPtr<audio::blockEngine::ReceiverRiver> receiver = audio::blockEngine::ReceiverRiver::create();
if (receiver == nullptr) {
if (receiver == null) {
APPL_ERROR("can not create Receiver ...");
return;
}
@ -139,7 +139,7 @@ void appl::Windows::onCallbackPlay() {
}
void appl::Windows::onCallbackStop() {
if (m_process != nullptr) {
if (m_process != null) {
m_process->stop();
}
}