You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

20 lines
464 B
C++

#pragma once
#include "Observer.h"
#include "GlobalDefine.h"
//观察者模式的主题基类接口
class CSubject
{
public:
CSubject(void);
virtual ~CSubject(void);
void Attach(CObserver*);//注册观察者
void Delete(CObserver*);//删除观察者
void NotifyObservers();//通知所有观察者
void DeleteAllObservers(){m_ObserverVec.clear();};//删除所有观察者
void SetObserversVal1(double val);
protected:
vector<CObserver*> m_ObserverVec;//观察者的容器
};