Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon. Entire thread

Plugin system

Name: Anonymous 2005-07-31 22:10

How would you write a plugin system for an image-processing application where one plugin is "dependant" on another plugin? For example I have an histogram plugin who has to call the grayscale plugin before showing the histogram. I could hard-code the grayscale function but it's ugly and I would have to do the same for a lot of other plugins.

I'm writing this in Qt (Trolltech) and C++, and I use the QLibrary object (not that it really matters...)

Name: Anonymous 2005-08-04 7:35

>>17

Still wrong.  It's breadth first:

Sample Run of >>8.  Note that A contains the list of loaded plugins in-order.

L:  W, X
M:  Y
N:  Z
W:  U, V
X:  T
Y:
Z:
U:
V:
T:

B contains [L M N]
A contains [ ]

Pop L
L !in A
Load L
A += L
B += W
B += X

B contains [M N W X]
A contains [L]

Pop M
M !in A
Load M
A += M
B += Y

B contains [N W X Y]
A contains [L M]

Pop N
N !in A
Load N
A += N
B += Z

B contains [W X Y Z]
A contains [L M N]

Pop W
W !in A
Load W
A += W
B += U
B += V

B contains [X Y Z U V]
A contains [L M N W]

Pop X
X !in A
Load X
A += X
B += T

B contains [Y Z U V T]
A contains [L M N W X]

And that's enough to show that we're talking about a typical breadth-first algorithm.  A depth-first algorithm would have a load order going all the way down the first tree first.  (And in fact, the proposed solution in >>10 / >>12 would have the loads occurring as the recursion unwinds.  A classic LRV algorithm, if you will.)  Here we see that the algorithm in >>8 walks the span of the tree prior to its descent to the next level.  Pretty much the definition of breadth-first.


Newer Posts
Don't change these.
Name: Email:
Entire Thread Thread List