MCPcopy Create free account
hub / github.com/apache/brpc / AddObserver

Method AddObserver

src/butil/observer_list.h:119–126  ·  view source on GitHub ↗

Add an observer to the list. An observer should not be added to the same list more than once.

Source from the content-addressed store, hash-verified

117 // Add an observer to the list. An observer should not be added to
118 // the same list more than once.
119 void AddObserver(ObserverType* obs) {
120 if (std::find(observers_.begin(), observers_.end(), obs)
121 != observers_.end()) {
122 NOTREACHED() << "Observers can only be added once!";
123 return;
124 }
125 observers_.push_back(obs);
126 }
127
128 // Remove an observer from the list if it is in the list.
129 void RemoveObserver(ObserverType* obs) {

Callers 4

ObserveMethod · 0.80
TESTFunction · 0.80
ObserveMethod · 0.80
AddMethod · 0.80

Calls 4

findFunction · 0.50
beginMethod · 0.45
endMethod · 0.45
push_backMethod · 0.45

Tested by 3

ObserveMethod · 0.64
TESTFunction · 0.64
ObserveMethod · 0.64