473,761 Members | 8,011 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Classes & data members

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

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

The network elements are organised under a network topology
('NetworkTopolo gy' 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
3 1550
ectoplasm wrote:
I'd like to ask for advice on the following.

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

The network elements are organised under a network topology
('NetworkTopolo gy' 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

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

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

The network elements are organised under a network topology
('NetworkTopolo gy' 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
"ectoplasm" <e_*****@hotmai l.com> wrote in message
news:11******** **************@ f14g2000cwb.goo glegroups.com.. .
I'd like to ask for advice on the following.

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

The network elements are organised under a network topology
('NetworkTopolo gy' 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<Net workElement*> 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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

45
3618
by: Steven T. Hatton | last post by:
This is a purely *hypothetical* question. That means, it's /pretend/, CP. ;-) If you were forced at gunpoint to put all your code in classes, rather than in namespace scope (obviously classes themselves are an exception to this), and 'bootstrap' your program by instantiating a single application object in main(), would that place any limitations on what you could accomplish with your program? Are there any benefits to doing things that...
8
2615
by: Jef Driesen | last post by:
I'm implementing some image processing algorithms in C++. I created a class called 'image' (see declaration below), that will take care of the memory allocations and some basic (mathematical) stuff. The class will behave like a std::vector (copy constructor and assignment create a deep copy), but with 2D indexing. Now I also need a 'view' class that will behave like a reference to an 'image' (can only be constructed from an existing...
24
2569
by: Alf P. Steinbach | last post by:
The eighth chapter (chapter 2.1) of my attempted Correct C++ tutorial is now available, although for now only in Word format -- comments welcome! Use the free & system-independent Open Office if you don't have Word. Classes <url: http://home.no.net/dubjai/win32cpptut/w32cpptut_02_01.zip> Introduces the C++ language feature used to define new types, namely classes. The focus in on creating safe and reusable classes. As a main
18
3325
by: Frank Rizzo | last post by:
Hello, I have a class with all static methods that is called by multiple threads. I was wondering what effect that has on the competing threads. Does Thread2 have to wait until Thread1 is done with the StaticClass.Method1 before it can use it? What if I removed static methods and made all the threads instantiate its own copy of the class? Would that remove the waiting contention?
6
1582
by: David Lozzi | last post by:
Howdy, I'm new to classes. Below is my class User. (is this a reserved namespace or class?) It works great, kind of. If I specify the username and password, the correct firstname and lastname are returned. For example, username dlozzi, password fun. It returns David Lozzi as full name. If I login as someone else on another computer, say username dsmith and password fun2, the second computer displays the correct fullname. HOWEVER if I...
11
3843
by: Kevin Prichard | last post by:
Hi all, I've recently been following the object-oriented techiques discussed here and have been testing them for use in a web application. There is problem that I'd like to discuss with you experts. I would like to produce Javascript classes that can be "subclassed" with certain behaviors defined at subclass time. There are plenty of ways to do this through prototyping and other techniques, but these behaviors need to be static and...
86
4644
by: jopperdepopper | last post by:
Hi, finally giving php 5 a go, and going over the new approach to classes. Can someone clarify the public, private and protected to me? I quote the php manual: "The visibility of a property or method can be defined by prefixing the declaration with the keywords: public, protected or private. Public declared items can be accessed everywhere."
16
1856
by: chameleon | last post by:
I have 2 classes with exactly the same members (all static except dtor/ctor). Classes have different implementantion in only one static member function and first class has one more member function. How can I write this code with templates? First of all: Thought to write code with templates is correct? members of classes are static because refer to devices. There is no reason to be non-static.
6
4033
by: Miguel Guedes | last post by:
Hello, I recently read an interview with Bjarne Stroustrup in which he says that pure abstract classes should *not* contain any data. However, I have found that at times situations are when it would be useful to have /some/ data defined in such an abstract class for reasons of forming a common block of data existing in or used by all descendant classes (see example below.) In such a case where a common block of data *always* exists,...
0
10136
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9988
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
8813
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7358
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6640
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5266
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5405
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
3
3509
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2788
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.