[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[ns] One comment about linkstate routing source code



Hi folks,

During the process of extending linkstate routing
protocol to accormodate WDM while keeping the
integrity of the original code, I found it's very
difficult to do so because the use of template class
as base class like the follows.

struct LsLinkState {
...
};
typedef LsList<LsLinkState> LsLinkStateList;
typedef LsMap<int, LsLinkStateList>
LsLinkStateListMap;
class LsTopoMap : public LsLinkStateListMap {
                         ^^^^^^^^^^^^^^^^^^
...
};

Here LsLinkStateListMap is a template class and also
LsTopMap's base class. To extend LS, first thing is to
derive a class from LsLinkState. Then I found myself
in a situation that I have to duplicate every class
related to LsLinkState because the use of template
class as base class. Like here, I have to duplicate
the above code as follows.
// This is okay.
struct LsLinkStateWDM: public LsLinkState {
...
};

// Starting from here, I need to make a counterpart
for
// everything.
typedef LsList<LsLinkStateWDM> LsLinkStateListWDM;
typedef LsMap<int, LsLinkStateListWDM>
LsLinkStateListMapWDM;
class LsTopoMapWDM : public LsLinkStateListMapWDM {
                            ^^^^^^^^^^^^^^^^^^
...
};

The problem is if LS doesn't have a template base
class, then I can simplely derive LsTopoMapWDM from
LsTopoMap and make some minor extensions. Here I have
to do everything :(

How do you guys think? Or is there a better way to
extend LS while keeping LS intact?

Thanks,
Sam


__________________________________________________
Do You Yahoo!?
Get personalized email addresses from Yahoo! Mail
http://personal.mail.yahoo.com/