Click here to Skip to main content
15,887,175 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
AnswerRe: general window UI design Pin
toxcct1-Mar-06 2:43
toxcct1-Mar-06 2:43 
GeneralRe: general window UI design Pin
derek71-Mar-06 3:35
derek71-Mar-06 3:35 
GeneralRe: general window UI design Pin
toxcct1-Mar-06 3:55
toxcct1-Mar-06 3:55 
Questionhow set a global message, same in all process. Pin
FlyWithYou1-Mar-06 2:00
FlyWithYou1-Mar-06 2:00 
AnswerRe: how set a global message, same in all process. Pin
ThatsAlok1-Mar-06 2:39
ThatsAlok1-Mar-06 2:39 
AnswerRe: how set a global message, same in all process. Pin
Ryan Binns1-Mar-06 2:40
Ryan Binns1-Mar-06 2:40 
AnswerRe: how set a global message, same in all process. Pin
jhwurmbach1-Mar-06 3:00
jhwurmbach1-Mar-06 3:00 
QuestionClass Design Question Pin
ldsdbomber1-Mar-06 1:43
ldsdbomber1-Mar-06 1:43 
OK, I didn't get much of a response in a previous post about program design, and I can see why - I didn't really break the problem down into small enough chunks.

So I am following up with some of the same problem expressed in a (hopefully) more concise way.

All I really want to do is get suggestions on Class design. Now, I have a feeling that some people will wade in with suggestions to use STL templates, which I don't have a problem with, but, because of the fairly simple nature of the program, and the lack of programming skills of people who may have to make small changes to the code, I think it might be OK to just use a simple "normal" array for example, rather than set up a whole vector implementation (not that I'm au fait even with that, having been away from programming for a good few years, I find I've forgotten everything!)


So, here is what my program does (and is linked to an MFC dialog, though that's not relevant probably)


User loads a set of text files
A listbox is populated
A file is selected and a process button clicked
Processed data is displayed in simple static controls on the dialog

The processing part involves

open the text file (in theory should be the same format each time)*
read in a few lines of header info, incl array size
load in some lines of data, making up a 2D array
do stuff with the 2D array data, fairly simple stuff, max size 27*27



because of my time away from programming and because I only ever learned "on the job" with tools code and updates, I never really got comfortable with setting up classes and programs from the ground up. And that's where I would like some help


i.e.
should I be making a "2DArray" type class that can hold the header info and data and be able to do arbitrary processing on 1D and 2D subsets of the array, or should the class be the "2DArrayfile" object, and then have a separate array class that I can call methods on?

It's also important that I do some error checking at each stage, because its being used to check data which impacts clinical treatments - though in fact, the most important thing is correct calculation of the results, so if it fails to load a file properly because somethings out of whack, thats less serious than if it output the wrong value in a calculation!

The things I need to do with this 2D Array:
Find the centre point, which is the "100%" mark
Calculate the size of the array bounded by the 50% values (interpolating between array indexes, each index refers to 1cm of physical distance)
Reduce the physical dimensions of the array to 80% of its value calculated above
This then defines which elements of the array are included in the next step
calculate the max/min in that region
calculate the highest ratio of equally spaced points about the central point along the central axes (or any axis)


So, let's say I have a 2DArray class, and I've read in the text file details, read in the array and it's stored - presumably as a 1D array of doubles, can I overload the [] operators [][]? so that I can access it like a 2D array, or do I need functions to do it, like GetCell(int a, int b), and GetSubArray(int a, int b, int, c, int d)

and then the processing tasks outlined above could just be generalised functions that you can perform on any array data set, and the implementation could check for errors/array bounds, and return the right thing




AnswerRe: Class Design Question Pin
walter761-Mar-06 2:17
walter761-Mar-06 2:17 
GeneralRe: Class Design Question Pin
ldsdbomber1-Mar-06 5:32
ldsdbomber1-Mar-06 5:32 
GeneralRe: Class Design Question Pin
walter761-Mar-06 5:38
walter761-Mar-06 5:38 
QuestionCracking console app that takes data to stdin. Pin
9ine1-Mar-06 1:02
9ine1-Mar-06 1:02 
AnswerRe: Cracking console app that takes data to stdin. Pin
RobJones1-Mar-06 3:31
RobJones1-Mar-06 3:31 
GeneralRe: Cracking console app that takes data to stdin. Pin
9ine1-Mar-06 5:39
9ine1-Mar-06 5:39 
QuestionConverting HWnd to CWnd Pin
whatever891-Mar-06 0:56
whatever891-Mar-06 0:56 
AnswerRe: Converting HWnd to CWnd Pin
Vinaya1-Mar-06 1:01
Vinaya1-Mar-06 1:01 
AnswerRe: Converting HWnd to CWnd Pin
Nibu babu thomas1-Mar-06 1:03
Nibu babu thomas1-Mar-06 1:03 
AnswerRe: Converting HWnd to CWnd Pin
walter761-Mar-06 1:04
walter761-Mar-06 1:04 
GeneralRe: Converting HWnd to CWnd Pin
whatever891-Mar-06 2:53
whatever891-Mar-06 2:53 
QuestionCombo box height is not increasing Pin
BiswaR1-Mar-06 0:51
BiswaR1-Mar-06 0:51 
AnswerRe: Combo box height is not increasing Pin
khan++1-Mar-06 1:26
khan++1-Mar-06 1:26 
GeneralRe: Combo box height is not increasing Pin
BiswaR1-Mar-06 1:48
BiswaR1-Mar-06 1:48 
GeneralRe: Combo box height is not increasing Pin
khan++1-Mar-06 2:19
khan++1-Mar-06 2:19 
QuestionLost my way in classes and array.. Pin
joostvaningen1-Mar-06 0:50
joostvaningen1-Mar-06 0:50 
QuestionRe: Lost my way in classes and array.. Pin
David Crow1-Mar-06 2:58
David Crow1-Mar-06 2:58 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.