Classes & data members

E

ectoplasm

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.
 
J

John Harrison

ectoplasm said:
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
 
M

mlimber

ectoplasm said:
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-lite/value-vs-ref-semantics.html#faq-31.2

Cheers! --M
 
J

Jim Langston

ectoplasm said:
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).
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,744
Messages
2,569,483
Members
44,901
Latest member
Noble71S45

Latest Threads

Top