Jump to content
  • Advertisement
Sign in to follow this  
kelaklub

Global data

This topic is 4350 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I want to create a collection of global data(such as tolerance values) for a geometric class library I am trying to code. What would be the best way to represent this data? Would the STL map provide a good way to access or write to this data? I don't want the data to be bound to any object of my class but would like a quick way to access it or change it. Any advice would be appreciated. Thanks.

Share this post


Link to post
Share on other sites
Advertisement
You need to describe more about the intended usage (access/insertion/deletion) patterns for the data.

Share this post


Link to post
Share on other sites
I would like the data to be accessible to any objects within the library. I guess kinda like state variables that are accessible to objects created for the library, and whose values can be modified but never deleted. One idea came to mind, hear this out...

- Create a class to store all this data.

- Create an object of this class at the global scope to access this data.

- Enforce that no other objects for this class are created by creating a static variable to serve as a counter to make sure that only that one global object can access the data stored in this class.

This is just an idea. So please feel free to shoot it down with constructive criticism. Thanks.

[Edited by - kelaklub on August 20, 2006 10:01:49 AM]

Share this post


Link to post
Share on other sites
Actually this article has some good ideas under the heading "Const and Data-Hiding". I might check this out too.

http://www.possibility.com/Cpp/const.html

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!