FieldObject.hpp

00001 #ifndef __FISH_FIELDOBJECT_HPP
00002 #define __FISH_FIELDOBJECT_HPP
00003 
00004 #include "fishboneDllApi.h"
00005 
00006 #include <bundle/Bundle.hpp>
00007 #include <ocean/shrimp/VObjectStatus.hpp>
00008 
00009 #include "FishField.hpp"
00010 #include "FishSlice.hpp"
00011 #include "GridObject.hpp"
00012 #include "TypedCreationPreferences.hpp"
00013 
00014 
00015 namespace Wizt
00016 {
00017 
00018 
00026 class fishbone_API FieldObject : public virtual VObject,
00027                                  public virtual Fish<Fiber::Slice>,
00028                                  public virtual Fish<Fiber::Grid>,
00029                                  public StatusIndicator
00030 {
00031 public:
00033         TypedSlot<VStringList>  MyFieldNames; 
00034 
00036         Fiber::TypeList_t AcceptedFields;
00037 
00039         VOutput<Fiber::Field>   theField;
00040 
00045         Fiber::TypeList_t&OutputFieldTypes()
00046         {
00047                 return theField().FieldTypes();
00048         }
00049 
00051         FieldObject(const string&name, int p = 0, const RefPtr<VCreationPreferences>&VP = NullPtr(), bool ExportGrid = true);
00052 
00054         ~FieldObject();
00055 
00059 static  bool    HasFields(const WeakPtr<VCreatorBase>&, const RefPtr<VObject>&vobj);
00060 
00067         override bool update(VRequest&R, double precision);
00068 };
00069 
00070 
00078 template <class FieldVObject>
00079 struct  FieldObjectCreator : VCreator<FieldVObject, AcceptList<Fiber::Grid> >
00080 {
00081         typedef VCreator<FieldVObject, AcceptList<Fiber::Grid> >  Base_t;
00082 
00083         FieldObjectCreator(const string&name, int p=0, 
00084                            const RefPtr<VCreationPreferences>&VP=NullPtr() )
00085         : Base_t(name, p, VP)
00086         {}
00087 
00088         override string createChildname(const string&parent_name) const
00089         {
00090         string  BaseName = right_of( this->Name(), '/');
00091                 return BaseName + "On" + parent_name;
00092 
00093 
00094 //              return parent_name + "->" + BaseName;
00095 //              return parent_name + "(" + this->Name() + ")";
00096         }
00097 
00098         override RefPtr<VAcceptInfo> accept(const RefPtr<VObject>&vobj) const
00099         {
00100                 if (!FieldVObject::HasFields(this->self(), vobj) )
00101                         return NullPtr(); 
00102 
00103                 if (RefPtr<VAcceptInfo>  VAI = Base_t::accept(vobj))
00104                 {
00105                         return VAI;
00106                 } 
00107 
00108                 return NullPtr(); 
00109         }
00110 };
00111 
00112 } // namespace Wizt
00113 
00114 #endif /* __FISH_FISHOBJECT_HPP */
00115 
00116