GridID.hpp

00001 #ifndef __FIBER_GRIDID_HPP
00002 #define __FIBER_GRIDID_HPP "Created 27.02.2001 21:42:27 by werner"
00003 
00004 #include "BundleAPI.h"
00005 #include <grid/Grid.hpp>
00006 #include <memcore/Persistencer.hpp>
00007 #include <list>
00008 
00009 namespace Fiber
00010 {
00011         using std::list;
00012         using std::string;
00013         using MemCore::SaveRegistry;
00014 
00015 class   BUNDLE_API GridList;
00016 class   BUNDLE_API SliceList;
00017 class   BUNDLE_API Slice;
00018 
00024 class   BUNDLE_API GridID : public ReferenceBase<GridID>, public Intercube
00025 {
00026         string  name; 
00027         SliceList*SL;
00028 
00030         GridID(const string&s); 
00031 
00032         GridID(const GridID&);
00033         void operator=(const GridID&);
00034 
00035         WeakPtr<GridID>                 ParentGrid;
00036 
00037         typedef set<WeakPtr<GridID> >   ChildGrids_t;
00038         ChildGrids_t                    ChildGrids;
00039 
00040 public:
00041         friend class GridList; 
00042         friend class SliceList;
00043         
00044         ~GridID(); 
00045 
00049         bool insertChild(const WeakPtr<GridID>&ChildGrid); 
00050 
00054         bool isParentOf(const WeakPtr<GridID>&PossibleChildGrid);
00055 
00059         bool isChildOf(const WeakPtr<GridID>&PossibleParentGrid); 
00060 
00064         const WeakPtr<GridID>&getParent() const
00065         {
00066                 return ParentGrid;
00067         } 
00068 
00072         struct  BUNDLE_API Iterator
00073         {
00075                 virtual bool apply(const WeakPtr<GridID>&ChildGrid) = 0; 
00076 
00077                 virtual ~Iterator();
00078         }; 
00079 
00083         int iterate(Iterator&It) const;
00084 
00086         const string&Name() const
00087         {
00088                 return name;
00089         }
00090 
00091         bool equal(const string&s);
00092 };
00093 
00094 } /* namespace Fiber */ 
00095 
00096 #endif /* __FIBER_GRIDID_HPP */
00097