MeVisLabToolboxReference
|
00001 #ifndef __SoSFMLBase_H 00002 #define __SoSFMLBase_H 00003 //---------------------------------------------------------------------------------- 00004 // **InsertLicense** code 00005 //---------------------------------------------------------------------------------- 00008 00013 //---------------------------------------------------------------------------------- 00014 00015 #ifndef __InventorWrapperDllInit_H 00016 #include "InventorWrapperDllInit.h" 00017 #endif 00018 #ifndef __SoInventorWrapperTrace_H 00019 #include "SoInventorWrapperTrace.h" 00020 #endif 00021 00022 #include "XVEnterScope.h" 00023 00024 #include <Inventor/fields/SoSubField.h> 00025 #include <Inventor/SbLinear.h> 00026 00027 #include "XVLeaveScope.h" 00028 00029 #include <mlDataTypes.h> 00030 #include <mlTypeDefs.h> 00031 00032 #include <vector> 00033 00034 ML_START_NAMESPACE 00035 class Base; 00036 class RuntimeType; 00037 ML_END_NAMESPACE 00038 00039 //============================================================= 00042 00051 //============================================================= 00052 class INVENTORWRAPPER_API SoSFMLBase : public SoSField { 00053 00054 // Use standard field stuff 00055 SO_SFIELD_CONSTRUCTOR_HEADER(SoSFMLBase); 00056 SO_SFIELD_REQUIRED_HEADER(SoSFMLBase); 00057 00058 public: 00060 static void initClass(); 00061 00063 virtual void setValue(ML_NAMESPACE::Base* mlBasePtr); 00064 virtual ML_NAMESPACE::Base* getValue() const; 00065 virtual int readValue(SoInput* in); 00066 virtual void writeValue(SoOutput* out) const; 00068 00074 void addAllowedType(const ML_NAMESPACE::RuntimeType* allowedType); 00075 00077 template <typename T> 00078 void addAllowedType() { addAllowedType(T::getClassTypeId()); } 00079 00081 std::vector<const ML_NAMESPACE::RuntimeType*> getAllowedTypes() const { return _allowedTypes; } 00082 00085 bool hasUnallowedType() const { return _unallowedType; } 00086 00087 protected: 00089 ML_NAMESPACE::Base* _value; 00090 00092 std::vector<const ML_NAMESPACE::RuntimeType*> _allowedTypes; 00093 00095 bool _unallowedType; 00096 bool _isRefCountedBase; 00097 }; 00098 00099 #endif