Atlas.hpp

00001 #ifndef __FIBER_GRID_ATLAS_HPP
00002 #define __FIBER_GRID_ATLAS_HPP "Created 27.02.2001 21:42:27 by werner"
00003 
00004 #include "GridAPI.h"
00005 #include "Chart.hpp"
00006 
00007 namespace Fiber
00008 {
00009         using std::set;
00010 
00018 class   GRID_API GlobalCharts : public ReferenceBase<GlobalCharts>
00019                               , public Intercube
00020 {
00021 public:
00022         typedef MemCore::typemap<RefPtr<ChartIDList> > ChartDomain_t;
00023         ChartDomain_t ChartDomain;
00024 
00025         GlobalCharts();
00026 
00027         RefPtr<ChartIDList> operator()(const type_info&) const;
00028 
00029         ChartIDList&operator[](const type_info&);
00030 
00031         RefPtr<ChartID> mkChartID(const type_info&ti, const string&name)
00032         {
00033                 return (*this)[ ti ][ name ];
00034         }
00035 };
00036 
00052 class   GRID_API Atlas : public ReferenceBase<Atlas>
00053 {
00054 public:
00055         typedef set<RefPtr<Chart> >     Atlas_t;
00056         Atlas_t                         ChartSet;
00057         RefPtr<GlobalCharts>            GlobalAtlas;
00058 
00059 public:
00060         Atlas(const RefPtr<GlobalCharts>&GA); 
00061 
00062         const RefPtr<GlobalCharts>&getGlobalAtlas() const
00063         {
00064                 return GlobalAtlas;
00065         }
00066 
00072         RefPtr<ChartIDList> operator()(const type_info&ti) const
00073         {
00074                 if (!GlobalAtlas)
00075                         return NullPtr();
00076 
00077                 return (*GlobalAtlas)( ti );
00078         }
00079 
00084         ChartIDList&operator[](const type_info&);
00085 
00091         RefPtr<ChartID> mkChartID(const type_info&ti, const string&name)
00092         {
00093                 return (*this)[ ti ][ name ];
00094         }
00095 
00096         
00097         void insertChart(const RefPtr<Chart>&newChart);
00098 
00099 
00101 //      RefPtr<Chart> operator()(const string&) const;
00102         RefPtr<Chart> operator()(const RefPtr<ChartID>&) const;
00103 
00105         RefPtr<Chart> operator()(const RefPtr<Chart>&C) const
00106         {
00107                 if (!C) 
00108                         return NullPtr();
00109 
00110                 return (*this)( C->ID() );
00111         }
00112 
00113 
00114 
00115 
00116 
00117 
00118 
00123      // RefPtr<Chart> operator()(const type_info&) const;
00124 
00129 //      RefPtr<Chart> operator[](const type_info&);
00130 
00133 //      RefPtr<Chart> getGlobalChart(const type_info&, const string&);
00134 //      RefPtr<Chart> newChart(const RefPtr<Chart>&);
00135 
00136 /*
00137         template <class CoordinateSystem>
00138         struct CreateChart
00139         {
00140         static  RefPtr<Chart> global(GridAtlas&myGridAtlas)
00141                 {
00142                         //      GridAtlas::inited += CoordinateMap<CoordinateSystem>::initialized;
00143                         return myGridAtlas[ typeid(CoordinateSystem) ];
00144                 }
00145         };
00146 */
00147 };
00148 
00149 /*
00150 template <class CoordinateSystem>
00151 struct GridAtlas::CreateChart<CoordinateMap<CoordinateSystem> >
00152 {
00153 static  RefPtr<Chart> global(GridAtlas&myGridAtlas)
00154         {
00155                 GridAtlas::inited += CoordinateMap<CoordinateSystem>::initialized;
00156                 return myGridAtlas[ typeid(CoordinateSystem) ];
00157         }
00158 };
00159 */
00160 
00161 
00162 } /* namespace Fiber */ 
00163 
00164 #endif /* __FIBER_GRID_ATLAS_HPP */
00165 
00166