Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. Seeking for ideas on data handling...

Seeking for ideas on data handling...

Scheduled Pinned Locked Moved C / C++ / MFC
data-structuresquestionc++designtutorial
2 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • V Offline
    V Offline
    vmaltsev
    wrote on last edited by
    #1

    Hail everyone, I started a new project recently and now, in a design stage, I've got some points where I'd like to have as many opinions as possible. :) First of all, the data handling. Let's say I have tons of small object which are referenced by some other object and those are referenced by others. We can see it as a forest with trees and leaves on those trees. So, it's logical to make an array of leaves, trees and forests(cuz I will have more than one forest). But on leaves I might have insects and those insects will be created by other coders. So I need another array of some general insect objects on each leaf. Those insects can be very different, but they should have the only one in common, they should have a possibility to be on a very sectain leaf in my forest. Looks like pretty trivial, though I expressed it in a bizarre form. But there are some disputable points. As such, where to store insect objects, inside an array on the leaf or inside some other global array? Logicaly an insect object must be inside the leaf object (cuz an insect can't be on more than one leaf in a time, so it's not wise to use any kind of refereces), but in the same time we don't know what kind of insect we have, so we can make an array of a generalized insect object and use conversion, but what will happen to data of derived class then? Another question is how to make a copy of a tree, and make it fast, if we want to modify it without modifying an original instance of the forest? Or maybe this idea about arrays is wrong in general and there some better ways to do that? Sorry for such a long post. I will be happy with any kind of remarks and ideas. Small remark though. I will have LOTS of leaves cuz number of trees in one forest can be about 500k. And another things, I am not allowed to use any kind of language extensions but STL. Thanks in advance.

    L 1 Reply Last reply
    0
    • V vmaltsev

      Hail everyone, I started a new project recently and now, in a design stage, I've got some points where I'd like to have as many opinions as possible. :) First of all, the data handling. Let's say I have tons of small object which are referenced by some other object and those are referenced by others. We can see it as a forest with trees and leaves on those trees. So, it's logical to make an array of leaves, trees and forests(cuz I will have more than one forest). But on leaves I might have insects and those insects will be created by other coders. So I need another array of some general insect objects on each leaf. Those insects can be very different, but they should have the only one in common, they should have a possibility to be on a very sectain leaf in my forest. Looks like pretty trivial, though I expressed it in a bizarre form. But there are some disputable points. As such, where to store insect objects, inside an array on the leaf or inside some other global array? Logicaly an insect object must be inside the leaf object (cuz an insect can't be on more than one leaf in a time, so it's not wise to use any kind of refereces), but in the same time we don't know what kind of insect we have, so we can make an array of a generalized insect object and use conversion, but what will happen to data of derived class then? Another question is how to make a copy of a tree, and make it fast, if we want to modify it without modifying an original instance of the forest? Or maybe this idea about arrays is wrong in general and there some better ways to do that? Sorry for such a long post. I will be happy with any kind of remarks and ideas. Small remark though. I will have LOTS of leaves cuz number of trees in one forest can be about 500k. And another things, I am not allowed to use any kind of language extensions but STL. Thanks in advance.

      L Offline
      L Offline
      l a u r e n
      wrote on last edited by
      #2

      ummmmmm i dont think the technicalities of the storage mechanism is where u want to be looking here ... how its stored is not that important why dont u make some classes for each of the main components in ur design, ie: forest tree leaf etc then worry about the internal storage of each class as u get there personally i would use cobjlist's or some such but ur requirements may be diff


      "there is no spoon"
      biz stuff   about me

      1 Reply Last reply
      0
      Reply
      • Reply as topic
      Log in to reply
      • Oldest to Newest
      • Newest to Oldest
      • Most Votes


      • Login

      • Don't have an account? Register

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • World
      • Users
      • Groups