5. Mac OS X Cocoa framework
주로 사용
key-value observing(KVO)
Key-value observing provides a mechanism that allows
objects to notified of changed to specific properties of
other objects. – apple
6. 익숙한 observer pattern
값이 변경됐는지 반복적 poll 대신 notify 설치
KVO는 object-C, Cocoa에 의존적
C++에 맞춰 만듬
Key-Value Dictionary(KVD)
12. void NotificationFunc(
void* newValue, void* userData)
{
// react to new value
}
myKVD.AddNotification(
NotificationFunc,
std::string(“myInteger”), 0);
user data
myKVD.RemoveNotification(
NotificationFunc,
std::string(“myInteger”));
13. std::map
Key hash Value
Value as std::string Notification std::list Lock
n1 n2 n3 …
notification phase 전에 set
재귀 change notification 방지
function ptr user data