Re: Throwing constructor for wrong type of objects
Vladimir Jovic wrote:
[..]
Buffers (except for the source and destination) can be created in a
vector, list, or queue (different container objects for different base
buffer classes).
Where do those live and what is the relationship between buffers of
different types (instance of different templates) and the queue (one
object) which is going to "connect buffers"?
All filter objects will be stored in one container, and the data will be
processed in one run.
OK, let's proceed with a simplified model. Let's have a queue of two
filters, and make it create all the "buffers" for those and process the
input to get to the output.
struct Filter
{
virtual void setFrom(???);
virtual void setTo(???);
virtual void process(??, ??);
};
// now, is this queue generic or does it know how many filters
// it has and what is the sequence of types it processes?
struct FilterQueue
{
typedef std::list<Filter*> list;
typedef list::iterator iterator;
list filters;
void append(Filter* pf) { filters.push_back(pf); }
void createBuffers(???) {
// the filters are added in 'append', here we need to add
// all the buffers between the filters
for (iterator it = filters.begin(); it != filters.end; ++it)
{
// it would seem that the buffers have to be *ALSO*
// storable in some kind of container, no? Otherwise
// how do you move from 'createBuffers' to 'process'?
}
}
void process(???) {
for (iterator it = filters.begin(); it != filters.end; ++it)
it->process(??,??);
}
};
I can only see more questions that haven't yet been answered. Do you
have any answers?
V
--
Please remove capital 'A's when replying by e-mail
I do not respond to top-posted replies, please don't ask