472,950 Members | 2,621 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,950 software developers and data experts.

How to represent a chunk of Constant Data

In my application I have a Connection class which has, amongst others,
attributes which represent a host id and port number. These must be unique
for each Connection. I want these attributes to be initialised to values
given by the constructor's parameters. I know in advance how many Connection
classes I need and what the values of these attributes will be. The
Connection class instances are created at various points during the
intialisation phase of the application. I want to hold, in one place, all
the possible values of host id and port number that the application can use.
This way, whenever the need for another Connection instance arises, a new
value can just be added to the list. I was thinking of a ConnectionDetails
class could do this but I'm not sure how best to implement it. It may be
that it will just contain constant data or enums. I don't want to have a
header file full of #defines that I include all over the place. Can anyone
help?
Jul 19 '05 #1
1 1695
AdamJoe1 wrote:
In my application I have a Connection class which has, amongst others,
attributes which represent a host id and port number. These must be unique
for each Connection. I want these attributes to be initialised to values
given by the constructor's parameters. I know in advance how many Connection
classes I need and what the values of these attributes will be. The
Connection class instances are created at various points during the
intialisation phase of the application. I want to hold, in one place, all
the possible values of host id and port number that the application can use.
This way, whenever the need for another Connection instance arises, a new
value can just be added to the list. I was thinking of a ConnectionDetails
class could do this but I'm not sure how best to implement it. It may be
that it will just contain constant data or enums. I don't want to have a
header file full of #defines that I include all over the place. Can anyone
help?


Perhaps you want to hold unused Connection instances in a freelist. This
way, you can create the Connections (all at once?) in one place, and you
don't have to worry about spreading the various Connection attribute
details around your code. You just ask for the next available Connection.

/david

--
"As a scientist, Throckmorton knew that if he were ever to break wind in
the echo chamber, he would never hear the end of it."

Jul 19 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

7
by: bartek | last post by:
Hello, I've been pondering with this for quite some time now, and finally decided to ask here for suggestions. I'm kind of confused, actually... Maybe I'm thinking too much... Brain dump...
8
by: Darsant | last post by:
I'm currently reading 1-n number of binary files, each with 3 different arrays of floats containing about 10,000 values a piece for a total of about 30,000 values per file. I'm looking for a way...
3
by: Eric Anderson Vianet SAO | last post by:
hello all When i tried ´pg_dump -v -f dump.dmp dtbtransporte´ I got the error: pg_dump: restoring data for table tbdmovimento pg_dump: dumping out the contents of table tbdmovimento ...
22
by: Fred Ma | last post by:
I'm using the expression "int a = ceil( SomeDouble )". The man page says that ceil returns the smallest integer that is not less than SomeDouble, represented as a double. However, my...
29
by: fdmfdmfdm | last post by:
let's say without checking including files, how do we to represent the biggest say int in a system? I ran across a book give this code: long int biggest = 0x7FFFFFFF; Does that mean the...
5
by: wshaer | last post by:
Hi This is the task: and these are my classes: public class Engine{ // Declare the varibles
33
by: desktop | last post by:
In the C++ standard sec 23.1.2 table 69 it says that erase(q) where q is a pointer to an element can be done in amortized constant time. I guess that is not worst case since std::set is...
3
by: Willy Stevens | last post by:
Hello, In my application I have to read sometimes quite big chunk of binary data. I have a buffer which default size is 32000 bytes. But how could I read binary data that exceeds 32000 bytes?...
7
by: Hendrik Schober | last post by:
Hi, this #include <string> class test { typedef std::string::size_type size_type; static const size_type x = std::string::npos; }; doesn't compile using either VC9 ("expected constant...
2
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Sept 2023 starting at 18:00 UK time (6PM UTC+1) and finishing at about 19:15 (7.15PM) The start time is equivalent to 19:00 (7PM) in Central...
0
by: lllomh | last post by:
Define the method first this.state = { buttonBackgroundColor: 'green', isBlinking: false, // A new status is added to identify whether the button is blinking or not } autoStart=()=>{
2
by: DJRhino | last post by:
Was curious if anyone else was having this same issue or not.... I was just Up/Down graded to windows 11 and now my access combo boxes are not acting right. With win 10 I could start typing...
2
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 4 Oct 2023 starting at 18:00 UK time (6PM UTC+1) and finishing at about 19:15 (7.15PM) The start time is equivalent to 19:00 (7PM) in Central...
0
tracyyun
by: tracyyun | last post by:
Hello everyone, I have a question and would like some advice on network connectivity. I have one computer connected to my router via WiFi, but I have two other computers that I want to be able to...
2
by: giovanniandrean | last post by:
The energy model is structured as follows and uses excel sheets to give input data: 1-Utility.py contains all the functions needed to calculate the variables and other minor things (mentions...
1
by: Teri B | last post by:
Hi, I have created a sub-form Roles. In my course form the user selects the roles assigned to the course. 0ne-to-many. One course many roles. Then I created a report based on the Course form and...
3
by: nia12 | last post by:
Hi there, I am very new to Access so apologies if any of this is obvious/not clear. I am creating a data collection tool for health care employees to complete. It consists of a number of...
0
NeoPa
by: NeoPa | last post by:
Introduction For this article I'll be focusing on the Report (clsReport) class. This simply handles making the calling Form invisible until all of the Reports opened by it have been closed, when it...

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.