00001 #ifndef __FIBER_GRID_REPRESENTATIONMAP_HPP
00002 #define __FIBER_GRID_REPRESENTATIONMAP_HPP "Created 16.07.2009 19:45:27 by werner"
00003
00004 #include "GridAPI.h"
00005 #include <field/Field.hpp>
00006 #include "FieldID.hpp"
00007 #include <memcore/TypeInfo.hpp>
00008 #include <set>
00009 #include <list>
00010 #include "FiberSpace.hpp"
00011 #include "BaseSpace.hpp"
00012
00013 namespace Fiber
00014 {
00015 using MemCore::WeakPtr;
00016 using MemCore::NullPtr;
00017 using std::set;
00018 using std::list;
00019
00026 typedef WeakPtr<BaseSpace> Representer;
00027
00028 class GRID_API Representation;
00029
00030 typedef WeakPtr<Representation, FiberSpace<RefPtr<FieldID> > > WeakPtrRepresentation_t;
00031 typedef RefPtr<Representation> RefPtrRepresentation_t;
00032
00033
00038 class GRID_API RepresentationMap
00039 {
00040 protected:
00041
00042 typedef map<Representer, RefPtr<Representation> > Representations_t;
00043 Representations_t Representations;
00044
00045 public:
00046 RepresentationMap();
00047 ~RepresentationMap();
00048
00049 RefPtr<Representation> makeRepresentation(const Representer&D);
00050
00052 Representation&operator[](const Representer&D);
00053
00054 Representation&operator[](const BaseSpace&D)
00055 {
00056 Representer R = D.self();
00057 return (*this)[R];
00058 }
00059
00061 RefPtr<Representation> operator()(const Representer&D) const;
00062
00064 int size() const;
00065
00071 class GRID_API Iterator
00072 {
00073 public:
00074 virtual ~Iterator();
00075
00076 virtual bool apply(const Representer&d, const Representation&R) = 0;
00077 };
00078
00082 int iterate(Iterator&) const;
00083
00087 int getMemoryUsage(memsize_t&UsedMemory, memsize_t&WantedMemory) const;
00088
00089
00093 void Speak(int indent=0, int maxindent=-1) const;
00094 };
00095
00096
00097 }
00098
00099 #endif