Data flow

C

colin

Hi,

Im tidying up some code ive written wich atm is all in the main form.
its working reasonably well, uses zedgraph wich is nice,
but i need to tidy it up as its become increasingly difficult to work with.
although very fluent in C++ etc, im still geting to grips with c#,
and I think theres probably a better way to do what im trying todo in c#.

so far ive managed to seperate all but the data processing into seperate
clases in seperate files,
and also a seperate process entirly to collect the data, quite easily,
but the data processing is the bulkiest part.

the data consisting of 4 floats arrives at a rate of 5000 per minute,
and there maybe upto a years worth of data and I am displaying the data in
real time as it arrives.

the processing can be split into many data transformations,
the first stage organises the data into blocks of 10 minutes worth of data,
the next stage does some statistics and converts about 3 seconds of data to
1 point.
although this actually takes many complicated steps, with blocks of blocks
inbetween.
the data then gets some more processing such as fft etc.
the last stage takes blocks of data wich are a whole days worth.
the graph displays up to the minute statistics as each of the different
length blocks are processed.

atm each procesing stage is a function and calls the next function when it
has assembled a block of data.

however im hoping to break it down into seperate classes wich are easiy to
identify
and change/swap and add extra stages inbetween easily.
the main task sends the incoming data to the first stage/class
but im hoping to make it then control the transfer of processed data from
each stage to the next stage as it becomes ready.

however there are a lot of data variables that are shared throughout the
code,
more than I had first thought wich is making it a bit of a job,
such as graph pointpairlists etc but c# has no global data as with c++
there are too many to pass with parameters,
so I need to make each class able to access the data,
I could just keep them in the main form and pass a reference to the classes,
but it would be preferable to split the data up and move to the most
appropriate class wich makes that a bit more dificult for each class to
access.

im trying to make it clearer to follow the code, but adding such indirection
adds a level of complexity.
its a bit of a job in any language but I was wondering if C# had anything
fancy to do this sort of thing that i havent come acros yet ? although I
just realised I could make them static that could work.
or do partial classes work well ?
with c# is there a prefered way to control the flow of data from one class
to another?
I gues this is like event handling but im not sure this will make things
clearer or not.

thanks
Colin =^.^=
 
A

AlexS

You can use static class with public properties or fields for your globals.
Previously several posts discussed this.

HTH
Alex
 
C

colin

AlexS said:
You can use static class with public properties or fields for your
globals. Previously several posts discussed this.

yes thanks, i should of realised that from the start, I didnt know you could
make the class decleration static itself although all this does is make sure
you dont have any non static members, you stil have to make each member
static.

I also just made one of the class instances static on the form1, so it could
be easily referenced, as it was too much work to make all the members
static.

ofc if I want to make more than one instance this is the better way.

it was mainly about ways to organize data flows than anything,
doesnt seem like theres anything very new there compared to c++/mfc.
Im not sure what I would expect to find.

I know theres a lot of c# I havnt used yet.
much of that is the interface rather than the language.

Colin =^.^=
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top