highlighter application  1.1
HCE project utils : highlighter
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros
ComponentManagerPoolSimple.cpp
Go to the documentation of this file.
4 
5 namespace HCE
6 {
7  using namespace HCE::exception;
8  namespace component
9  {
10 // cppcheck-suppress unusedFunction
11  void ComponentManagerPoolSimple::createAndAddComponent(Poco::SharedPtr<ComponentBase> component)
12  {
13  ComponentIterator it = componentsMap.find(component->getType());
14  if(it == componentsMap.end())
15  {
16  componentsMap[component->getType()] = component;
17  }
18  else
19  {
20  // Exception - component exist
21  }
22  }
23 
24  Poco::SharedPtr<TaskWaitObject> ComponentManagerPoolSimple::addInData(Poco::SharedPtr<DataBase> inData)
25  {
26  Poco::SharedPtr<TaskWaitObject> ret = Poco::SharedPtr<TaskWaitObject>(new TaskWaitObject(inData));
27  ComponentIterator it = componentsMap.find(inData->getType());
28  if(it != componentsMap.end())
29  {
30  try
31  {
32  ret->setOutData(((*it).second)->process(ret->getInData()), HCECTE_DEFAULT, NULL);
33  }
34  catch(ComponentExceptionBase &exp)
35  {
36  ret->setOutData(NULL, HCECTE_COMPONENT_EXP, Poco::SharedPtr<ComponentExceptionBase>(new ComponentExceptionBase(exp)));
37  }
38  catch(ExceptionBase &exp)
39  {
40  ret->setOutData(NULL, HCECTE_EXP_BASE, NULL);
41  }
42  }
43  else
44  {
45  ret->setOutData(NULL, HCECTE_EXP1, NULL);
46  // Exception - component exist
47  }
48  return ret;
49  }
50 
52  {
53  throw OperationNotFoundException("OperationNotFound");
54  }
55  }
56 }