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 public:
10 Gebot_impl(void) {};
11 };
12
13 class GebotFactory: virtual public CORBA::ValueFactoryBase
{
14 public:
15 CORBA::ValueBase* create_for_unmarshal() {
16 return new Gebot_impl();
17 };
18 };
19
20
21
22 ProduktFilter_impl::ProduktFilter_impl(const char* name)
23 : ProduktFilter_Session(), name_(name), context_(NULL)
24 {}
25
26 ProduktFilter_impl::~ProduktFilter_impl(void) {}
27
28 char* ProduktFilter_impl::interessanter_gegenstand() {
29 return CORBA::string_dup(name_.c_str());
30 }
31
32 void ProduktFilter_impl::interessanter_gegenstand(const char* value) {
33 assert(value);
34 name_ = CORBA::string_dup(value);
35 }
36
37 void ProduktFilter_impl::push_eingehende_gebote(Gebot* conxn) {
38 assert(conxn);
39 // convert to std::string
40 const std::string subject(conxn->gegenstand()->name());
41
42 // check if this filter is responsible
43 if(subject == name_) {
44 // notify all registered consumers
45 context_->push_interessante_gebote(conxn);
46 }
47 }
48
49 void ProduktFilter_impl::set_session_context(Components::SessionContext_ptr ctx) {
50 // save container context
51 context_ = CCM_ProduktFilter_Context::_narrow(ctx);
52 assert(!CORBA::is_nil(context_));
53 }
54
55