Click here to Skip to main content
15,914,417 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: CFile Question Pin
Dudi Avramov14-Dec-02 23:16
Dudi Avramov14-Dec-02 23:16 
QuestionCSimpleArray ? Pin
ZBUILDER14-Dec-02 19:35
ZBUILDER14-Dec-02 19:35 
AnswerRe: CSimpleArray ? Pin
Renjith Ramachandran14-Dec-02 20:13
Renjith Ramachandran14-Dec-02 20:13 
GeneralRe: CSimpleArray ? Pin
ZBUILDER14-Dec-02 20:18
ZBUILDER14-Dec-02 20:18 
GeneralRe: CSimpleArray ? Pin
Jörgen Sigvardsson15-Dec-02 4:28
Jörgen Sigvardsson15-Dec-02 4:28 
AnswerRe: CSimpleArray ? Pin
Jörgen Sigvardsson15-Dec-02 4:29
Jörgen Sigvardsson15-Dec-02 4:29 
GeneralHelp with context menu programming. Pin
trustno114-Dec-02 15:43
trustno114-Dec-02 15:43 
GeneralTemplate class question... Pin
Matt Gullett14-Dec-02 14:56
Matt Gullett14-Dec-02 14:56 
NOTE: This is a fairly long post.

I have not implemented my own template class before though I have used STL and MFC template classes extensively. I have a situation that I believe can be best dealt with by writing a template class.

Here's the deal:

I have 10-20 console apps which generate data files of various formats from a specified input data source of a known type. For the most part the source data defines the structure of the output based on its configuration. The simplest way to implement these is to just iterate the input records and then in an inner loop examine the data's configuration and produce the correct output.

What I would like to do is to create a template class from which I can construct an "execution plan". The template class would provide an interface for 1) examining the data source and making decisions on the output structure, 2) iterating the data source recordset, 3) following the steps that were decided in #1 for each record.

The way I see it being implemented is something like this (pseudocode):

class BaseExecutionStep
{
}

class ExecutionStep_OutputNumber
{
short sLength;
bool bLeadingZeroes;
short sDecimalPlaces;
}

class ExecutionStep_OutputDate
{
string strFormat;
date dtNullDate;
bool bHideNullDates;
}

class ExecutionStep_OutputText
{
short sLength;
bool bRemoveUndesiredChars;
short sAlign; (left, right, center)
}

class ExecutionStepFactory
{
ExecutionStep* CreateStep(SomeSourceObject);
}

template class ExecutionPlan<ExecutionStepFactory, DataSource, Filter>
{
BuildPlan(); // build a list, array, set of ExecutionSteps using the ExecutionStepFactory
DescribePlan(); // for auto-documentation
ExecutePlan(); //
}

What I would ideally want is to be able to use this same execution plan template class to make the development of these "iterative" proccesses a little more standardized. Ideally I could create any new ExecutionStepFactory and any new DataSource object and be able to use the template to deal with the nasty little details of actually doing this work.

Is this a reasonable use of templates? Is there a better way than what I have descrived here?
GeneralRe: Template class question... Pin
Taka Muraoka14-Dec-02 15:51
Taka Muraoka14-Dec-02 15:51 
GeneralRe: Template class question... Pin
Matt Gullett14-Dec-02 16:03
Matt Gullett14-Dec-02 16:03 
GeneralRe: Template class question... Pin
Taka Muraoka14-Dec-02 16:17
Taka Muraoka14-Dec-02 16:17 
GeneralRe: Template class question... Pin
Matt Gullett14-Dec-02 16:45
Matt Gullett14-Dec-02 16:45 
GeneralRe: Template class question... Pin
Taka Muraoka14-Dec-02 16:55
Taka Muraoka14-Dec-02 16:55 
GeneralRe: Template class question... Pin
Matt Gullett14-Dec-02 17:04
Matt Gullett14-Dec-02 17:04 
GeneralRe: Template class question... Pin
Todd Smith14-Dec-02 17:11
Todd Smith14-Dec-02 17:11 
GeneralRe: Template class question... Pin
Matt Gullett14-Dec-02 17:23
Matt Gullett14-Dec-02 17:23 
GeneralHelp on Overlapped Serial IO Pin
work_to_live14-Dec-02 13:44
work_to_live14-Dec-02 13:44 
GeneralRe: Help on Overlapped Serial IO Pin
work_to_live14-Dec-02 14:21
work_to_live14-Dec-02 14:21 
GeneralRe: Help on Overlapped Serial IO Pin
Michael Dunn14-Dec-02 15:55
sitebuilderMichael Dunn14-Dec-02 15:55 
GeneralRe: Help on Overlapped Serial IO Pin
patk14-Dec-02 17:07
patk14-Dec-02 17:07 
GeneralRe: Help on Overlapped Serial IO Pin
work_to_live14-Dec-02 17:57
work_to_live14-Dec-02 17:57 
GeneralRe: Help on Overlapped Serial IO Pin
patk14-Dec-02 18:49
patk14-Dec-02 18:49 
GeneralRe: Help on Overlapped Serial IO Pin
work_to_live14-Dec-02 19:23
work_to_live14-Dec-02 19:23 
GeneralRe: Help on Overlapped Serial IO Pin
work_to_live14-Dec-02 20:01
work_to_live14-Dec-02 20:01 
GeneralRe: Help on Overlapped Serial IO Pin
patk15-Dec-02 2:35
patk15-Dec-02 2:35 

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.