solve the problem with re-binding and advice::Request
This commit is contained in:
parent
666d57f6ef
commit
7895ce5f49
9 changed files with 60 additions and 30 deletions
Binary file not shown.
|
Before Width: | Height: | Size: 12 KiB After Width: | Height: | Size: 13 KiB |
|
|
@ -147,7 +147,7 @@ Documentation</title>
|
|||
<table><tr><td><div class="element">Artifact <b>Lumiera</b></div></td></tr></table>
|
||||
<p>the main executable to be built<br /></p>
|
||||
<p>Depends on <a href="index.html#refpackage129413"><b>common</b></a></p><p>Depends on <a href="index.html#refpackage129797"><b>gui</b></a></p><p>Depends on <a href="index.html#refpackage129669"><b>proc</b></a></p><p>Depends on <a href="index.html#refpackage129541"><b>backend</b></a></p><p>Stereotype: executable</p>
|
||||
<p><i>executable</i> associated with : <a href="index.html#refartifact129029"><b>placement</b></a>, <a href="index.html#refartifact128517"><b>sessionimpl</b></a>, <a href="index.html#refartifact130437"><b>builderfacade</b></a>, <a href="index.html#refartifact133893"><b>aframe</b></a>, <a href="index.html#refartifact130821"><b>assembler</b></a>, <a href="index.html#refartifact132485"><b>trafo</b></a>, <a href="index.html#refartifact130053"><b>allocation</b></a>, <a href="index.html#refartifact134021"><b>vframe</b></a>, <a href="index.html#refartifact130565"><b>toolfactory</b></a>, <a href="index.html#refartifact132741"><b>hub</b></a>, <a href="index.html#refartifact131077"><b>buildable</b></a>, <a href="index.html#refartifact129285"><b>abstractmo</b></a>, <a href="index.html#refartifact132229"><b>exitnode</b></a>, <a href="index.html#refartifact131717"><b>pathmanager</b></a>, <a href="index.html#refartifact128901"><b>track</b></a>, <a href="index.html#refartifact129669"><b>meta</b></a>, <a href="index.html#refartifact129797"><b>fixedlocation</b></a>, <a href="index.html#refartifact129925"><b>relativelocation</b></a>, <a href="index.html#refartifact131589"><b>controllerfacade</b></a>, <a href="index.html#refartifact132101"><b>rendergraph</b></a>, <a href="index.html#refartifact133125"><b>pluginadapter</b></a>, <a href="index.html#refartifact129157"><b>explicitplacement</b></a>, <a href="index.html#refartifact130309"><b>auto</b></a>, <a href="index.html#refartifact133637"><b>glrender</b></a>, <a href="index.html#refartifact133381"><b>arender</b></a>, <a href="index.html#refartifact131845"><b>renderstate</b></a>, <a href="index.html#refartifact130181"><b>label</b></a>, <a href="index.html#refartifact131461"><b>nodecreatertool</b></a>, <a href="index.html#refartifact132869"><b>projector</b></a>, <a href="index.html#refartifact134661"><b>interpolator</b></a>, <a href="index.html#refartifact134533"><b>paramprovider</b></a>, <a href="index.html#refartifact132997"><b>mask</b></a>, <a href="index.html#refartifact128261"><b>mobject</b></a>, <a href="index.html#refartifact134277"><b>source</b></a>, <a href="index.html#refartifact133765"><b>frame</b></a>, <a href="index.html#refartifact129541"><b>effect</b></a>, <a href="index.html#refartifact131205"><b>buildertool</b></a>, <a href="index.html#refartifact131333"><b>segmentationtool</b></a>, <a href="index.html#refartifact132613"><b>link</b></a>, <a href="index.html#refartifact134405"><b>parameter</b></a>, <a href="index.html#refartifact131973"><b>renderengine</b></a>, <a href="index.html#refartifact134149"><b>glbuf</b></a>, <a href="index.html#refartifact132357"><b>procnode</b></a>, <a href="index.html#refartifact130949"><b>stateproxy</b></a>, <a href="index.html#refartifact128645"><b>edl</b></a>, <a href="index.html#refartifact128773"><b>fixture</b></a>, <a href="index.html#refartifact133253"><b>glpipe</b></a>, <a href="index.html#refartifact128133"><b>main</b></a>, <a href="index.html#refartifact130693"><b>conmanager</b></a>, <a href="index.html#refartifact129413"><b>clip</b></a>, <a href="index.html#refartifact133509"><b>vrender</b></a></p>
|
||||
<p><i>executable</i> associated with : <a href="index.html#refartifact129157"><b>explicitplacement</b></a>, <a href="index.html#refartifact130309"><b>auto</b></a>, <a href="index.html#refartifact133637"><b>glrender</b></a>, <a href="index.html#refartifact133381"><b>arender</b></a>, <a href="index.html#refartifact131845"><b>renderstate</b></a>, <a href="index.html#refartifact130181"><b>label</b></a>, <a href="index.html#refartifact131461"><b>nodecreatertool</b></a>, <a href="index.html#refartifact132869"><b>projector</b></a>, <a href="index.html#refartifact134661"><b>interpolator</b></a>, <a href="index.html#refartifact134533"><b>paramprovider</b></a>, <a href="index.html#refartifact132997"><b>mask</b></a>, <a href="index.html#refartifact128261"><b>mobject</b></a>, <a href="index.html#refartifact134277"><b>source</b></a>, <a href="index.html#refartifact133765"><b>frame</b></a>, <a href="index.html#refartifact129541"><b>effect</b></a>, <a href="index.html#refartifact131205"><b>buildertool</b></a>, <a href="index.html#refartifact131333"><b>segmentationtool</b></a>, <a href="index.html#refartifact132613"><b>link</b></a>, <a href="index.html#refartifact134405"><b>parameter</b></a>, <a href="index.html#refartifact131973"><b>renderengine</b></a>, <a href="index.html#refartifact134149"><b>glbuf</b></a>, <a href="index.html#refartifact132357"><b>procnode</b></a>, <a href="index.html#refartifact130949"><b>stateproxy</b></a>, <a href="index.html#refartifact128645"><b>edl</b></a>, <a href="index.html#refartifact128773"><b>fixture</b></a>, <a href="index.html#refartifact133253"><b>glpipe</b></a>, <a href="index.html#refartifact128133"><b>main</b></a>, <a href="index.html#refartifact130693"><b>conmanager</b></a>, <a href="index.html#refartifact129413"><b>clip</b></a>, <a href="index.html#refartifact133509"><b>vrender</b></a>, <a href="index.html#refartifact129029"><b>placement</b></a>, <a href="index.html#refartifact128517"><b>sessionimpl</b></a>, <a href="index.html#refartifact130437"><b>builderfacade</b></a>, <a href="index.html#refartifact133893"><b>aframe</b></a>, <a href="index.html#refartifact130821"><b>assembler</b></a>, <a href="index.html#refartifact132485"><b>trafo</b></a>, <a href="index.html#refartifact130053"><b>allocation</b></a>, <a href="index.html#refartifact134021"><b>vframe</b></a>, <a href="index.html#refartifact130565"><b>toolfactory</b></a>, <a href="index.html#refartifact132741"><b>hub</b></a>, <a href="index.html#refartifact131077"><b>buildable</b></a>, <a href="index.html#refartifact129285"><b>abstractmo</b></a>, <a href="index.html#refartifact132229"><b>exitnode</b></a>, <a href="index.html#refartifact131717"><b>pathmanager</b></a>, <a href="index.html#refartifact128901"><b>track</b></a>, <a href="index.html#refartifact129669"><b>meta</b></a>, <a href="index.html#refartifact129797"><b>fixedlocation</b></a>, <a href="index.html#refartifact129925"><b>relativelocation</b></a>, <a href="index.html#refartifact131589"><b>controllerfacade</b></a>, <a href="index.html#refartifact132101"><b>rendergraph</b></a>, <a href="index.html#refartifact133125"><b>pluginadapter</b></a></p>
|
||||
<a name="refartifact128133"></a>
|
||||
<table><tr><td><div class="element">Artifact <b>main</b></div></td></tr></table>
|
||||
<p>Stereotype: source</p>
|
||||
|
|
|
|||
|
|
@ -171,7 +171,7 @@ namespace advice {
|
|||
protected:
|
||||
void publishProvision (PointOfAdvice*);
|
||||
void discardSolutions ();
|
||||
void publishRequestBindingChange();
|
||||
void publishRequestBindingChange(HashVal);
|
||||
|
||||
void registerRequest();
|
||||
void deregisterRequest();
|
||||
|
|
@ -362,9 +362,9 @@ namespace advice {
|
|||
void
|
||||
defineBinding (Literal topic)
|
||||
{
|
||||
HashVal previous_bindingKey (hash_value(*this));
|
||||
setBindingPattern (Binding(topic).addTypeGuard<AD>());
|
||||
////////////////////////////////////////////////////////////////////////////TODO: conceptual mismatch here! we don't have an "old entry", because we ourselves are the entry ;-)
|
||||
publishRequestBindingChange();
|
||||
publishRequestBindingChange (previous_bindingKey);
|
||||
}
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -122,10 +122,9 @@ namespace advice {
|
|||
|
||||
|
||||
void
|
||||
AdviceLink::publishRequestBindingChange()
|
||||
AdviceLink::publishRequestBindingChange(HashVal previous_bindingKey)
|
||||
{
|
||||
////////////////////////////////////////////////////////////////////////////TODO: conceptual mismatch here! we don't have an "old entry", because we ourselves are the entry ;-)
|
||||
UNIMPLEMENTED ("propagate binding change to index");
|
||||
aSys().modifyRequest(previous_bindingKey, *this);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -136,6 +136,8 @@ namespace advice {
|
|||
* to the same memory location of a POA (point of advice).
|
||||
* Thus e.g. #hasProvision means this index holds an entry
|
||||
* pointing to exactly this given data entity.
|
||||
* @note the implementation of modifying a Request entry
|
||||
* explicitly relies on that definition of equality.
|
||||
* @note the diagnostic API is mainly intended for unit testing
|
||||
* and \em not implemented with focus on performance.
|
||||
*/
|
||||
|
|
@ -339,21 +341,26 @@ namespace advice {
|
|||
provisionEntries_[key].publish_latest_solution (entry);
|
||||
}
|
||||
|
||||
/** @note explicitly relying on the implementation of \c ==
|
||||
* which checks only the memory location of the Request.
|
||||
* Thus we can use the already modified Request to find
|
||||
* the old entry within the index pointing to this Request.
|
||||
* @param oKey the binding hash value prior to modification
|
||||
*/
|
||||
void
|
||||
modifyRequest (POA const& oldRef, POA& newEntry)
|
||||
modifyRequest (HashVal oKey, POA& entry)
|
||||
{
|
||||
HashVal oKey (hash_value(oldRef));
|
||||
HashVal nKey (hash_value(newEntry));
|
||||
HashVal nKey (hash_value(entry));
|
||||
if (oKey != nKey)
|
||||
{
|
||||
requestEntries_[oKey].remove (oldRef);
|
||||
requestEntries_[nKey].append (newEntry);
|
||||
requestEntries_[oKey].remove (entry);
|
||||
requestEntries_[nKey].append (entry);
|
||||
}
|
||||
else
|
||||
{
|
||||
requestEntries_[nKey].overwrite (oldRef, newEntry);
|
||||
{ // rewrite Entry to include the new binding
|
||||
requestEntries_[nKey].overwrite (entry, entry);
|
||||
}
|
||||
provisionEntries_[nKey].publish_latest_solution (newEntry);
|
||||
provisionEntries_[nKey].publish_latest_solution (entry);
|
||||
}
|
||||
|
||||
void
|
||||
|
|
|
|||
|
|
@ -61,6 +61,12 @@ namespace test {
|
|||
return pattern_.matches (Binding(refSpec));
|
||||
}
|
||||
|
||||
void
|
||||
changeBinding (Literal newSpec)
|
||||
{
|
||||
pattern_ = Binding(newSpec).buildMatcher();
|
||||
}
|
||||
|
||||
|
||||
/* == Adapter interface for use within the Index == */
|
||||
|
||||
|
|
@ -342,19 +348,22 @@ namespace test {
|
|||
CHECK (_hasDefault (3));
|
||||
CHECK (_hasDefault (5));
|
||||
|
||||
CHECK (!idx.hasRequest (_entry (2,"cat")));
|
||||
HashVal dogHash (hash_value (_entry (5,"dog")));
|
||||
|
||||
CHECK ( idx.hasRequest (_entry (5,"dog")));
|
||||
_entry (5,"dog").changeBinding("cat"); // transmogrify existing request into cat-request
|
||||
CHECK (_hasDefault (5)); // of course this didn't change the solution
|
||||
CHECK (!idx.hasRequest (_entry (5,"cat"))); // can't find it anymore because of changed binding
|
||||
|
||||
idx.modifyRequest (_entry (5,"dog"), _entry (2,"cat"));
|
||||
idx.modifyRequest (dogHash, _entry (5,"cat"));
|
||||
|
||||
CHECK ( idx.hasRequest (_entry (2,"cat")));
|
||||
CHECK (!idx.hasRequest (_entry (5,"dog")));
|
||||
CHECK ( idx.hasRequest (_entry (5,"cat")));
|
||||
CHECK (p_cnt == idx.provision_count());
|
||||
CHECK (r_cnt == idx.request_count());
|
||||
CHECK (_hasSolution (1,7));
|
||||
CHECK (_hasSolution (6,7));
|
||||
CHECK (_hasDefault (3));
|
||||
CHECK (_hasSolution (2,7)); // automatically got the current cat solution
|
||||
CHECK (_hasSolution (5,7)); // automatically got the current cat solution
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -365,7 +374,7 @@ namespace test {
|
|||
uint r_cnt = idx.request_count();
|
||||
uint p_cnt = idx.provision_count();
|
||||
CHECK (_hasSolution (1,7));
|
||||
CHECK (_hasSolution (2,7));
|
||||
CHECK (_hasSolution (5,7));
|
||||
CHECK (_hasSolution (6,7));
|
||||
CHECK (_hasDefault (3));
|
||||
|
||||
|
|
@ -378,7 +387,7 @@ namespace test {
|
|||
CHECK (p_cnt == idx.provision_count());
|
||||
CHECK (r_cnt == idx.request_count());
|
||||
CHECK (_hasDefault (1));
|
||||
CHECK (_hasDefault (2));
|
||||
CHECK (_hasDefault (5));
|
||||
CHECK (_hasDefault (6));
|
||||
CHECK (_hasSolution (3,8));
|
||||
|
||||
|
|
@ -388,7 +397,7 @@ namespace test {
|
|||
CHECK (idx.hasProvision (_entry (7,"cat")));
|
||||
CHECK (idx.hasProvision (_entry (9,"cat")));
|
||||
CHECK (_hasSolution (1,9)); // all cats got the second cat solution
|
||||
CHECK (_hasSolution (2,9));
|
||||
CHECK (_hasSolution (5,9));
|
||||
CHECK (_hasSolution (6,9));
|
||||
CHECK (_hasSolution (3,8)); // the dog is unaffected
|
||||
|
||||
|
|
@ -399,10 +408,10 @@ namespace test {
|
|||
|
||||
CHECK (!idx.hasProvision (_entry (7,"cat")));
|
||||
CHECK ( idx.hasProvision (_entry (4,"dog")));
|
||||
CHECK (_hasSolution (1,9)); // cats unaffected, because we're changing a shadowed cat solution
|
||||
CHECK (_hasSolution (2,9));
|
||||
CHECK (_hasSolution (1,9)); // cats unaffected, because we're changing a shadowed cat provision
|
||||
CHECK (_hasSolution (5,9));
|
||||
CHECK (_hasSolution (6,9));
|
||||
CHECK (_hasSolution (3,4)); // but the dog got switched to the transmogrified-into-dog solution,
|
||||
CHECK (_hasSolution (3,4)); // but the dog got switched to the replaced-by-dog solution,
|
||||
// because it was added later than the existing solution 8
|
||||
|
||||
// a switch within the same cluster ("cat")
|
||||
|
|
@ -411,7 +420,7 @@ namespace test {
|
|||
CHECK ( idx.hasProvision (_entry (7,"cat")));
|
||||
CHECK ( idx.hasProvision (_entry (4,"dog")));
|
||||
CHECK (_hasSolution (1,7)); // because cat-7 is newly added, it shadows the older cat-9
|
||||
CHECK (_hasSolution (2,7));
|
||||
CHECK (_hasSolution (5,7));
|
||||
CHECK (_hasSolution (6,7));
|
||||
CHECK (_hasSolution (3,4)); // but dog remains dog
|
||||
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
format 58
|
||||
"CommonLib" // CommonLib
|
||||
revision 18
|
||||
revision 19
|
||||
modified_by 5 "hiv"
|
||||
// class settings
|
||||
//class diagram settings
|
||||
|
|
@ -451,6 +451,15 @@ ${class}::${name} ${(}${)}${const}${volatile} ${throw}${staticnl}
|
|||
|
||||
|
||||
|
||||
end
|
||||
|
||||
classrelation 203141 // <dependency>
|
||||
relation 192261 -_->
|
||||
stereotype "create"
|
||||
a package
|
||||
cpp default "#include in source"
|
||||
classrelation_ref 203141 // <dependency>
|
||||
b parent class_ref 166021 // ActiveProvision
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
|||
|
|
@ -58,7 +58,7 @@ end
|
|||
relationcanvas 129669 relation_ref 188677 // <association>
|
||||
from ref 129157 z 1999 to ref 129285
|
||||
no_role_a no_role_b
|
||||
multiplicity_a_pos 275 240 3000 multiplicity_b_pos 237 240 3000
|
||||
multiplicity_a_pos 266 244 3000 multiplicity_b_pos 246 244 3000
|
||||
end
|
||||
relationcanvas 129925 relation_ref 188933 // <association>
|
||||
from ref 128645 z 1999 to ref 129285
|
||||
|
|
@ -117,5 +117,12 @@ relationcanvas 133125 relation_ref 191109 // <unidirectional association>
|
|||
no_role_a no_role_b
|
||||
no_multiplicity_a no_multiplicity_b
|
||||
end
|
||||
relationcanvas 133381 relation_ref 192261 // <dependency>
|
||||
decenter_end 98
|
||||
from ref 129157 z 1999 stereotype "<<create>>" xyz 109 149 3000 to point 163 194
|
||||
line 133765 z 1999 to ref 131461
|
||||
no_role_a no_role_b
|
||||
no_multiplicity_a no_multiplicity_b
|
||||
end
|
||||
preferred_whz 635 331 1
|
||||
end
|
||||
|
|
|
|||
|
|
@ -42,7 +42,6 @@ open
|
|||
class_ref 166021 // ActiveProvision
|
||||
class_ref 164741 // Binding
|
||||
class_ref 166277 // Index
|
||||
classinstance_ref 144517 //
|
||||
class_ref 145285 // MediaKind
|
||||
|
||||
package_ref 131077 // ConfigQuery
|
||||
|
|
|
|||
Loading…
Reference in a new issue