1 #include "produktfilter_impl.h"
2
3 using namespace Auktion;
4
5 // necessary for implementation, but we don't know why MICO declares
6 // the base class with its namespace in an implementation file
7 class Gebot_impl: virtual public OBV_Auktion::Gebot,
8 virtual public CORBA::DefaultValueRefCountBase
9 {
10 public:
11 Gebot_impl(void) {};
12 };
13
14 class GebotFactory: virtual public CORBA::ValueFactoryBase
15 {
16 public:
17 CORBA::ValueBase* create_for_unmarshal() {
18 return new Gebot_impl();
19 };
20 };
21
22
23
24 ProduktFilter_impl::ProduktFilter_impl(const char* name)
25 : ProduktFilter_Session(), name_(name), context_(NULL)
26 {}
27
28 ProduktFilter_impl::~ProduktFilter_impl(void) {}
29
30 char* ProduktFilter_impl::interessanter_gegenstand() {
31 return CORBA::string_dup(name_.c_str());
32 }
33
34 void ProduktFilter_impl::interessanter_gegenstand(const char* value) {
35 assert(value);
36 name_ = CORBA::string_dup(value);
37 }
38
39 void ProduktFilter_impl::push_eingehende_gebote(Gebot* conxn) {
40 assert(conxn);
41 // convert to std::string
42 const std::string subject(conxn->gegenstand()->name());
43
44 // check if this filter is responsible
45 if(subject == name_) {
46 // notify all registered consumers
47 context_->push_interessante_gebote(conxn);
48 }
49 }
50
51 void ProduktFilter_impl::set_session_context(Components::SessionContext_ptr ctx) {
52 // save container context
53 context_ = CCM_ProduktFilter_Context::_narrow(ctx);
54 assert(!CORBA::is_nil(context_));
55 }
56