Main Page   Namespace List   Class Hierarchy   Compound List   File List   Namespace Members   Compound Members   File Members  

PropertyType.h

Go to the documentation of this file.
00001 
00045 #ifndef _AMIRE_PROPERTY_PROPERTY_TYPE_H
00046 #define _AMIRE_PROPERTY_PROPERTY_TYPE_H
00047 
00048 #include <amire/common/Defines.h>
00049 #include <amire/property/Property.h>
00050 
00051 namespace amire {
00052   namespace property {
00053     class AMIRE_EXPORT_API Property;
00054     class AMIRE_EXPORT_API PropertyTypeManager;
00055 
00080     class AMIRE_EXPORT_API PropertyType : public virtual osg::Referenced {
00081     public:
00085       typedef enum {
00086         REFERENCE_PROPERTY = 0,
00087         NATIVE_PROPERTY,
00088         BOOLEAN_PROPERTY,
00089         INTEGER_PROPERTY,
00090         FLOAT_PROPERTY,
00091         DOUBLE_PROPERTY,
00092         CHAR_PROPERTY,
00093         STRING_PROPERTY,
00094         STRUCT_PROPERTY,
00095         VECTOR_PROPERTY
00096       } Kind;
00097 
00098     protected:
00099       friend class AMIRE_EXPORT_API PropertyTypeManager;
00100       Kind kind;
00101       mutable PropertyTypeManager *propertyTypeManager;
00102       std::string name;
00103       std::string libraryName;
00104 
00105     public:
00106       virtual ~PropertyType();
00107 
00112       virtual bool isTypeOf(const osg::ref_ptr<const PropertyType> &type) const;
00113 
00117       virtual osg::ref_ptr<Property> newInstance() const;
00118 
00122       inline PropertyType::Kind getKind() const {
00123         return kind;
00124       }
00125 
00129       inline const std::string &getName() const {
00130         return name;
00131       }
00132 
00136       inline PropertyTypeManager *getPropertyTypeManager() const {
00137         return propertyTypeManager;
00138       }
00139 
00146       const std::string &getLibrary() const;
00147 
00155       void setLibrary(const std::string &libraryName);
00156 
00157     protected:
00158       PropertyType(const std::string &name, PropertyType::Kind kind, PropertyTypeManager *propertyTypeManager);
00159     };
00160 
00161     typedef osg::ref_ptr<Property> (*NativePropertyNew)(const PropertyTypeManager *propertyTypeManager);
00162 
00163     class AMIRE_EXPORT_API NativePropertyType : public virtual PropertyType {
00164     private:
00165       NativePropertyNew nativePropertyNew;
00166 
00167     public:
00168       NativePropertyType(const std::string &name, NativePropertyNew nativePropertyNew, PropertyTypeManager *propertyTypeManager);
00169       virtual ~NativePropertyType();
00170 
00171       virtual osg::ref_ptr<Property> newInstance() const;
00172     };
00173 
00174     typedef STD_HASH_MAP(std::string, osg::ref_ptr<PropertyType>, amire::common::HashCompareString) StringToPropertyTypeMap;
00175     typedef STD_HASH_MAP(std::string, osg::ref_ptr<const PropertyType>, amire::common::HashCompareString) StringToConstPropertyTypeMap;
00176 
00177     typedef STD_HASH_MAP(std::string, osg::ref_ptr<NativePropertyType>, amire::common::HashCompareString) StringToNativePropertyTypeMap;
00178     typedef STD_HASH_MAP(std::string, osg::ref_ptr<const NativePropertyType>, amire::common::HashCompareString) StringToConstNativePropertyTypeMap;
00179   }
00180 }
00181 
00182 #endif
00183 

Generated on Tue May 20 17:23:53 2003 for AMIRE-Framework by doxygen1.3