Results 1 to 3 of 3

Thread: Data class concept

  1. #1
    Join Date
    Nov 2009
    Location
    Belgium
    Posts
    8
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Data class concept

    Hello,

    I am fairly new to Qt and C++ and have built small apps so far for learning purposes.

    I would like to built an application now that is useful in my work but I would like to receive some information on the concept of handling lots of data.

    It would have to handle data that may involved of 1000's of data entities (data points).

    Each data entity would typically consist of several properties like X, Y and Z coordinates, physical properties, text strings etc.

    So, I would build a data class that correspond with 1 data entity, containing properties (private) and functions to load, save, change the values etc.

    Now my question is, if I have a dataset with e.g. 10,000 data entities, what is the best practise to handle this and save this to or read from a single file?

    Can you just use an array or list or something with dimension 10,000 where every array or list item is of the type of the self-built data class?

    I have a feeling that this is not the best practice because it would require to much memory and become slow if you want to edit large portions of data at once (or display data on a graph for instance).


    Thank you for your tips and tricks!!

    Cheers,

    Dave

  2. #2
    Join Date
    Jan 2006
    Location
    travelling
    Posts
    1,116
    Thanks
    8
    Thanked 127 Times in 121 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Data class concept

    Basically you have to create a struct for your data type and then place instances of this type (or pointer to such instances) into a container. The most adapted container depends on the way you data will be used (containers always make tradeoffs between traversal speed/inserting speed/removal speed/...) so you have to figure that out before being able to chose the proper container or design your own.
    Current Qt projects : QCodeEdit, RotiDeCode

  3. #3
    Join Date
    Nov 2009
    Location
    Belgium
    Posts
    8
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Data class concept

    Thank you for this answer.

    If my base data is more complex, I mean can have variable length etc and not a fixed number of subfields, I use a class instead of a struct. And the container class then contains a bunch of dataclass items...

    The container class I will use will be a QList.

Similar Threads

  1. QT Class GUI Interactions??
    By mikey33 in forum Newbie
    Replies: 3
    Last Post: 19th November 2009, 02:01
  2. Many Data Memebers For a Class
    By MIH1406 in forum Qt Programming
    Replies: 2
    Last Post: 22nd September 2009, 20:00
  3. QT Class to decode PDU data
    By cutie.monkey in forum Newbie
    Replies: 0
    Last Post: 4th July 2009, 05:52
  4. default on class' public data
    By baray98 in forum General Programming
    Replies: 2
    Last Post: 29th July 2008, 02:04
  5. class QHBoxLayout
    By csvivek in forum Installation and Deployment
    Replies: 2
    Last Post: 10th April 2008, 07:57

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Qt is a trademark of The Qt Company.