[ ] put everything into namespace noodles (or should it be Noodles?) to make future use as a library more sane
[ ] the debug function probably needs a mutex to prevent garbling of stderr from different threads
[ ] perhaps use vsprintf to format to a buffer, then mutex-wrap a single function call to blast that string to stderr
[ ] make camelCase vs underscores_between_words more consistent
[ ] document all member functions
[ ] put Block::name() and Graph::name() into class IKnowsName or something and inherit
block
[x] change work semantics
[x] add required virtual function bool Block::could_do_work(void)
[x] Block::work should do work once and then exit
[x] RoundRobinScheduler::work now needs to basically do this: while (block->could_do_work()) { block->work() }
[x] update documentation comments in main.cpp
[x] ~Block needs to be a virtual dtor!
noodle
[ ] validate user-specified max values
[ ] can't be zero
[ ] ... any other bad values?
[ ] invent exceptions for all invalid cases
[ ] add unit tests for all invalid cases
[ ] get rid of Noodle::is_qnoodle and just attempt dynamic_cast<> and check null to downcast
[ ] determine if we can get away with not doing the mutex lock for Noodle::peek
[ ] check thread safety on deque::size (or else we need to lock in QNoodle::count and QNoodle::free)
[ ] rename some functions in Noodle and its subclasses
[ ] max -> s_max
[ ] count -> s_count
[ ] free -> s_free
connecting noodles
[ ] ensure that from_port is an OutputPort
[ ] ensure that to_port is an InputPort
[ ] ensure that from_port and to_port have the same template parameter type T
[ ] test whether typeid(to_port->type) == typeid(from_port->type)
[ ] create a new noodle
[ ] call from_port->connect() with the noodle ptr
[ ] call to_port->connect() with the noodle ptr
graph
[ ] make class Graph be subclassed for different graph setups
[ ] class Graph itself should be abstract
[ ] have the block/noodle initialization/connection stuff happen in the subclass's constructor
[ ] in main.cpp, create class MyGraph : public Graph or whatever, put all the setup into its constructor, then have main just create a MyGraph instance instead of doing all the work itself
[ ] need a strict notion of setup time vs run time within each graph
[ ] make the graph/scheduler relationship less dumb
schedulers
[ ] keep all Scheduler subclasses in Scheduler.h, but:
[ ] move class RoundRobinScheduler to RoundRobinScheduler.cpp
[ ] move class ThreadedScheduler to ThreadedScheduler.cpp
[ ] move class InteractiveScheduler to InteractiveScheduler.cpp
[ ] update Makefile for changed object files
[ ] handle "done" condition in RoundRobinScheduler the same way we plan to with ThreadedScheduler (get rid of the for loop)
unit tests
[ ] make sure that the locking mechanisms in class Noodle actually work
[ ] need tests for all exceptions in Port.h, Block.h, Noodle.h, Graph.h (wait until type system work stabilizes, because we might just rewrite all this stuff anyway, wasting effort)
TODO
's in code and handle themnamespace noodles
(or should it beNoodles
?) to make future use as a library more sanedebug
function probably needs a mutex to prevent garbling of stderr from different threadsvsprintf
to format to a buffer, then mutex-wrap a single function call to blast that string to stderrcamelCase
vsunderscores_between_words
more consistentBlock::name()
andGraph::name()
intoclass IKnowsName
or something and inheritblock
bool Block::could_do_work(void)
Block::work
should do work once and then exitRoundRobinScheduler::work
now needs to basically do this:while (block->could_do_work()) { block->work() }
main.cpp
~Block
needs to be a virtual dtor!noodle
Noodle::is_qnoodle
and just attemptdynamic_cast<>
and check null to downcastNoodle::peek
deque::size
(or else we need to lock inQNoodle::count
andQNoodle::free
)Noodle
and its subclassesmax
->s_max
count
->s_count
free
->s_free
connecting noodles
from_port
is anOutputPort
to_port
is anInputPort
from_port
andto_port
have the same template parameter typeT
typeid(to_port->type) == typeid(from_port->type)
from_port->connect()
with the noodle ptrto_port->connect()
with the noodle ptrgraph
class Graph
be subclassed for different graph setupsclass Graph
itself should be abstractmain.cpp
, createclass MyGraph : public Graph
or whatever, put all the setup into its constructor, then havemain
just create aMyGraph
instance instead of doing all the work itselfschedulers
Scheduler
subclasses inScheduler.h
, but:class RoundRobinScheduler
toRoundRobinScheduler.cpp
class ThreadedScheduler
toThreadedScheduler.cpp
class InteractiveScheduler
toInteractiveScheduler.cpp
Makefile
for changed object filesRoundRobinScheduler
the same way we plan to withThreadedScheduler
(get rid of thefor
loop)unit tests
class Noodle
actually workPort.h
,Block.h
,Noodle.h
,Graph.h
(wait until type system work stabilizes, because we might just rewrite all this stuff anyway, wasting effort)