00001
00002
00003 #ifndef _JAFAR_GEOM_ATOM_VISITOR_HPP_
00004 #define _JAFAR_GEOM_ATOM_VISITOR_HPP_
00005
00006 #include <geom/geomException.hpp>
00007 #include <geom/Declarations.hpp>
00008
00009 #define GEN_VISITOR_FUNCTIONS \
00010 public: \
00011 virtual void accept( AtomVisitorInterface<dimension>* visitor ) const { \
00012 visitor->visit( *this ); \
00013 }
00014
00015 namespace jafar {
00016 namespace geom {
00017 template<int dimension>
00018 class AtomVisitorInterface {
00019 public:
00020 virtual void visit( const geom::Point<dimension>& point) = 0;
00021 virtual void visit( const geom::Line<dimension>& line) = 0;
00022 virtual void visit( const geom::HyperPlane<dimension>& plan) = 0;
00023 virtual void visit( const geom::Segment<dimension>& segment) = 0;
00024 virtual void visit( const geom::PolyLine<dimension>& polyLine) = 0;
00025 virtual void visit( const geom::Facet<dimension>& facet) = 0;
00026 virtual void visit( const geom::Repere<dimension>& repere) = 0;
00027 };
00028 template<int dimension>
00029 class AtomVisitor : public AtomVisitorInterface<dimension> {
00030 public:
00031 virtual void visit( const geom::Point<dimension>& )
00032 {
00033 JFR_ERROR(GeomException, GeomException::UnhandledVisitor, "Point is not handled." );
00034 }
00035 virtual void visit( const geom::Line<dimension>& )
00036 {
00037 JFR_ERROR(GeomException, GeomException::UnhandledVisitor, "Line is not handled." );
00038 }
00039 virtual void visit( const geom::HyperPlane<dimension>& )
00040 {
00041 JFR_ERROR(GeomException, GeomException::UnhandledVisitor, "HyperPlane is not handled." );
00042 }
00043 virtual void visit( const geom::Segment<dimension>& )
00044 {
00045 JFR_ERROR(GeomException, GeomException::UnhandledVisitor, "Segment is not handled." );
00046 }
00047 virtual void visit( const geom::PolyLine<dimension>& )
00048 {
00049 JFR_ERROR(GeomException, GeomException::UnhandledVisitor, "PolyLine is not handled." );
00050 }
00051 virtual void visit( const geom::Facet<dimension>& )
00052 {
00053 JFR_ERROR(GeomException, GeomException::UnhandledVisitor, "Facet is not handled." );
00054 }
00055 virtual void visit( const geom::Repere<dimension>& )
00056 {
00057 JFR_ERROR(GeomException, GeomException::UnhandledVisitor, "Repere is not handled." );
00058 }
00059 };
00060 }
00061 }
00062
00063 #endif