2 * Copyright 2012 Samsung Electronics Co., Ltd
4 * Licensed under the Flora License, Version 1.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.tizenopensource.org/license
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
18 * @file download-manager-event.cpp
19 * @author Jungki Kwak (jungki.kwak@samsung.com)
20 * @brief download event class for event flow
22 #include "download-manager-event.h"
23 #include "download-manager-common.h"
27 void Subject::attach(Observer *o)
29 _observers.push_back(o);
32 void Subject::detach(Observer *o)
34 vector<Observer*>::iterator it;
35 for(it = _observers.begin() ; it < _observers.end() ; it++) {
43 void Subject::notify(void)
45 vector<Observer*>::iterator it;
46 Observer *curObserver;
47 it = _observers.begin();
48 while (it < _observers.end()) {
51 DP_LOGD("[%s] Call Update",curObserver->name().c_str());
54 if (curObserver != *it)
61 void Observer::update(Subject *s)
66 //Observer::Observer(updateFunction uf, void *data)
68 Observer::Observer(updateFunction uf, void *data, const char *name)
69 : m_updateFunction(uf)
75 void Observer::set(updateFunction uf, void *data)
77 m_updateFunction = uf;
81 void Observer::clear(void)
87 void Observer::call(void)
90 m_updateFunction(m_userData);