Difference: HowToManageclassIndex (r2 vs. r1)

Question

Hi there!

There is a class variable as 'classIndex' for every class derived from 'ProcessingClass', and it is initialized with a const value. I believe we can identify every class instances for the class by this strategy.

When I add new 'ProcessingClass', how can I select the 'classIndex' to ensure it is the only one and won't be confict with others?

Regards,

Wei Yan

-- YanWei - 06 Mar 2010

Answer

ALERT! If you answer a question - or have a question you asked answered by someone - please remember to edit the page and set the status to answered. The status is in a drop-down list below the edit box.

No such template def TMPL:DEF{PROMPT:supportquery} Hi Yan!

As you correctly guessed, the 'classIndex' variable identifies every class instances. I keep a record of those indexes, and if you add a new 'ProcessingClass' please get in touch with me.

However, I must confess that currently I think that the 'classIndex' approach is a BAD IDEA (and it was my idea, by the way smile ).

As I learned more about C++, I realized that the implementation of 'classIndex' using a static class variable may severely impair attempts to use these classes in a parallel computing environment, because it is not scalable.

Additionally, after using the 'ProcessingClasses' for a long time I've found yet no case where the use of 'classIndex' is providing me any advantage.

In summary, one of the issues I'll address in the near future is to eliminate the 'classIndex' feature from all 'ProcessingClasses' (I'll keep the 'getClassName()' feature, because it does no harm).

If you have any comments in this regard, I'll be glad to hear them.

Cheers,

Dago

-- DagobertoSalazar - 01 Mar 2011 No such template def TMPL:DEF{PROMPT:supportquery}

View topic | View difference side by side | History: r3 < r2 < r1 | More topic actions
 
This site is powered by FoswikiCopyright © by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding Foswiki? Send feedback