FindInfo.hpp

00001 #ifndef __FIBER_FINDINFO_HPP
00002 #define __FIBER_FINDINFO_HPP
00003 
00004 #include "Slice.hpp"
00005 
00006 namespace Fiber
00007 {
00008         using std::list;
00009         using std::string;
00010 
00020 template <class QueryType>
00021         class Info;
00022 
00027 template <>
00028 struct  BUNDLE_API Info<Slice> : std::pair<double, RefPtr<Slice> > 
00029 {
00031         double  getTime() const { return first; } 
00032 
00034         const RefPtr<Slice>&getSlice() const { return second; } 
00035 
00037         operator double              () const { return getTime() ; } 
00038 
00040         operator const RefPtr<Slice>&() const { return getSlice(); } 
00041 
00043         Info<Slice>(double t=0, const RefPtr<Slice>&S = NullPtr() )
00044         : std::pair<double, RefPtr<Slice> >(t,S)
00045         {}
00046 };
00047 
00054 template <>
00055 struct  BUNDLE_API Info<Grid> : Info<Slice>
00056 {
00057         RefPtr<Grid>    myGrid;
00058 
00060         const RefPtr<Grid>&getGrid() const { return myGrid; }
00061 
00063         operator const RefPtr<Grid>&() const { return myGrid; }
00064 
00068         Info<Grid>(double t=0, const RefPtr<Slice>&S = NullPtr(), const RefPtr<Grid>&G = NullPtr() )
00069         : Info<Slice>(t,S), myGrid(G)
00070         {}
00071 };
00072 
00079 template <>
00080 struct  BUNDLE_API Info<Skeleton> : Info<Grid>
00081 {
00082         RefPtr<Skeleton>        mySkeleton;
00083 
00084         const RefPtr<Skeleton>&getSkeleton() const { return mySkeleton; } 
00085 
00087         operator const RefPtr<Skeleton>&() const
00088         {
00089                 return getSkeleton();
00090         } 
00091 
00093         Info<Skeleton>(double t=0, const RefPtr<Slice>&S = NullPtr(), const RefPtr<Grid>&G = NullPtr(),
00094                        const RefPtr<Skeleton>&Skel = NullPtr() )
00095         : Info<Grid>(t,S,G), mySkeleton( Skel )
00096         {} 
00097 
00099         RefPtr<Representation> getCartesianRepresentation() const
00100         {
00101                 if (!getGrid() )        return NullPtr();
00102                 if (!getSkeleton() )    return NullPtr();
00103 
00104                 return getGrid()->getCartesianRepresentation( *getSkeleton() );
00105         }
00106 };
00107 
00108 
00109 
00110 } /* namespace Fiber */ 
00111 
00112 #endif /*  __FIBER_FINDINFO_HPP */
00113