| | |
| | | }
|
| | | }
|
| | |
|
| | | PipeLine::PipeLine() : global_params_map(), elem_create_func_map(), elems()
|
| | | PipeLine::elem_create_func_map_t PipeLine::global_elem_create_func_map;
|
| | |
|
| | | PipeLine::PipeLine() : params_map(), elem_create_func_map(), elems()
|
| | | {
|
| | | }
|
| | |
|
| | |
| | | for(elem_vec_t::iterator iter = elems.begin(); iter != elems.end(); ++iter)
|
| | | {
|
| | | PipeLineElem* elem = *iter;
|
| | | if (elem != nullptr)
|
| | | if (elem != nullptr && elem->manager == this)
|
| | | {
|
| | | elem->finit();
|
| | | delete *iter;
|
| | |
| | | return true;
|
| | | }
|
| | |
|
| | |
|
| | | //static
|
| | | bool PipeLine::register_global_elem_creator(const std::string& type, elem_create_func_t func)
|
| | | {
|
| | | if (type.empty() || func == nullptr)
|
| | | return false;
|
| | |
|
| | | elem_create_func_map_t::iterator iter = global_elem_create_func_map.find(type);
|
| | | if (iter != global_elem_create_func_map.end())
|
| | | return false;
|
| | | |
| | | global_elem_create_func_map.insert(std::make_pair(type, func));
|
| | | return true;
|
| | | }
|
| | |
|
| | | void PipeLine::push_elem(PipeLineElem* elem)
|
| | | {
|
| | | if(elem != nullptr)
|
| | |
| | | }
|
| | | }
|
| | |
|
| | | void PipeLine::push_front_elem(PipeLineElem* elem)
|
| | | {
|
| | | if(elem != nullptr)
|
| | | {
|
| | | elem->manager = this;
|
| | | elems.insert(elems.begin(), elem);
|
| | | }
|
| | | }
|
| | |
|
| | | bool PipeLine::remove_elem(PipeLineElem* elem)
|
| | | {
|
| | | if(elem != nullptr)
|
| | | {
|
| | | for(elem_vec_t::iterator iter = elems.begin(); iter != elems.end(); ++iter)
|
| | | {
|
| | | if (*iter == elem)
|
| | | {
|
| | | iter = elems.erase(iter);
|
| | | return true;
|
| | | }
|
| | | }
|
| | | }
|
| | | |
| | | return false;
|
| | | }
|
| | |
|
| | | bool PipeLine::check_pipe_complete(PipeLineElem* lastRetElem) const
|
| | | {
|
| | | return lastRetElem == *elems.rbegin();
|
| | | }
|
| | |
|
| | | PipeLineElem* PipeLine::push_elem(const std::string& type)
|
| | | {
|
| | | elem_create_func_map_t::iterator iter = elem_create_func_map.find(type);
|
| | | if (iter == elem_create_func_map.end())
|
| | | return nullptr;
|
| | | {
|
| | | iter = global_elem_create_func_map.find(type);
|
| | | if (iter == global_elem_create_func_map.end())
|
| | | return nullptr;
|
| | | }
|
| | |
|
| | | elem_create_func_t func = iter->second;
|
| | | if (func == nullptr)
|
| | |
| | | PipeDebugger(PipeLine* _pipeLine) :
|
| | | pipeLine(_pipeLine), retElem(nullptr), pm(nullptr)
|
| | | {
|
| | | LOG(DEBUG) << "pipe line begin";
|
| | | //LOG_DEBUG << "pipe line begin" << std::endl;
|
| | | }
|
| | |
|
| | | ~PipeDebugger()
|
| | | {
|
| | | bool retOK = (*(pipeLine->elems).rbegin() == retElem);
|
| | | if (retOK)
|
| | | LOG(DEBUG) << "pipe line end, ret OK";
|
| | | else
|
| | | LOG(WARN) << "pipe line end, ret ERROR";
|
| | | //bool retOK = (*(pipeLine->elems).rbegin() == retElem);
|
| | | //if (retOK)
|
| | | // LOG_DEBUG << "pipe line end, ret OK" << std::endl;
|
| | | //else
|
| | | // LOG_WARN << "pipe line end, ret ERROR" << std::endl;
|
| | | }
|
| | | };
|
| | |
|
| | |
| | | return nullptr;
|
| | | }
|
| | |
|
| | | void PipeLine::set_global_param(const std::string& name, const std::string& value)
|
| | | void PipeLine::set_param(const std::string& name, const std::string& value)
|
| | | {
|
| | | if (name.empty())
|
| | | return;
|
| | |
|
| | | global_params_map_t::iterator iter = global_params_map.find(name);
|
| | | if (iter == global_params_map.end())
|
| | | global_params_map.insert(std::make_pair(name, value));
|
| | | params_map_t::iterator iter = params_map.find(name);
|
| | | if (iter == params_map.end())
|
| | | params_map.insert(std::make_pair(name, value));
|
| | | else
|
| | | iter->second = value;
|
| | | }
|
| | |
|
| | | std::string PipeLine::get_global_param(const std::string& name) const
|
| | | std::string PipeLine::get_param(const std::string& name) const
|
| | | {
|
| | | global_params_map_t::const_iterator iter = global_params_map.find(name);
|
| | | if (iter == global_params_map.end())
|
| | | params_map_t::const_iterator iter = params_map.find(name);
|
| | | if (iter == params_map.end())
|
| | | return "";
|
| | | else
|
| | | return iter->second;
|