Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > C++ > Classes & data members

Reply
Thread Tools

Classes & data members

 
 
ectoplasm
Guest
Posts: n/a
 
      10-27-2005
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.

 
Reply With Quote
 
 
 
 
John Harrison
Guest
Posts: n/a
 
      10-27-2005
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
 
Reply With Quote
 
 
 
 
mlimber
Guest
Posts: n/a
 
      10-27-2005

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

 
Reply With Quote
 
Jim Langston
Guest
Posts: n/a
 
      10-30-2005
"ectoplasm" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed) 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).


 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Why can nsmc, local classes or anonymous classes have static members? Rit Java 23 01-03-2010 05:54 PM
Classes - Adding members to members Daz C++ 5 05-07-2006 09:25 AM
Difference between static final members and final static members(if any)? JFCM Java 4 02-07-2006 11:32 AM
Templates: Members Vs. non-members Dave C++ 3 08-10-2004 11:23 AM
Can nested class members access private members of nesting class? CoolPint C++ 8 12-14-2003 02:30 PM



Advertisments