From 5fd2a854005a11cf868876be2da3f845dd3112d9 Mon Sep 17 00:00:00 2001 From: Ichthyostega Date: Sat, 12 Dec 2009 03:51:26 +0100 Subject: [PATCH] cleanup of BuilderTool includes --- .../applicable-builder-target-types.hpp | 55 +++++++++++++------ src/proc/mobject/builder/buildertool.hpp | 26 ++++----- src/proc/mobject/builder/nodecreatortool.cpp | 14 +++-- src/proc/mobject/builder/nodecreatortool.hpp | 4 +- src/proc/mobject/builder/segmentationtool.cpp | 5 +- src/proc/mobject/builder/segmentationtool.hpp | 4 +- 6 files changed, 66 insertions(+), 42 deletions(-) diff --git a/src/proc/mobject/builder/applicable-builder-target-types.hpp b/src/proc/mobject/builder/applicable-builder-target-types.hpp index 5d4360131..ac94da38b 100644 --- a/src/proc/mobject/builder/applicable-builder-target-types.hpp +++ b/src/proc/mobject/builder/applicable-builder-target-types.hpp @@ -20,29 +20,54 @@ */ +/** @file applicable-builder-target-types.hpp + ** Declaration of all kinds of MObjects to be treated by some "Builder tool". + ** This is part of Lumiera's visitation mechanism: Individual MObject subclasses + ** may declare by the \c DEFINE_PROCESSABLE_BY macro to be specifically processable + ** by a builder tool (visitor). On the other hand, any concrete builder tool (visitor) + ** is free to define a \c treat(Type) function for each of these specific subclasses. + ** If the tool doesn't define such a specific \c treat(..) function, the next suitable + ** function for a supertype will be used. + ** + ** Now there needs to be \em one location where all the specific kinds of treat-able + ** MObjects are declared together (in a typelist). Moreover, we need the full declaration + ** of these classes. This is the catch of using the visitor pattern. Thus, any class + ** to be treated \em specifically (as opposed to be just treated through a supertype + ** or super interface) has two liabilities: + ** - DEFINE_PROCESSABLE_BY + ** - declare the type here in this file, including the header. + ** + ** @note actually the ApplicableBuilderTargetTypes template, when used (as a baseclass + ** of any concrete builder tool, causes the generation of the necessary + ** dispatcher tables used by our visitor implementation. + ** + ** @see buildertool.hpp + ** @see buildertooltest.hpp + ** @see nodecreatertool.hpp + */ + + #ifndef MOBJECT_BUILDER_APPLICABLEBUILDERTARGETTYPES_H #define MOBJECT_BUILDER_APPLICABLEBUILDERTARGETTYPES_H #include "proc/mobject/builder/buildertool.hpp" +// NOTE:  need to include *all* classes using DEFINE_PROCESSABLE_BY(BuilderTool) +#include "proc/mobject/session/root.hpp" +#include "proc/mobject/session/clip.hpp" +#include "proc/mobject/session/effect.hpp" +#include "proc/mobject/session/auto.hpp" + + /////////////////////////////////TICKET #414 + namespace mobject { - namespace session { - - class Clip; - class Effect; - class AbstractMO; - template class Auto; - // Forward declarations sufficient here... - // actual definitions necessary only in the - // implementation file (*cpp) of the builder tool. - } +namespace builder { - namespace builder { - - typedef Types< session::Clip, + typedef Types< session::Root, + session::Clip, session::Effect, session::AbstractMO > ::List @@ -65,7 +90,5 @@ namespace mobject { - } // namespace mobject::builder - -} // namespace mobject +}} // namespace mobject::builder #endif diff --git a/src/proc/mobject/builder/buildertool.hpp b/src/proc/mobject/builder/buildertool.hpp index e0b90979e..9f6a06a25 100644 --- a/src/proc/mobject/builder/buildertool.hpp +++ b/src/proc/mobject/builder/buildertool.hpp @@ -28,22 +28,22 @@ ** ** As the objects to be treated are normally handled by smart-ptrs, BuilderTool provides ** a special facility for dealing with these wrapped objects. There are some liabilities. - ** ** ** @see visitor.hpp - ** @see applicablebuildertargettypes.hpp + ** @see applicable-builder-target-types.hpp ** @see buildertooltest.hpp ** @see nodecreatertool.hpp */ diff --git a/src/proc/mobject/builder/nodecreatortool.cpp b/src/proc/mobject/builder/nodecreatortool.cpp index 8664a2b01..854d92dbc 100644 --- a/src/proc/mobject/builder/nodecreatortool.cpp +++ b/src/proc/mobject/builder/nodecreatortool.cpp @@ -22,9 +22,7 @@ #include "proc/mobject/builder/nodecreatortool.hpp" -#include "proc/mobject/session/clip.hpp" -#include "proc/mobject/session/effect.hpp" -#include "proc/mobject/session/auto.hpp" + using mobject::Buildable; using mobject::session::Clip; @@ -34,8 +32,12 @@ using mobject::session::Auto; namespace mobject { namespace builder { - - + /////////////////////////////////TICKET #414 + + + ////TODO: do we ever get to treat a model root element?? + + void NodeCreatorTool::treat (Buildable& something) { @@ -63,7 +65,7 @@ namespace mobject { void NodeCreatorTool::onUnknown (Buildable& target) { - UNIMPLEMENTED ("catch-all when partitioning timeline"); ////////TODO: verify why this gets enfoced here... + UNIMPLEMENTED ("catch-all when partitioning timeline"); ////////TODO: verify why this gets enforced here... } diff --git a/src/proc/mobject/builder/nodecreatortool.hpp b/src/proc/mobject/builder/nodecreatortool.hpp index 4d3d04b9c..6d2b5e9e8 100644 --- a/src/proc/mobject/builder/nodecreatortool.hpp +++ b/src/proc/mobject/builder/nodecreatortool.hpp @@ -25,7 +25,7 @@ #define MOBJECT_BUILDER_NODECREATORTOOL_H -#include "proc/mobject/builder/applicablebuildertargettypes.hpp" +#include "proc/mobject/builder/applicable-builder-target-types.hpp" #include "proc/engine/rendergraph.hpp" @@ -66,7 +66,7 @@ namespace builder { virtual void treat (mobject::session::Auto& automation) ; //TODO: the automation-type-problem virtual void treat (mobject::Buildable& something) ; - void onUnknown (Buildable& target) ; /////////TODO why doesn't the treat(Buildable) function shaddow this?? + void onUnknown (Buildable& target) ; /////////TODO why doesn't the treat(Buildable) function shadow this?? }; diff --git a/src/proc/mobject/builder/segmentationtool.cpp b/src/proc/mobject/builder/segmentationtool.cpp index 703f25150..d0a18595d 100644 --- a/src/proc/mobject/builder/segmentationtool.cpp +++ b/src/proc/mobject/builder/segmentationtool.cpp @@ -22,9 +22,7 @@ #include "proc/mobject/builder/segmentationtool.hpp" -#include "proc/mobject/session/clip.hpp" -#include "proc/mobject/session/effect.hpp" -#include "proc/mobject/session/segment.hpp" + using mobject::Buildable; using mobject::session::Clip; @@ -34,6 +32,7 @@ using mobject::session::Effect; namespace mobject { namespace builder { + /////////////////////////////////TICKET #414 SegmentationTool::SegmentationTool(mobject::session::Fixture&) diff --git a/src/proc/mobject/builder/segmentationtool.hpp b/src/proc/mobject/builder/segmentationtool.hpp index 7106874c5..2b88f572a 100644 --- a/src/proc/mobject/builder/segmentationtool.hpp +++ b/src/proc/mobject/builder/segmentationtool.hpp @@ -25,7 +25,7 @@ #define MOBJECT_BUILDER_SEGMENTATIONTOOL_H -#include "proc/mobject/builder/applicablebuildertargettypes.hpp" +#include "proc/mobject/builder/applicable-builder-target-types.hpp" #include "proc/mobject/session/segmentation.hpp" #include "proc/mobject/session/fixture.hpp" //////TODO really on the header?? @@ -59,7 +59,7 @@ namespace mobject { void treat (mobject::Buildable& something) ; - void onUnknown (Buildable& target) ; /////////TODO why doesn't the treat(Buildable) function shaddow this?? + void onUnknown (Buildable& target) ; /////////TODO why doesn't the treat(Buildable) function shadow this?? bool empty() const;