1 #include "filterhome_impl.h"
2 #include "produktfilter_impl.h"
3
4 using namespace Auktion;
5
6 FilterHome_impl::FilterHome_impl(void)
7 : CCM_FilterHome(), table_(STD_MAP())
8 {}
9
10 FilterHome_impl::~FilterHome_impl(void) {}
11
12 ::Components::EnterpriseComponent_ptr FilterHome_impl::create() {
13 // this method was the result of MICO's CCM-mapping;
14 // we recommend that this method should not be used!
15 throw new CORBA::SystemException();
16 return NULL;
17 }
18
19 ::Components::EnterpriseComponent_ptr FilterHome_impl::new_filter(const char* gegenstand) {
20 assert(gegenstand);
21 // convert to std::string
22 const std::string name(CORBA::string_dup(gegenstand));
23
24 // look up in dictionary
25 STD_MAP::const_iterator iter = table_.find(name);
26
27 ::Components::EnterpriseComponent_var filter;
28 if(iter == table_.end()) {
29 // filter doesn't exists, therefore create new one
30 filter = new ProduktFilter_impl(name.c_str());
31 // ...and add him to table
32 table_[name] = ::Components::EnterpriseComponent::_duplicate(filter);
33 } else {
34 // read reference from the dictionary
35 filter = (*iter).second;
36 }
37
38 return ::Components::EnterpriseComponent::_duplicate(filter);
39 }
40
41 extern "C" {
42 Components::HomeExecutorBase_ptr create_Auktion_FilterHome() {
43 return new FilterHome_impl();
44 }
45
46 // only dummy implementations
47 Components::HomeExecutorBase_ptr create_Auktion_VerkaeuferHome() {
48 return NULL;
49 }
50 Components::HomeExecutorBase_ptr create_Auktion_BieterHome() {
51 return NULL;
52 }
53 Components::HomeExecutorBase_ptr create_Auktion_Welt() {
54 return NULL;
55 }
56 }
57
58