|
Boost Users : |
Subject: [Boost-users] Accumulators: Adding features at runtime
From: dhruva (dhruvakm_at_[hidden])
Date: 2009-01-17 00:04:12
Hello,
Accumulator features can be marked as droppable so that at runtime,
one could drop some calculations from being performed. Is there some
way to add features at runtime.
I need to do something like this in a generic method. The caller will
provide me the calculations they would want to perform in a bitwise
ORed format. Based on that, I need to create an accumulator_set object
in my constructor. The accumulator_set object will be a member of my
class.
A crude way I can think of is to add all features that I intend to
support and drop them based on user input. Is there a better way of
doing it, is this not an optimal way to do it? Looking forward for
your feedback.
// Some pseudo code to show my intentions
class calcstat {
public:
void SetCalc(int type) {
// I want to add features here based on user input
}
void compute(void) {
// If I cannot add based on user input, I will drop based on
// user input. I will then not be able to add if the user input
// changes. For now, I am not interested in its reuse!
}
private:
accumulator_set<double> m_acc;
};
-dhruva
-- Contents reflect my personal views only!
Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net