By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
455,907 Members | 1,283 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 455,907 IT Pros & Developers. It's quick & easy.

Classes & data members

P: n/a
I'd like to ask for advice on the following.

I have a data structure of network elements ('NetworkElement' base
class & derived classes like Server, Area, Cell, etc.)

The network elements are organised under a network topology
('NetworkTopology' class).

The problem is that the properties (data members) of network elements
depend on things such as: 1) technology of the network topology, 2)
vendor of the network element, 3) other factors.

Is there a way to, in some way, have classes with kind of 'dynamic'
data members which can be added / removed (in groups)?

Bye,
E.

Oct 27 '05 #1
Share this Question
Share on Google+
3 Replies


P: n/a
ectoplasm wrote:
I'd like to ask for advice on the following.

I have a data structure of network elements ('NetworkElement' base
class & derived classes like Server, Area, Cell, etc.)

The network elements are organised under a network topology
('NetworkTopology' class).

The problem is that the properties (data members) of network elements
depend on things such as: 1) technology of the network topology, 2)
vendor of the network element, 3) other factors.

Is there a way to, in some way, have classes with kind of 'dynamic'
data members which can be added / removed (in groups)?

Bye,
E.


No there isn't.

To help us solve your problem you need specify more information. For
instance do you need to add and remove these data members during the
lifetime of a single object.

Server s;
s.add_group(xyz);
s.remove_group(abc);

etc.

Or are you saying that each object has one particular set of data
members that will last for the lifetime of that object, but that each
object may have a different set of data members?

john
Oct 27 '05 #2

P: n/a

ectoplasm wrote:
I'd like to ask for advice on the following.

I have a data structure of network elements ('NetworkElement' base
class & derived classes like Server, Area, Cell, etc.)

The network elements are organised under a network topology
('NetworkTopology' class).

The problem is that the properties (data members) of network elements
depend on things such as: 1) technology of the network topology, 2)
vendor of the network element, 3) other factors.

Is there a way to, in some way, have classes with kind of 'dynamic'
data members which can be added / removed (in groups)?

Bye,
E.


You might be interested in "virtual data" that can be simulated in C++.
See the FAQ:

http://www.parashift.com/c++-faq-lit....html#faq-31.2

Cheers! --M

Oct 27 '05 #3

P: n/a
"ectoplasm" <e_*****@hotmail.com> wrote in message
news:11**********************@f14g2000cwb.googlegr oups.com...
I'd like to ask for advice on the following.

I have a data structure of network elements ('NetworkElement' base
class & derived classes like Server, Area, Cell, etc.)

The network elements are organised under a network topology
('NetworkTopology' class).

The problem is that the properties (data members) of network elements
depend on things such as: 1) technology of the network topology, 2)
vendor of the network element, 3) other factors.

Is there a way to, in some way, have classes with kind of 'dynamic'
data members which can be added / removed (in groups)?

Bye,
E.


Why not simply make the network elements polymorphic data contained in the
NetworkTopology perhaps in a vector?

std::vector<NetworkElement*> NetElements;

then you can push whatever types you want into it depending on the type of
network (perhaps in the constructor via pass in parm stating the network
type).
Oct 30 '05 #4

This discussion thread is closed

Replies have been disabled for this discussion.