OpenSceneGraph/include/osgIntrospection/PropertyInfo

385 lines
15 KiB
Plaintext
Raw Normal View History

2006-07-18 23:21:48 +08:00
/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield
2005-04-29 18:06:50 +08:00
*
* This library is open source and may be redistributed and/or modified under
* the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or
* (at your option) any later version. The full license is in LICENSE file
* included with this distribution, and on the openscenegraph.org website.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* OpenSceneGraph Public License for more details.
*/
//osgIntrospection - Copyright (C) 2005 Marco Jez
#ifndef OSGINTROSPECTION_PROPERTYINFO_
#define OSGINTROSPECTION_PROPERTYINFO_
#include <osgIntrospection/Export>
#include <osgIntrospection/Type>
#include <osgIntrospection/MethodInfo>
#include <osgIntrospection/Attributes>
#include <string>
#include <typeinfo>
#include <iosfwd>
#include <vector>
namespace osgIntrospection
{
2005-03-14 17:28:31 +08:00
/// This class keeps information about a class' property. A property is
/// defined by a name and a set of methods that store and retrieve
/// values. When the user wants to "get" the value of a property, the
/// getter method will be invoked and its value returned. When the user
/// wants to "set" the value of a property, the setter method will be
/// called. There are three kinds of property: simple (get/set), indexed
/// (get[i1, i2, ...]/set[i1, i2, ...]), and array (count/add/get[i]/
/// set[i]).
/// Objects of class PropertyInfo can't be modified once they have been
/// created, but they can be queried without restrictions. You can either
/// retrieve the accessor methods and invoke them manually, or you can
/// call getValue() / setValue() etc. methods to perform direct operations
/// on the property, given an instance of the declaring type to work on.
/// The latter technique is preferred because it checks for custom
/// attributes associated to the PropertyInfo object and passes control
/// to them when needed.
///
class OSGINTROSPECTION_EXPORT PropertyInfo: public CustomAttributeProvider
{
public:
From David Callu: " the main problem is the wrapper generation: The PropertyInfo class use MethodInfo class to access to the value. When the property are define with the I_Property* macro, the MethodInfo use by the property to have access to the value are instancied in the I_Property* macro, but there are already instantied by the I_Method* macro before secondary problem: - the function used by the property could no be customized in the genwrapper.conf file - an array property can't insert a value - the std::map reflector (and indexedProperty in general) haven't remove method - about the help in wrapper ... why not ... solution : To use the function define by the I_Method, I add a MethodInfo variable in the I_Method0 macro old macro : #define I_Method0(ret, fn) (\ params.clear(),\ addMethod(new osgIntrospection::TypedMethodIn fo0<reflected_type, ret >(qualifyName(#fn), &reflected_type::fn, params))) new macro : #define I_Method0(ret, fn, signature, briefHelp, detailedHelp) \ params.clear(); \ osgIntrospection::MethodInfo* signature = addMethod(new osgIntrospection::TypedMethodInfo0<reflected_type, ret >(qualifyName(#fn), &reflected_type::fn, params, briefHelp, detailedHelp)); sink(signature) the osgIntrospection::MethodInfo* signature is used by the I_Property macro to define the MethodInfo that it use so for I_Property macro : old macro : #define I_PropertyWithReturnType(t, n, r) \ cap=addProperty(new osgIntrospection::PropertyInfo(osgIntrospection::Reflection::getType(typeid(reflected_type)), osgIntrospection::Reflection::getType(typeid(t)), #n, \ I_Method0(t, get##n), \ I_Method1(r, set##n, IN, t, value))) new macro: #define I_SimpleProperty(t, n, get, set) \ get, \ set)) The genwrapper has been modified in this way. The method signature is define by the prototype of the method For example, the "const char* libraryName();" have "__C5_char_P1__libraryName" for signature solution for secondary problem: The genwrapper accept new tokens in the configuration to custumize the property. The new PropertyInserter and the CustomPropertyInsertAttribute class has been defined The PropertyRemover has been added to the StdMapReflector The _briefHelp and _detailedHelp variable has been added in PropertyInfo, MethodInfo and ContructorInfo class modification: I have modify the genwrapper files Configuration.cpp Configuration.h add some tokens to custumize the property Doxyfile.template add the comment in the output xml genwrapper.conf customize some property in osg::Geometry RegistryBuilder.h RegistryBuilder.cpp add the process_help function (to extract help from xml) TypeRegister.cpp TypeRegister.h optimize the property detection TypeDesc.h TypeDesc.cpp modify FunctionDesc and PropertyDesc WrapperGenerator.h WrapperGenerator.cpp modify the output I also modify the fallowing osgIntrospection files: include/osgIntrospection/Attributes add the PropertyInserter and the CustomPropertyInsertAttribute class include/osgIntrospection/ConstructorInfo add the _briefHelp and _detailedHelp variable in the ConstructorInfo class add access function for the two new variables (_briefHelp and _detailedHelp) modify the constructor to define the two new variables (_briefHelp and _detailedHelp) include/osgIntrospection/MethodInfo add the _briefHelp and _detailedHelp variable in the MethodInfo class add access function for the two new variables (_briefHelp and _detailedHelp) modify the constructor to define the two new variables (_briefHelp and _detailedHelp) include/osgIntrospection/PropertyInfo add the _briefHelp and _detailedHelp variable in the PropertyInfo class add access function for the two new variables (_briefHelp and _detailedHelp) modify the constructor to define the two new variables (_briefHelp and _detailedHelp) include/osgIntrospection/ReflectionMacro remove unused I_Property* macro modify all I_Method macro to accept the help string modify all I_Method macro to define a MethodInfo signature include/osgIntrospection/Reflector add the PropertyInserter in StdVectorReflector and StdListReflector add the PropertyRemover in the StdMapReflector include/osgIntrospection/StaticMethodInfo modify all StaticMethodInfo* to accept the help in parameter include/osgIntrospection/TypedMethodInfo modify all TypedMethodInfo* to accept the help in parameter include/osgIntrospection/TypedConstructorInfo modify all TypedConstructorInfo* to accept the help in parameter include/osgIntrospection/Type add the _briefHelp and _detailedHelp variable in the Type class "
2006-10-17 23:17:06 +08:00
/// Direct initialization constructor for simple properties.
2005-03-14 17:28:31 +08:00
/// You must pass the Type object associated to the class that
/// declares the property, the Type object that describes the
/// type of the property's value, the property name and the
/// getter/setter methods. Either the setter or the getter can
/// be null, meaning a restricted access. If both are null, the
/// user is expected to add a custom accessor attribute to this
/// PropertyInfo object.
2008-12-17 19:00:16 +08:00
PropertyInfo(const Type& declaratiionType, const Type& ptype, const std::string& name, const MethodInfo* getm, const MethodInfo* setm, std::string briefHelp = std::string(), std::string detailedHelp = std::string())
: CustomAttributeProvider(),
2008-12-17 19:00:16 +08:00
_declarationType(declaratiionType),
_ptype(ptype),
_name(name),
_getm(getm),
_setm(setm),
_numm(0),
_addm(0),
From David Callu: " the main problem is the wrapper generation: The PropertyInfo class use MethodInfo class to access to the value. When the property are define with the I_Property* macro, the MethodInfo use by the property to have access to the value are instancied in the I_Property* macro, but there are already instantied by the I_Method* macro before secondary problem: - the function used by the property could no be customized in the genwrapper.conf file - an array property can't insert a value - the std::map reflector (and indexedProperty in general) haven't remove method - about the help in wrapper ... why not ... solution : To use the function define by the I_Method, I add a MethodInfo variable in the I_Method0 macro old macro : #define I_Method0(ret, fn) (\ params.clear(),\ addMethod(new osgIntrospection::TypedMethodIn fo0<reflected_type, ret >(qualifyName(#fn), &reflected_type::fn, params))) new macro : #define I_Method0(ret, fn, signature, briefHelp, detailedHelp) \ params.clear(); \ osgIntrospection::MethodInfo* signature = addMethod(new osgIntrospection::TypedMethodInfo0<reflected_type, ret >(qualifyName(#fn), &reflected_type::fn, params, briefHelp, detailedHelp)); sink(signature) the osgIntrospection::MethodInfo* signature is used by the I_Property macro to define the MethodInfo that it use so for I_Property macro : old macro : #define I_PropertyWithReturnType(t, n, r) \ cap=addProperty(new osgIntrospection::PropertyInfo(osgIntrospection::Reflection::getType(typeid(reflected_type)), osgIntrospection::Reflection::getType(typeid(t)), #n, \ I_Method0(t, get##n), \ I_Method1(r, set##n, IN, t, value))) new macro: #define I_SimpleProperty(t, n, get, set) \ get, \ set)) The genwrapper has been modified in this way. The method signature is define by the prototype of the method For example, the "const char* libraryName();" have "__C5_char_P1__libraryName" for signature solution for secondary problem: The genwrapper accept new tokens in the configuration to custumize the property. The new PropertyInserter and the CustomPropertyInsertAttribute class has been defined The PropertyRemover has been added to the StdMapReflector The _briefHelp and _detailedHelp variable has been added in PropertyInfo, MethodInfo and ContructorInfo class modification: I have modify the genwrapper files Configuration.cpp Configuration.h add some tokens to custumize the property Doxyfile.template add the comment in the output xml genwrapper.conf customize some property in osg::Geometry RegistryBuilder.h RegistryBuilder.cpp add the process_help function (to extract help from xml) TypeRegister.cpp TypeRegister.h optimize the property detection TypeDesc.h TypeDesc.cpp modify FunctionDesc and PropertyDesc WrapperGenerator.h WrapperGenerator.cpp modify the output I also modify the fallowing osgIntrospection files: include/osgIntrospection/Attributes add the PropertyInserter and the CustomPropertyInsertAttribute class include/osgIntrospection/ConstructorInfo add the _briefHelp and _detailedHelp variable in the ConstructorInfo class add access function for the two new variables (_briefHelp and _detailedHelp) modify the constructor to define the two new variables (_briefHelp and _detailedHelp) include/osgIntrospection/MethodInfo add the _briefHelp and _detailedHelp variable in the MethodInfo class add access function for the two new variables (_briefHelp and _detailedHelp) modify the constructor to define the two new variables (_briefHelp and _detailedHelp) include/osgIntrospection/PropertyInfo add the _briefHelp and _detailedHelp variable in the PropertyInfo class add access function for the two new variables (_briefHelp and _detailedHelp) modify the constructor to define the two new variables (_briefHelp and _detailedHelp) include/osgIntrospection/ReflectionMacro remove unused I_Property* macro modify all I_Method macro to accept the help string modify all I_Method macro to define a MethodInfo signature include/osgIntrospection/Reflector add the PropertyInserter in StdVectorReflector and StdListReflector add the PropertyRemover in the StdMapReflector include/osgIntrospection/StaticMethodInfo modify all StaticMethodInfo* to accept the help in parameter include/osgIntrospection/TypedMethodInfo modify all TypedMethodInfo* to accept the help in parameter include/osgIntrospection/TypedConstructorInfo modify all TypedConstructorInfo* to accept the help in parameter include/osgIntrospection/Type add the _briefHelp and _detailedHelp variable in the Type class "
2006-10-17 23:17:06 +08:00
_insm(0),
_remm(0),
From David Callu: " the main problem is the wrapper generation: The PropertyInfo class use MethodInfo class to access to the value. When the property are define with the I_Property* macro, the MethodInfo use by the property to have access to the value are instancied in the I_Property* macro, but there are already instantied by the I_Method* macro before secondary problem: - the function used by the property could no be customized in the genwrapper.conf file - an array property can't insert a value - the std::map reflector (and indexedProperty in general) haven't remove method - about the help in wrapper ... why not ... solution : To use the function define by the I_Method, I add a MethodInfo variable in the I_Method0 macro old macro : #define I_Method0(ret, fn) (\ params.clear(),\ addMethod(new osgIntrospection::TypedMethodIn fo0<reflected_type, ret >(qualifyName(#fn), &reflected_type::fn, params))) new macro : #define I_Method0(ret, fn, signature, briefHelp, detailedHelp) \ params.clear(); \ osgIntrospection::MethodInfo* signature = addMethod(new osgIntrospection::TypedMethodInfo0<reflected_type, ret >(qualifyName(#fn), &reflected_type::fn, params, briefHelp, detailedHelp)); sink(signature) the osgIntrospection::MethodInfo* signature is used by the I_Property macro to define the MethodInfo that it use so for I_Property macro : old macro : #define I_PropertyWithReturnType(t, n, r) \ cap=addProperty(new osgIntrospection::PropertyInfo(osgIntrospection::Reflection::getType(typeid(reflected_type)), osgIntrospection::Reflection::getType(typeid(t)), #n, \ I_Method0(t, get##n), \ I_Method1(r, set##n, IN, t, value))) new macro: #define I_SimpleProperty(t, n, get, set) \ get, \ set)) The genwrapper has been modified in this way. The method signature is define by the prototype of the method For example, the "const char* libraryName();" have "__C5_char_P1__libraryName" for signature solution for secondary problem: The genwrapper accept new tokens in the configuration to custumize the property. The new PropertyInserter and the CustomPropertyInsertAttribute class has been defined The PropertyRemover has been added to the StdMapReflector The _briefHelp and _detailedHelp variable has been added in PropertyInfo, MethodInfo and ContructorInfo class modification: I have modify the genwrapper files Configuration.cpp Configuration.h add some tokens to custumize the property Doxyfile.template add the comment in the output xml genwrapper.conf customize some property in osg::Geometry RegistryBuilder.h RegistryBuilder.cpp add the process_help function (to extract help from xml) TypeRegister.cpp TypeRegister.h optimize the property detection TypeDesc.h TypeDesc.cpp modify FunctionDesc and PropertyDesc WrapperGenerator.h WrapperGenerator.cpp modify the output I also modify the fallowing osgIntrospection files: include/osgIntrospection/Attributes add the PropertyInserter and the CustomPropertyInsertAttribute class include/osgIntrospection/ConstructorInfo add the _briefHelp and _detailedHelp variable in the ConstructorInfo class add access function for the two new variables (_briefHelp and _detailedHelp) modify the constructor to define the two new variables (_briefHelp and _detailedHelp) include/osgIntrospection/MethodInfo add the _briefHelp and _detailedHelp variable in the MethodInfo class add access function for the two new variables (_briefHelp and _detailedHelp) modify the constructor to define the two new variables (_briefHelp and _detailedHelp) include/osgIntrospection/PropertyInfo add the _briefHelp and _detailedHelp variable in the PropertyInfo class add access function for the two new variables (_briefHelp and _detailedHelp) modify the constructor to define the two new variables (_briefHelp and _detailedHelp) include/osgIntrospection/ReflectionMacro remove unused I_Property* macro modify all I_Method macro to accept the help string modify all I_Method macro to define a MethodInfo signature include/osgIntrospection/Reflector add the PropertyInserter in StdVectorReflector and StdListReflector add the PropertyRemover in the StdMapReflector include/osgIntrospection/StaticMethodInfo modify all StaticMethodInfo* to accept the help in parameter include/osgIntrospection/TypedMethodInfo modify all TypedMethodInfo* to accept the help in parameter include/osgIntrospection/TypedConstructorInfo modify all TypedConstructorInfo* to accept the help in parameter include/osgIntrospection/Type add the _briefHelp and _detailedHelp variable in the Type class "
2006-10-17 23:17:06 +08:00
_is_array(false),
_briefHelp(briefHelp),
_detailedHelp(detailedHelp)
2005-03-14 17:28:31 +08:00
{
}
/// Direct initialization constructor for "array" properties.
/// You must pass the Type object associated to the type that
/// declares the property, the Type object that describes the
/// type of the property's value, the property name and the
From David Callu: " the main problem is the wrapper generation: The PropertyInfo class use MethodInfo class to access to the value. When the property are define with the I_Property* macro, the MethodInfo use by the property to have access to the value are instancied in the I_Property* macro, but there are already instantied by the I_Method* macro before secondary problem: - the function used by the property could no be customized in the genwrapper.conf file - an array property can't insert a value - the std::map reflector (and indexedProperty in general) haven't remove method - about the help in wrapper ... why not ... solution : To use the function define by the I_Method, I add a MethodInfo variable in the I_Method0 macro old macro : #define I_Method0(ret, fn) (\ params.clear(),\ addMethod(new osgIntrospection::TypedMethodIn fo0<reflected_type, ret >(qualifyName(#fn), &reflected_type::fn, params))) new macro : #define I_Method0(ret, fn, signature, briefHelp, detailedHelp) \ params.clear(); \ osgIntrospection::MethodInfo* signature = addMethod(new osgIntrospection::TypedMethodInfo0<reflected_type, ret >(qualifyName(#fn), &reflected_type::fn, params, briefHelp, detailedHelp)); sink(signature) the osgIntrospection::MethodInfo* signature is used by the I_Property macro to define the MethodInfo that it use so for I_Property macro : old macro : #define I_PropertyWithReturnType(t, n, r) \ cap=addProperty(new osgIntrospection::PropertyInfo(osgIntrospection::Reflection::getType(typeid(reflected_type)), osgIntrospection::Reflection::getType(typeid(t)), #n, \ I_Method0(t, get##n), \ I_Method1(r, set##n, IN, t, value))) new macro: #define I_SimpleProperty(t, n, get, set) \ get, \ set)) The genwrapper has been modified in this way. The method signature is define by the prototype of the method For example, the "const char* libraryName();" have "__C5_char_P1__libraryName" for signature solution for secondary problem: The genwrapper accept new tokens in the configuration to custumize the property. The new PropertyInserter and the CustomPropertyInsertAttribute class has been defined The PropertyRemover has been added to the StdMapReflector The _briefHelp and _detailedHelp variable has been added in PropertyInfo, MethodInfo and ContructorInfo class modification: I have modify the genwrapper files Configuration.cpp Configuration.h add some tokens to custumize the property Doxyfile.template add the comment in the output xml genwrapper.conf customize some property in osg::Geometry RegistryBuilder.h RegistryBuilder.cpp add the process_help function (to extract help from xml) TypeRegister.cpp TypeRegister.h optimize the property detection TypeDesc.h TypeDesc.cpp modify FunctionDesc and PropertyDesc WrapperGenerator.h WrapperGenerator.cpp modify the output I also modify the fallowing osgIntrospection files: include/osgIntrospection/Attributes add the PropertyInserter and the CustomPropertyInsertAttribute class include/osgIntrospection/ConstructorInfo add the _briefHelp and _detailedHelp variable in the ConstructorInfo class add access function for the two new variables (_briefHelp and _detailedHelp) modify the constructor to define the two new variables (_briefHelp and _detailedHelp) include/osgIntrospection/MethodInfo add the _briefHelp and _detailedHelp variable in the MethodInfo class add access function for the two new variables (_briefHelp and _detailedHelp) modify the constructor to define the two new variables (_briefHelp and _detailedHelp) include/osgIntrospection/PropertyInfo add the _briefHelp and _detailedHelp variable in the PropertyInfo class add access function for the two new variables (_briefHelp and _detailedHelp) modify the constructor to define the two new variables (_briefHelp and _detailedHelp) include/osgIntrospection/ReflectionMacro remove unused I_Property* macro modify all I_Method macro to accept the help string modify all I_Method macro to define a MethodInfo signature include/osgIntrospection/Reflector add the PropertyInserter in StdVectorReflector and StdListReflector add the PropertyRemover in the StdMapReflector include/osgIntrospection/StaticMethodInfo modify all StaticMethodInfo* to accept the help in parameter include/osgIntrospection/TypedMethodInfo modify all TypedMethodInfo* to accept the help in parameter include/osgIntrospection/TypedConstructorInfo modify all TypedConstructorInfo* to accept the help in parameter include/osgIntrospection/Type add the _briefHelp and _detailedHelp variable in the Type class "
2006-10-17 23:17:06 +08:00
/// getter/setter/counter/adder/insert/remover methods.
2008-12-17 19:00:16 +08:00
PropertyInfo(const Type& declaratiionType, const Type& ptype, const std::string& name, const MethodInfo* getm, const MethodInfo* setm, const MethodInfo* numm, const MethodInfo* addm, const MethodInfo* insm, const MethodInfo* remm, std::string briefHelp = std::string(), std::string detailedHelp = std::string())
: CustomAttributeProvider(),
2008-12-17 19:00:16 +08:00
_declarationType(declaratiionType),
_ptype(ptype),
_name(name),
_getm(getm),
_setm(setm),
_numm(numm),
_addm(addm),
From David Callu: " the main problem is the wrapper generation: The PropertyInfo class use MethodInfo class to access to the value. When the property are define with the I_Property* macro, the MethodInfo use by the property to have access to the value are instancied in the I_Property* macro, but there are already instantied by the I_Method* macro before secondary problem: - the function used by the property could no be customized in the genwrapper.conf file - an array property can't insert a value - the std::map reflector (and indexedProperty in general) haven't remove method - about the help in wrapper ... why not ... solution : To use the function define by the I_Method, I add a MethodInfo variable in the I_Method0 macro old macro : #define I_Method0(ret, fn) (\ params.clear(),\ addMethod(new osgIntrospection::TypedMethodIn fo0<reflected_type, ret >(qualifyName(#fn), &reflected_type::fn, params))) new macro : #define I_Method0(ret, fn, signature, briefHelp, detailedHelp) \ params.clear(); \ osgIntrospection::MethodInfo* signature = addMethod(new osgIntrospection::TypedMethodInfo0<reflected_type, ret >(qualifyName(#fn), &reflected_type::fn, params, briefHelp, detailedHelp)); sink(signature) the osgIntrospection::MethodInfo* signature is used by the I_Property macro to define the MethodInfo that it use so for I_Property macro : old macro : #define I_PropertyWithReturnType(t, n, r) \ cap=addProperty(new osgIntrospection::PropertyInfo(osgIntrospection::Reflection::getType(typeid(reflected_type)), osgIntrospection::Reflection::getType(typeid(t)), #n, \ I_Method0(t, get##n), \ I_Method1(r, set##n, IN, t, value))) new macro: #define I_SimpleProperty(t, n, get, set) \ get, \ set)) The genwrapper has been modified in this way. The method signature is define by the prototype of the method For example, the "const char* libraryName();" have "__C5_char_P1__libraryName" for signature solution for secondary problem: The genwrapper accept new tokens in the configuration to custumize the property. The new PropertyInserter and the CustomPropertyInsertAttribute class has been defined The PropertyRemover has been added to the StdMapReflector The _briefHelp and _detailedHelp variable has been added in PropertyInfo, MethodInfo and ContructorInfo class modification: I have modify the genwrapper files Configuration.cpp Configuration.h add some tokens to custumize the property Doxyfile.template add the comment in the output xml genwrapper.conf customize some property in osg::Geometry RegistryBuilder.h RegistryBuilder.cpp add the process_help function (to extract help from xml) TypeRegister.cpp TypeRegister.h optimize the property detection TypeDesc.h TypeDesc.cpp modify FunctionDesc and PropertyDesc WrapperGenerator.h WrapperGenerator.cpp modify the output I also modify the fallowing osgIntrospection files: include/osgIntrospection/Attributes add the PropertyInserter and the CustomPropertyInsertAttribute class include/osgIntrospection/ConstructorInfo add the _briefHelp and _detailedHelp variable in the ConstructorInfo class add access function for the two new variables (_briefHelp and _detailedHelp) modify the constructor to define the two new variables (_briefHelp and _detailedHelp) include/osgIntrospection/MethodInfo add the _briefHelp and _detailedHelp variable in the MethodInfo class add access function for the two new variables (_briefHelp and _detailedHelp) modify the constructor to define the two new variables (_briefHelp and _detailedHelp) include/osgIntrospection/PropertyInfo add the _briefHelp and _detailedHelp variable in the PropertyInfo class add access function for the two new variables (_briefHelp and _detailedHelp) modify the constructor to define the two new variables (_briefHelp and _detailedHelp) include/osgIntrospection/ReflectionMacro remove unused I_Property* macro modify all I_Method macro to accept the help string modify all I_Method macro to define a MethodInfo signature include/osgIntrospection/Reflector add the PropertyInserter in StdVectorReflector and StdListReflector add the PropertyRemover in the StdMapReflector include/osgIntrospection/StaticMethodInfo modify all StaticMethodInfo* to accept the help in parameter include/osgIntrospection/TypedMethodInfo modify all TypedMethodInfo* to accept the help in parameter include/osgIntrospection/TypedConstructorInfo modify all TypedConstructorInfo* to accept the help in parameter include/osgIntrospection/Type add the _briefHelp and _detailedHelp variable in the Type class "
2006-10-17 23:17:06 +08:00
_insm(insm),
_remm(remm),
_is_array(true),
_briefHelp(briefHelp),
_detailedHelp(detailedHelp)
{
}
/// Direct initialization constructor for indexed properties.
/// You must pass the Type object associated to the class that
/// declares the property, the Type object that describes the
/// type of the property's value, the property name and the
/// getter/setter methods. Either the setter or the getter can
/// be null, meaning a restricted access. If both are null, the
/// user is expected to add a custom accessor attribute to this
/// PropertyInfo object.
/// If the getter method has parameters, the property is considered
/// to be indexed. The same is true if the getter is null and the
/// setter has more than one parameter.
2008-12-17 19:00:16 +08:00
PropertyInfo(const Type& declaratiionType, const Type& ptype, const std::string& name, const MethodInfo* getm, const MethodInfo* setm, const MethodInfo* remm, std::string briefHelp = std::string(), std::string detailedHelp = std::string())
From David Callu: " the main problem is the wrapper generation: The PropertyInfo class use MethodInfo class to access to the value. When the property are define with the I_Property* macro, the MethodInfo use by the property to have access to the value are instancied in the I_Property* macro, but there are already instantied by the I_Method* macro before secondary problem: - the function used by the property could no be customized in the genwrapper.conf file - an array property can't insert a value - the std::map reflector (and indexedProperty in general) haven't remove method - about the help in wrapper ... why not ... solution : To use the function define by the I_Method, I add a MethodInfo variable in the I_Method0 macro old macro : #define I_Method0(ret, fn) (\ params.clear(),\ addMethod(new osgIntrospection::TypedMethodIn fo0<reflected_type, ret >(qualifyName(#fn), &reflected_type::fn, params))) new macro : #define I_Method0(ret, fn, signature, briefHelp, detailedHelp) \ params.clear(); \ osgIntrospection::MethodInfo* signature = addMethod(new osgIntrospection::TypedMethodInfo0<reflected_type, ret >(qualifyName(#fn), &reflected_type::fn, params, briefHelp, detailedHelp)); sink(signature) the osgIntrospection::MethodInfo* signature is used by the I_Property macro to define the MethodInfo that it use so for I_Property macro : old macro : #define I_PropertyWithReturnType(t, n, r) \ cap=addProperty(new osgIntrospection::PropertyInfo(osgIntrospection::Reflection::getType(typeid(reflected_type)), osgIntrospection::Reflection::getType(typeid(t)), #n, \ I_Method0(t, get##n), \ I_Method1(r, set##n, IN, t, value))) new macro: #define I_SimpleProperty(t, n, get, set) \ get, \ set)) The genwrapper has been modified in this way. The method signature is define by the prototype of the method For example, the "const char* libraryName();" have "__C5_char_P1__libraryName" for signature solution for secondary problem: The genwrapper accept new tokens in the configuration to custumize the property. The new PropertyInserter and the CustomPropertyInsertAttribute class has been defined The PropertyRemover has been added to the StdMapReflector The _briefHelp and _detailedHelp variable has been added in PropertyInfo, MethodInfo and ContructorInfo class modification: I have modify the genwrapper files Configuration.cpp Configuration.h add some tokens to custumize the property Doxyfile.template add the comment in the output xml genwrapper.conf customize some property in osg::Geometry RegistryBuilder.h RegistryBuilder.cpp add the process_help function (to extract help from xml) TypeRegister.cpp TypeRegister.h optimize the property detection TypeDesc.h TypeDesc.cpp modify FunctionDesc and PropertyDesc WrapperGenerator.h WrapperGenerator.cpp modify the output I also modify the fallowing osgIntrospection files: include/osgIntrospection/Attributes add the PropertyInserter and the CustomPropertyInsertAttribute class include/osgIntrospection/ConstructorInfo add the _briefHelp and _detailedHelp variable in the ConstructorInfo class add access function for the two new variables (_briefHelp and _detailedHelp) modify the constructor to define the two new variables (_briefHelp and _detailedHelp) include/osgIntrospection/MethodInfo add the _briefHelp and _detailedHelp variable in the MethodInfo class add access function for the two new variables (_briefHelp and _detailedHelp) modify the constructor to define the two new variables (_briefHelp and _detailedHelp) include/osgIntrospection/PropertyInfo add the _briefHelp and _detailedHelp variable in the PropertyInfo class add access function for the two new variables (_briefHelp and _detailedHelp) modify the constructor to define the two new variables (_briefHelp and _detailedHelp) include/osgIntrospection/ReflectionMacro remove unused I_Property* macro modify all I_Method macro to accept the help string modify all I_Method macro to define a MethodInfo signature include/osgIntrospection/Reflector add the PropertyInserter in StdVectorReflector and StdListReflector add the PropertyRemover in the StdMapReflector include/osgIntrospection/StaticMethodInfo modify all StaticMethodInfo* to accept the help in parameter include/osgIntrospection/TypedMethodInfo modify all TypedMethodInfo* to accept the help in parameter include/osgIntrospection/TypedConstructorInfo modify all TypedConstructorInfo* to accept the help in parameter include/osgIntrospection/Type add the _briefHelp and _detailedHelp variable in the Type class "
2006-10-17 23:17:06 +08:00
: CustomAttributeProvider(),
2008-12-17 19:00:16 +08:00
_declarationType(declaratiionType),
From David Callu: " the main problem is the wrapper generation: The PropertyInfo class use MethodInfo class to access to the value. When the property are define with the I_Property* macro, the MethodInfo use by the property to have access to the value are instancied in the I_Property* macro, but there are already instantied by the I_Method* macro before secondary problem: - the function used by the property could no be customized in the genwrapper.conf file - an array property can't insert a value - the std::map reflector (and indexedProperty in general) haven't remove method - about the help in wrapper ... why not ... solution : To use the function define by the I_Method, I add a MethodInfo variable in the I_Method0 macro old macro : #define I_Method0(ret, fn) (\ params.clear(),\ addMethod(new osgIntrospection::TypedMethodIn fo0<reflected_type, ret >(qualifyName(#fn), &reflected_type::fn, params))) new macro : #define I_Method0(ret, fn, signature, briefHelp, detailedHelp) \ params.clear(); \ osgIntrospection::MethodInfo* signature = addMethod(new osgIntrospection::TypedMethodInfo0<reflected_type, ret >(qualifyName(#fn), &reflected_type::fn, params, briefHelp, detailedHelp)); sink(signature) the osgIntrospection::MethodInfo* signature is used by the I_Property macro to define the MethodInfo that it use so for I_Property macro : old macro : #define I_PropertyWithReturnType(t, n, r) \ cap=addProperty(new osgIntrospection::PropertyInfo(osgIntrospection::Reflection::getType(typeid(reflected_type)), osgIntrospection::Reflection::getType(typeid(t)), #n, \ I_Method0(t, get##n), \ I_Method1(r, set##n, IN, t, value))) new macro: #define I_SimpleProperty(t, n, get, set) \ get, \ set)) The genwrapper has been modified in this way. The method signature is define by the prototype of the method For example, the "const char* libraryName();" have "__C5_char_P1__libraryName" for signature solution for secondary problem: The genwrapper accept new tokens in the configuration to custumize the property. The new PropertyInserter and the CustomPropertyInsertAttribute class has been defined The PropertyRemover has been added to the StdMapReflector The _briefHelp and _detailedHelp variable has been added in PropertyInfo, MethodInfo and ContructorInfo class modification: I have modify the genwrapper files Configuration.cpp Configuration.h add some tokens to custumize the property Doxyfile.template add the comment in the output xml genwrapper.conf customize some property in osg::Geometry RegistryBuilder.h RegistryBuilder.cpp add the process_help function (to extract help from xml) TypeRegister.cpp TypeRegister.h optimize the property detection TypeDesc.h TypeDesc.cpp modify FunctionDesc and PropertyDesc WrapperGenerator.h WrapperGenerator.cpp modify the output I also modify the fallowing osgIntrospection files: include/osgIntrospection/Attributes add the PropertyInserter and the CustomPropertyInsertAttribute class include/osgIntrospection/ConstructorInfo add the _briefHelp and _detailedHelp variable in the ConstructorInfo class add access function for the two new variables (_briefHelp and _detailedHelp) modify the constructor to define the two new variables (_briefHelp and _detailedHelp) include/osgIntrospection/MethodInfo add the _briefHelp and _detailedHelp variable in the MethodInfo class add access function for the two new variables (_briefHelp and _detailedHelp) modify the constructor to define the two new variables (_briefHelp and _detailedHelp) include/osgIntrospection/PropertyInfo add the _briefHelp and _detailedHelp variable in the PropertyInfo class add access function for the two new variables (_briefHelp and _detailedHelp) modify the constructor to define the two new variables (_briefHelp and _detailedHelp) include/osgIntrospection/ReflectionMacro remove unused I_Property* macro modify all I_Method macro to accept the help string modify all I_Method macro to define a MethodInfo signature include/osgIntrospection/Reflector add the PropertyInserter in StdVectorReflector and StdListReflector add the PropertyRemover in the StdMapReflector include/osgIntrospection/StaticMethodInfo modify all StaticMethodInfo* to accept the help in parameter include/osgIntrospection/TypedMethodInfo modify all TypedMethodInfo* to accept the help in parameter include/osgIntrospection/TypedConstructorInfo modify all TypedConstructorInfo* to accept the help in parameter include/osgIntrospection/Type add the _briefHelp and _detailedHelp variable in the Type class "
2006-10-17 23:17:06 +08:00
_ptype(ptype),
_name(name),
_getm(getm),
_setm(setm),
_numm(0),
_addm(0),
_insm(0),
_remm(remm),
From David Callu: " the main problem is the wrapper generation: The PropertyInfo class use MethodInfo class to access to the value. When the property are define with the I_Property* macro, the MethodInfo use by the property to have access to the value are instancied in the I_Property* macro, but there are already instantied by the I_Method* macro before secondary problem: - the function used by the property could no be customized in the genwrapper.conf file - an array property can't insert a value - the std::map reflector (and indexedProperty in general) haven't remove method - about the help in wrapper ... why not ... solution : To use the function define by the I_Method, I add a MethodInfo variable in the I_Method0 macro old macro : #define I_Method0(ret, fn) (\ params.clear(),\ addMethod(new osgIntrospection::TypedMethodIn fo0<reflected_type, ret >(qualifyName(#fn), &reflected_type::fn, params))) new macro : #define I_Method0(ret, fn, signature, briefHelp, detailedHelp) \ params.clear(); \ osgIntrospection::MethodInfo* signature = addMethod(new osgIntrospection::TypedMethodInfo0<reflected_type, ret >(qualifyName(#fn), &reflected_type::fn, params, briefHelp, detailedHelp)); sink(signature) the osgIntrospection::MethodInfo* signature is used by the I_Property macro to define the MethodInfo that it use so for I_Property macro : old macro : #define I_PropertyWithReturnType(t, n, r) \ cap=addProperty(new osgIntrospection::PropertyInfo(osgIntrospection::Reflection::getType(typeid(reflected_type)), osgIntrospection::Reflection::getType(typeid(t)), #n, \ I_Method0(t, get##n), \ I_Method1(r, set##n, IN, t, value))) new macro: #define I_SimpleProperty(t, n, get, set) \ get, \ set)) The genwrapper has been modified in this way. The method signature is define by the prototype of the method For example, the "const char* libraryName();" have "__C5_char_P1__libraryName" for signature solution for secondary problem: The genwrapper accept new tokens in the configuration to custumize the property. The new PropertyInserter and the CustomPropertyInsertAttribute class has been defined The PropertyRemover has been added to the StdMapReflector The _briefHelp and _detailedHelp variable has been added in PropertyInfo, MethodInfo and ContructorInfo class modification: I have modify the genwrapper files Configuration.cpp Configuration.h add some tokens to custumize the property Doxyfile.template add the comment in the output xml genwrapper.conf customize some property in osg::Geometry RegistryBuilder.h RegistryBuilder.cpp add the process_help function (to extract help from xml) TypeRegister.cpp TypeRegister.h optimize the property detection TypeDesc.h TypeDesc.cpp modify FunctionDesc and PropertyDesc WrapperGenerator.h WrapperGenerator.cpp modify the output I also modify the fallowing osgIntrospection files: include/osgIntrospection/Attributes add the PropertyInserter and the CustomPropertyInsertAttribute class include/osgIntrospection/ConstructorInfo add the _briefHelp and _detailedHelp variable in the ConstructorInfo class add access function for the two new variables (_briefHelp and _detailedHelp) modify the constructor to define the two new variables (_briefHelp and _detailedHelp) include/osgIntrospection/MethodInfo add the _briefHelp and _detailedHelp variable in the MethodInfo class add access function for the two new variables (_briefHelp and _detailedHelp) modify the constructor to define the two new variables (_briefHelp and _detailedHelp) include/osgIntrospection/PropertyInfo add the _briefHelp and _detailedHelp variable in the PropertyInfo class add access function for the two new variables (_briefHelp and _detailedHelp) modify the constructor to define the two new variables (_briefHelp and _detailedHelp) include/osgIntrospection/ReflectionMacro remove unused I_Property* macro modify all I_Method macro to accept the help string modify all I_Method macro to define a MethodInfo signature include/osgIntrospection/Reflector add the PropertyInserter in StdVectorReflector and StdListReflector add the PropertyRemover in the StdMapReflector include/osgIntrospection/StaticMethodInfo modify all StaticMethodInfo* to accept the help in parameter include/osgIntrospection/TypedMethodInfo modify all TypedMethodInfo* to accept the help in parameter include/osgIntrospection/TypedConstructorInfo modify all TypedConstructorInfo* to accept the help in parameter include/osgIntrospection/Type add the _briefHelp and _detailedHelp variable in the Type class "
2006-10-17 23:17:06 +08:00
_is_array(false),
_briefHelp(briefHelp),
_detailedHelp(detailedHelp)
2005-03-14 17:28:31 +08:00
{
From David Callu: " the main problem is the wrapper generation: The PropertyInfo class use MethodInfo class to access to the value. When the property are define with the I_Property* macro, the MethodInfo use by the property to have access to the value are instancied in the I_Property* macro, but there are already instantied by the I_Method* macro before secondary problem: - the function used by the property could no be customized in the genwrapper.conf file - an array property can't insert a value - the std::map reflector (and indexedProperty in general) haven't remove method - about the help in wrapper ... why not ... solution : To use the function define by the I_Method, I add a MethodInfo variable in the I_Method0 macro old macro : #define I_Method0(ret, fn) (\ params.clear(),\ addMethod(new osgIntrospection::TypedMethodIn fo0<reflected_type, ret >(qualifyName(#fn), &reflected_type::fn, params))) new macro : #define I_Method0(ret, fn, signature, briefHelp, detailedHelp) \ params.clear(); \ osgIntrospection::MethodInfo* signature = addMethod(new osgIntrospection::TypedMethodInfo0<reflected_type, ret >(qualifyName(#fn), &reflected_type::fn, params, briefHelp, detailedHelp)); sink(signature) the osgIntrospection::MethodInfo* signature is used by the I_Property macro to define the MethodInfo that it use so for I_Property macro : old macro : #define I_PropertyWithReturnType(t, n, r) \ cap=addProperty(new osgIntrospection::PropertyInfo(osgIntrospection::Reflection::getType(typeid(reflected_type)), osgIntrospection::Reflection::getType(typeid(t)), #n, \ I_Method0(t, get##n), \ I_Method1(r, set##n, IN, t, value))) new macro: #define I_SimpleProperty(t, n, get, set) \ get, \ set)) The genwrapper has been modified in this way. The method signature is define by the prototype of the method For example, the "const char* libraryName();" have "__C5_char_P1__libraryName" for signature solution for secondary problem: The genwrapper accept new tokens in the configuration to custumize the property. The new PropertyInserter and the CustomPropertyInsertAttribute class has been defined The PropertyRemover has been added to the StdMapReflector The _briefHelp and _detailedHelp variable has been added in PropertyInfo, MethodInfo and ContructorInfo class modification: I have modify the genwrapper files Configuration.cpp Configuration.h add some tokens to custumize the property Doxyfile.template add the comment in the output xml genwrapper.conf customize some property in osg::Geometry RegistryBuilder.h RegistryBuilder.cpp add the process_help function (to extract help from xml) TypeRegister.cpp TypeRegister.h optimize the property detection TypeDesc.h TypeDesc.cpp modify FunctionDesc and PropertyDesc WrapperGenerator.h WrapperGenerator.cpp modify the output I also modify the fallowing osgIntrospection files: include/osgIntrospection/Attributes add the PropertyInserter and the CustomPropertyInsertAttribute class include/osgIntrospection/ConstructorInfo add the _briefHelp and _detailedHelp variable in the ConstructorInfo class add access function for the two new variables (_briefHelp and _detailedHelp) modify the constructor to define the two new variables (_briefHelp and _detailedHelp) include/osgIntrospection/MethodInfo add the _briefHelp and _detailedHelp variable in the MethodInfo class add access function for the two new variables (_briefHelp and _detailedHelp) modify the constructor to define the two new variables (_briefHelp and _detailedHelp) include/osgIntrospection/PropertyInfo add the _briefHelp and _detailedHelp variable in the PropertyInfo class add access function for the two new variables (_briefHelp and _detailedHelp) modify the constructor to define the two new variables (_briefHelp and _detailedHelp) include/osgIntrospection/ReflectionMacro remove unused I_Property* macro modify all I_Method macro to accept the help string modify all I_Method macro to define a MethodInfo signature include/osgIntrospection/Reflector add the PropertyInserter in StdVectorReflector and StdListReflector add the PropertyRemover in the StdMapReflector include/osgIntrospection/StaticMethodInfo modify all StaticMethodInfo* to accept the help in parameter include/osgIntrospection/TypedMethodInfo modify all TypedMethodInfo* to accept the help in parameter include/osgIntrospection/TypedConstructorInfo modify all TypedConstructorInfo* to accept the help in parameter include/osgIntrospection/Type add the _briefHelp and _detailedHelp variable in the Type class "
2006-10-17 23:17:06 +08:00
if (_getm)
{
for (ParameterInfoList::size_type i=0; i<_getm->getParameters().size(); ++i)
_indices.push_back(_getm->getParameters().at(i));
}
else
{
if (_setm)
{
for (ParameterInfoList::size_type i=0; i<(_setm->getParameters().size()-1); ++i)
_indices.push_back(_setm->getParameters().at(i));
}
}
2005-03-14 17:28:31 +08:00
}
/// Returns the number of indices
inline int getNumIndices() const
{
return static_cast<int>(getIndexParameters().size());
}
/// Returns the name of the property being described.
inline virtual const std::string& getName() const
2005-03-14 17:28:31 +08:00
{
return _name;
2005-03-14 17:28:31 +08:00
}
From David Callu: " the main problem is the wrapper generation: The PropertyInfo class use MethodInfo class to access to the value. When the property are define with the I_Property* macro, the MethodInfo use by the property to have access to the value are instancied in the I_Property* macro, but there are already instantied by the I_Method* macro before secondary problem: - the function used by the property could no be customized in the genwrapper.conf file - an array property can't insert a value - the std::map reflector (and indexedProperty in general) haven't remove method - about the help in wrapper ... why not ... solution : To use the function define by the I_Method, I add a MethodInfo variable in the I_Method0 macro old macro : #define I_Method0(ret, fn) (\ params.clear(),\ addMethod(new osgIntrospection::TypedMethodIn fo0<reflected_type, ret >(qualifyName(#fn), &reflected_type::fn, params))) new macro : #define I_Method0(ret, fn, signature, briefHelp, detailedHelp) \ params.clear(); \ osgIntrospection::MethodInfo* signature = addMethod(new osgIntrospection::TypedMethodInfo0<reflected_type, ret >(qualifyName(#fn), &reflected_type::fn, params, briefHelp, detailedHelp)); sink(signature) the osgIntrospection::MethodInfo* signature is used by the I_Property macro to define the MethodInfo that it use so for I_Property macro : old macro : #define I_PropertyWithReturnType(t, n, r) \ cap=addProperty(new osgIntrospection::PropertyInfo(osgIntrospection::Reflection::getType(typeid(reflected_type)), osgIntrospection::Reflection::getType(typeid(t)), #n, \ I_Method0(t, get##n), \ I_Method1(r, set##n, IN, t, value))) new macro: #define I_SimpleProperty(t, n, get, set) \ get, \ set)) The genwrapper has been modified in this way. The method signature is define by the prototype of the method For example, the "const char* libraryName();" have "__C5_char_P1__libraryName" for signature solution for secondary problem: The genwrapper accept new tokens in the configuration to custumize the property. The new PropertyInserter and the CustomPropertyInsertAttribute class has been defined The PropertyRemover has been added to the StdMapReflector The _briefHelp and _detailedHelp variable has been added in PropertyInfo, MethodInfo and ContructorInfo class modification: I have modify the genwrapper files Configuration.cpp Configuration.h add some tokens to custumize the property Doxyfile.template add the comment in the output xml genwrapper.conf customize some property in osg::Geometry RegistryBuilder.h RegistryBuilder.cpp add the process_help function (to extract help from xml) TypeRegister.cpp TypeRegister.h optimize the property detection TypeDesc.h TypeDesc.cpp modify FunctionDesc and PropertyDesc WrapperGenerator.h WrapperGenerator.cpp modify the output I also modify the fallowing osgIntrospection files: include/osgIntrospection/Attributes add the PropertyInserter and the CustomPropertyInsertAttribute class include/osgIntrospection/ConstructorInfo add the _briefHelp and _detailedHelp variable in the ConstructorInfo class add access function for the two new variables (_briefHelp and _detailedHelp) modify the constructor to define the two new variables (_briefHelp and _detailedHelp) include/osgIntrospection/MethodInfo add the _briefHelp and _detailedHelp variable in the MethodInfo class add access function for the two new variables (_briefHelp and _detailedHelp) modify the constructor to define the two new variables (_briefHelp and _detailedHelp) include/osgIntrospection/PropertyInfo add the _briefHelp and _detailedHelp variable in the PropertyInfo class add access function for the two new variables (_briefHelp and _detailedHelp) modify the constructor to define the two new variables (_briefHelp and _detailedHelp) include/osgIntrospection/ReflectionMacro remove unused I_Property* macro modify all I_Method macro to accept the help string modify all I_Method macro to define a MethodInfo signature include/osgIntrospection/Reflector add the PropertyInserter in StdVectorReflector and StdListReflector add the PropertyRemover in the StdMapReflector include/osgIntrospection/StaticMethodInfo modify all StaticMethodInfo* to accept the help in parameter include/osgIntrospection/TypedMethodInfo modify all TypedMethodInfo* to accept the help in parameter include/osgIntrospection/TypedConstructorInfo modify all TypedConstructorInfo* to accept the help in parameter include/osgIntrospection/Type add the _briefHelp and _detailedHelp variable in the Type class "
2006-10-17 23:17:06 +08:00
/// Returns the brief help of the property being described.
inline virtual const std::string& getBriefHelp() const
{
return _briefHelp;
}
/// Returns the detailed help of the property being described.
inline virtual const std::string& getDetailedHelp() const
{
return _detailedHelp;
}
2005-03-14 17:28:31 +08:00
/// Returns the type that declares the property.
inline virtual const Type& getDeclaringType() const
2005-03-14 17:28:31 +08:00
{
2008-12-17 19:00:16 +08:00
return _declarationType;
2005-03-14 17:28:31 +08:00
}
/// Returns the type of the reflected property.
inline const Type& getPropertyType() const
2005-03-14 17:28:31 +08:00
{
const PropertyTypeAttribute *pta = getAttribute<PropertyTypeAttribute>(false);
if (pta) return pta->getPropertyType();
return _ptype;
2005-03-14 17:28:31 +08:00
}
/// Returns the getter method.
inline const MethodInfo* getGetMethod() const
2005-03-14 17:28:31 +08:00
{
return _getm;
2005-03-14 17:28:31 +08:00
}
/// Returns the setter method.
inline const MethodInfo* getSetMethod() const
2005-03-14 17:28:31 +08:00
{
return _setm;
2005-03-14 17:28:31 +08:00
}
/// Returns the counter method.
inline const MethodInfo* getCountMethod() const
2005-03-14 17:28:31 +08:00
{
return _numm;
2005-03-14 17:28:31 +08:00
}
/// Returns the adder method.
inline const MethodInfo* getAddMethod() const
2005-03-14 17:28:31 +08:00
{
return _addm;
2005-03-14 17:28:31 +08:00
}
From David Callu: " the main problem is the wrapper generation: The PropertyInfo class use MethodInfo class to access to the value. When the property are define with the I_Property* macro, the MethodInfo use by the property to have access to the value are instancied in the I_Property* macro, but there are already instantied by the I_Method* macro before secondary problem: - the function used by the property could no be customized in the genwrapper.conf file - an array property can't insert a value - the std::map reflector (and indexedProperty in general) haven't remove method - about the help in wrapper ... why not ... solution : To use the function define by the I_Method, I add a MethodInfo variable in the I_Method0 macro old macro : #define I_Method0(ret, fn) (\ params.clear(),\ addMethod(new osgIntrospection::TypedMethodIn fo0<reflected_type, ret >(qualifyName(#fn), &reflected_type::fn, params))) new macro : #define I_Method0(ret, fn, signature, briefHelp, detailedHelp) \ params.clear(); \ osgIntrospection::MethodInfo* signature = addMethod(new osgIntrospection::TypedMethodInfo0<reflected_type, ret >(qualifyName(#fn), &reflected_type::fn, params, briefHelp, detailedHelp)); sink(signature) the osgIntrospection::MethodInfo* signature is used by the I_Property macro to define the MethodInfo that it use so for I_Property macro : old macro : #define I_PropertyWithReturnType(t, n, r) \ cap=addProperty(new osgIntrospection::PropertyInfo(osgIntrospection::Reflection::getType(typeid(reflected_type)), osgIntrospection::Reflection::getType(typeid(t)), #n, \ I_Method0(t, get##n), \ I_Method1(r, set##n, IN, t, value))) new macro: #define I_SimpleProperty(t, n, get, set) \ get, \ set)) The genwrapper has been modified in this way. The method signature is define by the prototype of the method For example, the "const char* libraryName();" have "__C5_char_P1__libraryName" for signature solution for secondary problem: The genwrapper accept new tokens in the configuration to custumize the property. The new PropertyInserter and the CustomPropertyInsertAttribute class has been defined The PropertyRemover has been added to the StdMapReflector The _briefHelp and _detailedHelp variable has been added in PropertyInfo, MethodInfo and ContructorInfo class modification: I have modify the genwrapper files Configuration.cpp Configuration.h add some tokens to custumize the property Doxyfile.template add the comment in the output xml genwrapper.conf customize some property in osg::Geometry RegistryBuilder.h RegistryBuilder.cpp add the process_help function (to extract help from xml) TypeRegister.cpp TypeRegister.h optimize the property detection TypeDesc.h TypeDesc.cpp modify FunctionDesc and PropertyDesc WrapperGenerator.h WrapperGenerator.cpp modify the output I also modify the fallowing osgIntrospection files: include/osgIntrospection/Attributes add the PropertyInserter and the CustomPropertyInsertAttribute class include/osgIntrospection/ConstructorInfo add the _briefHelp and _detailedHelp variable in the ConstructorInfo class add access function for the two new variables (_briefHelp and _detailedHelp) modify the constructor to define the two new variables (_briefHelp and _detailedHelp) include/osgIntrospection/MethodInfo add the _briefHelp and _detailedHelp variable in the MethodInfo class add access function for the two new variables (_briefHelp and _detailedHelp) modify the constructor to define the two new variables (_briefHelp and _detailedHelp) include/osgIntrospection/PropertyInfo add the _briefHelp and _detailedHelp variable in the PropertyInfo class add access function for the two new variables (_briefHelp and _detailedHelp) modify the constructor to define the two new variables (_briefHelp and _detailedHelp) include/osgIntrospection/ReflectionMacro remove unused I_Property* macro modify all I_Method macro to accept the help string modify all I_Method macro to define a MethodInfo signature include/osgIntrospection/Reflector add the PropertyInserter in StdVectorReflector and StdListReflector add the PropertyRemover in the StdMapReflector include/osgIntrospection/StaticMethodInfo modify all StaticMethodInfo* to accept the help in parameter include/osgIntrospection/TypedMethodInfo modify all TypedMethodInfo* to accept the help in parameter include/osgIntrospection/TypedConstructorInfo modify all TypedConstructorInfo* to accept the help in parameter include/osgIntrospection/Type add the _briefHelp and _detailedHelp variable in the Type class "
2006-10-17 23:17:06 +08:00
/// Returns the insert method.
inline const MethodInfo* getInsertMethod() const
{
return _insm;
}
/// Returns the remover method.
inline const MethodInfo* getRemoveMethod() const
{
return _remm;
}
2005-03-14 17:28:31 +08:00
/// Returns whether the property's value can be retrieved.
inline bool canGet() const
{
return (_getm != 0) || isDefined<CustomPropertyGetAttribute>(false);
2005-03-14 17:28:31 +08:00
}
/// Returns whether the property's value can be set.
inline bool canSet() const
{
return _setm != 0 || isDefined<CustomPropertySetAttribute>(false);
2005-03-14 17:28:31 +08:00
}
/// Returns whether the property's array of values can be counted.
inline bool canCount() const
{
return _numm != 0 || isDefined<CustomPropertyCountAttribute>(false);
2005-03-14 17:28:31 +08:00
}
/// Returns whether items can be added to the array property.
inline bool canAdd() const
{
return _addm != 0 || isDefined<CustomPropertyAddAttribute>(false);
2005-03-14 17:28:31 +08:00
}
From David Callu: " the main problem is the wrapper generation: The PropertyInfo class use MethodInfo class to access to the value. When the property are define with the I_Property* macro, the MethodInfo use by the property to have access to the value are instancied in the I_Property* macro, but there are already instantied by the I_Method* macro before secondary problem: - the function used by the property could no be customized in the genwrapper.conf file - an array property can't insert a value - the std::map reflector (and indexedProperty in general) haven't remove method - about the help in wrapper ... why not ... solution : To use the function define by the I_Method, I add a MethodInfo variable in the I_Method0 macro old macro : #define I_Method0(ret, fn) (\ params.clear(),\ addMethod(new osgIntrospection::TypedMethodIn fo0<reflected_type, ret >(qualifyName(#fn), &reflected_type::fn, params))) new macro : #define I_Method0(ret, fn, signature, briefHelp, detailedHelp) \ params.clear(); \ osgIntrospection::MethodInfo* signature = addMethod(new osgIntrospection::TypedMethodInfo0<reflected_type, ret >(qualifyName(#fn), &reflected_type::fn, params, briefHelp, detailedHelp)); sink(signature) the osgIntrospection::MethodInfo* signature is used by the I_Property macro to define the MethodInfo that it use so for I_Property macro : old macro : #define I_PropertyWithReturnType(t, n, r) \ cap=addProperty(new osgIntrospection::PropertyInfo(osgIntrospection::Reflection::getType(typeid(reflected_type)), osgIntrospection::Reflection::getType(typeid(t)), #n, \ I_Method0(t, get##n), \ I_Method1(r, set##n, IN, t, value))) new macro: #define I_SimpleProperty(t, n, get, set) \ get, \ set)) The genwrapper has been modified in this way. The method signature is define by the prototype of the method For example, the "const char* libraryName();" have "__C5_char_P1__libraryName" for signature solution for secondary problem: The genwrapper accept new tokens in the configuration to custumize the property. The new PropertyInserter and the CustomPropertyInsertAttribute class has been defined The PropertyRemover has been added to the StdMapReflector The _briefHelp and _detailedHelp variable has been added in PropertyInfo, MethodInfo and ContructorInfo class modification: I have modify the genwrapper files Configuration.cpp Configuration.h add some tokens to custumize the property Doxyfile.template add the comment in the output xml genwrapper.conf customize some property in osg::Geometry RegistryBuilder.h RegistryBuilder.cpp add the process_help function (to extract help from xml) TypeRegister.cpp TypeRegister.h optimize the property detection TypeDesc.h TypeDesc.cpp modify FunctionDesc and PropertyDesc WrapperGenerator.h WrapperGenerator.cpp modify the output I also modify the fallowing osgIntrospection files: include/osgIntrospection/Attributes add the PropertyInserter and the CustomPropertyInsertAttribute class include/osgIntrospection/ConstructorInfo add the _briefHelp and _detailedHelp variable in the ConstructorInfo class add access function for the two new variables (_briefHelp and _detailedHelp) modify the constructor to define the two new variables (_briefHelp and _detailedHelp) include/osgIntrospection/MethodInfo add the _briefHelp and _detailedHelp variable in the MethodInfo class add access function for the two new variables (_briefHelp and _detailedHelp) modify the constructor to define the two new variables (_briefHelp and _detailedHelp) include/osgIntrospection/PropertyInfo add the _briefHelp and _detailedHelp variable in the PropertyInfo class add access function for the two new variables (_briefHelp and _detailedHelp) modify the constructor to define the two new variables (_briefHelp and _detailedHelp) include/osgIntrospection/ReflectionMacro remove unused I_Property* macro modify all I_Method macro to accept the help string modify all I_Method macro to define a MethodInfo signature include/osgIntrospection/Reflector add the PropertyInserter in StdVectorReflector and StdListReflector add the PropertyRemover in the StdMapReflector include/osgIntrospection/StaticMethodInfo modify all StaticMethodInfo* to accept the help in parameter include/osgIntrospection/TypedMethodInfo modify all TypedMethodInfo* to accept the help in parameter include/osgIntrospection/TypedConstructorInfo modify all TypedConstructorInfo* to accept the help in parameter include/osgIntrospection/Type add the _briefHelp and _detailedHelp variable in the Type class "
2006-10-17 23:17:06 +08:00
/// Returns whether items can be insert to the array property.
inline bool canInsert() const
{
return _insm != 0 || isDefined<CustomPropertyInsertAttribute>(false);
}
/// Returns whether items can be removed from the array property.
inline bool canRemove() const
{
return _remm != 0 || isDefined<CustomPropertyRemoveAttribute>(false);
}
From David Callu: " the main problem is the wrapper generation: The PropertyInfo class use MethodInfo class to access to the value. When the property are define with the I_Property* macro, the MethodInfo use by the property to have access to the value are instancied in the I_Property* macro, but there are already instantied by the I_Method* macro before secondary problem: - the function used by the property could no be customized in the genwrapper.conf file - an array property can't insert a value - the std::map reflector (and indexedProperty in general) haven't remove method - about the help in wrapper ... why not ... solution : To use the function define by the I_Method, I add a MethodInfo variable in the I_Method0 macro old macro : #define I_Method0(ret, fn) (\ params.clear(),\ addMethod(new osgIntrospection::TypedMethodIn fo0<reflected_type, ret >(qualifyName(#fn), &reflected_type::fn, params))) new macro : #define I_Method0(ret, fn, signature, briefHelp, detailedHelp) \ params.clear(); \ osgIntrospection::MethodInfo* signature = addMethod(new osgIntrospection::TypedMethodInfo0<reflected_type, ret >(qualifyName(#fn), &reflected_type::fn, params, briefHelp, detailedHelp)); sink(signature) the osgIntrospection::MethodInfo* signature is used by the I_Property macro to define the MethodInfo that it use so for I_Property macro : old macro : #define I_PropertyWithReturnType(t, n, r) \ cap=addProperty(new osgIntrospection::PropertyInfo(osgIntrospection::Reflection::getType(typeid(reflected_type)), osgIntrospection::Reflection::getType(typeid(t)), #n, \ I_Method0(t, get##n), \ I_Method1(r, set##n, IN, t, value))) new macro: #define I_SimpleProperty(t, n, get, set) \ get, \ set)) The genwrapper has been modified in this way. The method signature is define by the prototype of the method For example, the "const char* libraryName();" have "__C5_char_P1__libraryName" for signature solution for secondary problem: The genwrapper accept new tokens in the configuration to custumize the property. The new PropertyInserter and the CustomPropertyInsertAttribute class has been defined The PropertyRemover has been added to the StdMapReflector The _briefHelp and _detailedHelp variable has been added in PropertyInfo, MethodInfo and ContructorInfo class modification: I have modify the genwrapper files Configuration.cpp Configuration.h add some tokens to custumize the property Doxyfile.template add the comment in the output xml genwrapper.conf customize some property in osg::Geometry RegistryBuilder.h RegistryBuilder.cpp add the process_help function (to extract help from xml) TypeRegister.cpp TypeRegister.h optimize the property detection TypeDesc.h TypeDesc.cpp modify FunctionDesc and PropertyDesc WrapperGenerator.h WrapperGenerator.cpp modify the output I also modify the fallowing osgIntrospection files: include/osgIntrospection/Attributes add the PropertyInserter and the CustomPropertyInsertAttribute class include/osgIntrospection/ConstructorInfo add the _briefHelp and _detailedHelp variable in the ConstructorInfo class add access function for the two new variables (_briefHelp and _detailedHelp) modify the constructor to define the two new variables (_briefHelp and _detailedHelp) include/osgIntrospection/MethodInfo add the _briefHelp and _detailedHelp variable in the MethodInfo class add access function for the two new variables (_briefHelp and _detailedHelp) modify the constructor to define the two new variables (_briefHelp and _detailedHelp) include/osgIntrospection/PropertyInfo add the _briefHelp and _detailedHelp variable in the PropertyInfo class add access function for the two new variables (_briefHelp and _detailedHelp) modify the constructor to define the two new variables (_briefHelp and _detailedHelp) include/osgIntrospection/ReflectionMacro remove unused I_Property* macro modify all I_Method macro to accept the help string modify all I_Method macro to define a MethodInfo signature include/osgIntrospection/Reflector add the PropertyInserter in StdVectorReflector and StdListReflector add the PropertyRemover in the StdMapReflector include/osgIntrospection/StaticMethodInfo modify all StaticMethodInfo* to accept the help in parameter include/osgIntrospection/TypedMethodInfo modify all TypedMethodInfo* to accept the help in parameter include/osgIntrospection/TypedConstructorInfo modify all TypedConstructorInfo* to accept the help in parameter include/osgIntrospection/Type add the _briefHelp and _detailedHelp variable in the Type class "
2006-10-17 23:17:06 +08:00
2005-03-14 17:28:31 +08:00
/// Returns whether the property is simple.
inline bool isSimple() const
{
return !isIndexed() && !isArray();
}
/// Returns whether the property is indexed.
inline bool isIndexed() const
{
return getNumIndices() > 0;
}
/// Returns whether the property is an array.
inline bool isArray() const
{
return _is_array;
2005-03-14 17:28:31 +08:00
}
/// Returns the list of index parameters.
/// If the property is not indexed, this list is empty. If neither
/// the get method nor the set method are defined, this list is
/// empty unless a custom indexing attribute is defined.
const ParameterInfoList& getIndexParameters() const;
2005-03-14 17:28:31 +08:00
/// Returns a list of valid values that can be used for the specified
/// index. If a custom indexing attribute is defined for this property,
/// then it will be queried for the index set, otherwise the index
/// will be treated as an enumeration and the set of enumeration
/// values will be returned.
void getIndexValueSet(int whichindex, const Value& instance, ValueList& values) const;
2005-03-14 17:28:31 +08:00
/// Invokes the getter method on the given const instance and
2005-03-14 17:28:31 +08:00
/// returns the property's value. If a custom getter attribute
/// is defined, it will be invoked instead.
Value getValue(const Value& instance) const;
2005-03-14 17:28:31 +08:00
/// Invokes the getter method on the given instance and
/// returns the property's value. If a custom getter attribute
/// is defined, it will be invoked instead.
Value getValue(Value& instance) const;
2005-03-14 17:28:31 +08:00
/// Invokes the setter method on the given instance and
/// sets the property's value. If a custom setter attribute
/// is defined, it will be invoked instead.
void setValue(Value& instance, const Value& value) const;
2005-03-14 17:28:31 +08:00
/// Invokes the getter method on the given const instance passing a
/// list of indices and returns the indexed property's value. If a
/// custom getter attribute is defined, it will be invoked instead.
Value getIndexedValue(Value& instance, ValueList& indices) const;
2005-03-14 17:28:31 +08:00
/// Invokes the getter method on the given instance passing a list
/// of indices and returns the indexed property's value. If a custom
/// getter attribute is defined, it will be invoked instead.
Value getIndexedValue(const Value& instance, ValueList& indices) const;
2005-03-14 17:28:31 +08:00
/// Invokes the setter method on the given instance passing a list
/// of indices and sets the indexed property's value. If a custom
/// setter attribute is defined, it will be invoked instead.
void setIndexedValue(Value& instance, ValueList& indices, const Value& value) const;
2005-03-14 17:28:31 +08:00
From David Callu: " the main problem is the wrapper generation: The PropertyInfo class use MethodInfo class to access to the value. When the property are define with the I_Property* macro, the MethodInfo use by the property to have access to the value are instancied in the I_Property* macro, but there are already instantied by the I_Method* macro before secondary problem: - the function used by the property could no be customized in the genwrapper.conf file - an array property can't insert a value - the std::map reflector (and indexedProperty in general) haven't remove method - about the help in wrapper ... why not ... solution : To use the function define by the I_Method, I add a MethodInfo variable in the I_Method0 macro old macro : #define I_Method0(ret, fn) (\ params.clear(),\ addMethod(new osgIntrospection::TypedMethodIn fo0<reflected_type, ret >(qualifyName(#fn), &reflected_type::fn, params))) new macro : #define I_Method0(ret, fn, signature, briefHelp, detailedHelp) \ params.clear(); \ osgIntrospection::MethodInfo* signature = addMethod(new osgIntrospection::TypedMethodInfo0<reflected_type, ret >(qualifyName(#fn), &reflected_type::fn, params, briefHelp, detailedHelp)); sink(signature) the osgIntrospection::MethodInfo* signature is used by the I_Property macro to define the MethodInfo that it use so for I_Property macro : old macro : #define I_PropertyWithReturnType(t, n, r) \ cap=addProperty(new osgIntrospection::PropertyInfo(osgIntrospection::Reflection::getType(typeid(reflected_type)), osgIntrospection::Reflection::getType(typeid(t)), #n, \ I_Method0(t, get##n), \ I_Method1(r, set##n, IN, t, value))) new macro: #define I_SimpleProperty(t, n, get, set) \ get, \ set)) The genwrapper has been modified in this way. The method signature is define by the prototype of the method For example, the "const char* libraryName();" have "__C5_char_P1__libraryName" for signature solution for secondary problem: The genwrapper accept new tokens in the configuration to custumize the property. The new PropertyInserter and the CustomPropertyInsertAttribute class has been defined The PropertyRemover has been added to the StdMapReflector The _briefHelp and _detailedHelp variable has been added in PropertyInfo, MethodInfo and ContructorInfo class modification: I have modify the genwrapper files Configuration.cpp Configuration.h add some tokens to custumize the property Doxyfile.template add the comment in the output xml genwrapper.conf customize some property in osg::Geometry RegistryBuilder.h RegistryBuilder.cpp add the process_help function (to extract help from xml) TypeRegister.cpp TypeRegister.h optimize the property detection TypeDesc.h TypeDesc.cpp modify FunctionDesc and PropertyDesc WrapperGenerator.h WrapperGenerator.cpp modify the output I also modify the fallowing osgIntrospection files: include/osgIntrospection/Attributes add the PropertyInserter and the CustomPropertyInsertAttribute class include/osgIntrospection/ConstructorInfo add the _briefHelp and _detailedHelp variable in the ConstructorInfo class add access function for the two new variables (_briefHelp and _detailedHelp) modify the constructor to define the two new variables (_briefHelp and _detailedHelp) include/osgIntrospection/MethodInfo add the _briefHelp and _detailedHelp variable in the MethodInfo class add access function for the two new variables (_briefHelp and _detailedHelp) modify the constructor to define the two new variables (_briefHelp and _detailedHelp) include/osgIntrospection/PropertyInfo add the _briefHelp and _detailedHelp variable in the PropertyInfo class add access function for the two new variables (_briefHelp and _detailedHelp) modify the constructor to define the two new variables (_briefHelp and _detailedHelp) include/osgIntrospection/ReflectionMacro remove unused I_Property* macro modify all I_Method macro to accept the help string modify all I_Method macro to define a MethodInfo signature include/osgIntrospection/Reflector add the PropertyInserter in StdVectorReflector and StdListReflector add the PropertyRemover in the StdMapReflector include/osgIntrospection/StaticMethodInfo modify all StaticMethodInfo* to accept the help in parameter include/osgIntrospection/TypedMethodInfo modify all TypedMethodInfo* to accept the help in parameter include/osgIntrospection/TypedConstructorInfo modify all TypedConstructorInfo* to accept the help in parameter include/osgIntrospection/Type add the _briefHelp and _detailedHelp variable in the Type class "
2006-10-17 23:17:06 +08:00
/// Invokes the remover method on the given instance and removes
/// an item from the indexed property. If a custom remover attribute
/// is defined, it will be invoked instead.
void removeIndexedItem(Value& instance, ValueList& indices) const;
2005-03-14 17:28:31 +08:00
/// Invokes the counter method on the given instance and returns
/// the number of items of the array property. If a custom counter
/// attribute is defined, it will be invoked instead.
int getNumArrayItems(const Value& instance) const;
2005-03-14 17:28:31 +08:00
/// Invokes the getter method on the given const instance and returns
2005-03-14 17:28:31 +08:00
/// the i-th item of the array property. If a custom getter attribute
/// us defined, it will be invoked instead.
Value getArrayItem(const Value& instance, int i) const;
2005-03-14 17:28:31 +08:00
/// Invokes the getter method on the given instance and returns
/// the i-th item of the array property. If a custom getter attribute
/// us defined, it will be invoked instead.
Value getArrayItem(Value& instance, int i) const;
2005-03-14 17:28:31 +08:00
/// Invokes the setter method on the given instance and sets
/// the i-th item of the array property. If a custom setter attribute
/// is defined, it will be invoked instead.
void setArrayItem(Value& instance, int i, const Value& value) const;
2005-03-14 17:28:31 +08:00
/// Invokes the adder method on the given instance and adds
/// an item to the array property. If a custom adder attribute is
/// defined, it will be invoked instead.
void addArrayItem(Value& instance, const Value& value) const;
From David Callu: " the main problem is the wrapper generation: The PropertyInfo class use MethodInfo class to access to the value. When the property are define with the I_Property* macro, the MethodInfo use by the property to have access to the value are instancied in the I_Property* macro, but there are already instantied by the I_Method* macro before secondary problem: - the function used by the property could no be customized in the genwrapper.conf file - an array property can't insert a value - the std::map reflector (and indexedProperty in general) haven't remove method - about the help in wrapper ... why not ... solution : To use the function define by the I_Method, I add a MethodInfo variable in the I_Method0 macro old macro : #define I_Method0(ret, fn) (\ params.clear(),\ addMethod(new osgIntrospection::TypedMethodIn fo0<reflected_type, ret >(qualifyName(#fn), &reflected_type::fn, params))) new macro : #define I_Method0(ret, fn, signature, briefHelp, detailedHelp) \ params.clear(); \ osgIntrospection::MethodInfo* signature = addMethod(new osgIntrospection::TypedMethodInfo0<reflected_type, ret >(qualifyName(#fn), &reflected_type::fn, params, briefHelp, detailedHelp)); sink(signature) the osgIntrospection::MethodInfo* signature is used by the I_Property macro to define the MethodInfo that it use so for I_Property macro : old macro : #define I_PropertyWithReturnType(t, n, r) \ cap=addProperty(new osgIntrospection::PropertyInfo(osgIntrospection::Reflection::getType(typeid(reflected_type)), osgIntrospection::Reflection::getType(typeid(t)), #n, \ I_Method0(t, get##n), \ I_Method1(r, set##n, IN, t, value))) new macro: #define I_SimpleProperty(t, n, get, set) \ get, \ set)) The genwrapper has been modified in this way. The method signature is define by the prototype of the method For example, the "const char* libraryName();" have "__C5_char_P1__libraryName" for signature solution for secondary problem: The genwrapper accept new tokens in the configuration to custumize the property. The new PropertyInserter and the CustomPropertyInsertAttribute class has been defined The PropertyRemover has been added to the StdMapReflector The _briefHelp and _detailedHelp variable has been added in PropertyInfo, MethodInfo and ContructorInfo class modification: I have modify the genwrapper files Configuration.cpp Configuration.h add some tokens to custumize the property Doxyfile.template add the comment in the output xml genwrapper.conf customize some property in osg::Geometry RegistryBuilder.h RegistryBuilder.cpp add the process_help function (to extract help from xml) TypeRegister.cpp TypeRegister.h optimize the property detection TypeDesc.h TypeDesc.cpp modify FunctionDesc and PropertyDesc WrapperGenerator.h WrapperGenerator.cpp modify the output I also modify the fallowing osgIntrospection files: include/osgIntrospection/Attributes add the PropertyInserter and the CustomPropertyInsertAttribute class include/osgIntrospection/ConstructorInfo add the _briefHelp and _detailedHelp variable in the ConstructorInfo class add access function for the two new variables (_briefHelp and _detailedHelp) modify the constructor to define the two new variables (_briefHelp and _detailedHelp) include/osgIntrospection/MethodInfo add the _briefHelp and _detailedHelp variable in the MethodInfo class add access function for the two new variables (_briefHelp and _detailedHelp) modify the constructor to define the two new variables (_briefHelp and _detailedHelp) include/osgIntrospection/PropertyInfo add the _briefHelp and _detailedHelp variable in the PropertyInfo class add access function for the two new variables (_briefHelp and _detailedHelp) modify the constructor to define the two new variables (_briefHelp and _detailedHelp) include/osgIntrospection/ReflectionMacro remove unused I_Property* macro modify all I_Method macro to accept the help string modify all I_Method macro to define a MethodInfo signature include/osgIntrospection/Reflector add the PropertyInserter in StdVectorReflector and StdListReflector add the PropertyRemover in the StdMapReflector include/osgIntrospection/StaticMethodInfo modify all StaticMethodInfo* to accept the help in parameter include/osgIntrospection/TypedMethodInfo modify all TypedMethodInfo* to accept the help in parameter include/osgIntrospection/TypedConstructorInfo modify all TypedConstructorInfo* to accept the help in parameter include/osgIntrospection/Type add the _briefHelp and _detailedHelp variable in the Type class "
2006-10-17 23:17:06 +08:00
/// Invokes the insert method on the given instance and inserts
/// an item to the array property after the i-th item of the array
/// property. If a custom adder attribute is defined,
/// it will be invoked instead.
void insertArrayItem(Value& instance, int i, const Value& value) const;
/// Invokes the remover method on the given instance and removes
/// an item from the array property. If a custom remover attribute
/// is defined, it will be invoked instead.
void removeArrayItem(Value& instance, int i) const;
2005-03-14 17:28:31 +08:00
/// Returns the default value associated to the reflected property.
/// If no default value has been specified, this method tries to
/// create an instance of the property type and then returns its
/// value. There are some attributes that change the behavior of
/// this method, for example NoDefaultValueAttribute.
Value getDefaultValue() const;
virtual ~PropertyInfo() {};
2005-03-14 17:28:31 +08:00
protected:
virtual void getInheritedProviders(CustomAttributeProviderList& providers) const;
2005-03-14 17:28:31 +08:00
private:
2009-02-03 04:35:19 +08:00
PropertyInfo& operator = (const PropertyInfo&) { return *this; }
2008-12-17 19:00:16 +08:00
const Type& _declarationType;
const Type& _ptype;
std::string _name;
const MethodInfo* _getm;
const MethodInfo* _setm;
const MethodInfo* _numm;
const MethodInfo* _addm;
From David Callu: " the main problem is the wrapper generation: The PropertyInfo class use MethodInfo class to access to the value. When the property are define with the I_Property* macro, the MethodInfo use by the property to have access to the value are instancied in the I_Property* macro, but there are already instantied by the I_Method* macro before secondary problem: - the function used by the property could no be customized in the genwrapper.conf file - an array property can't insert a value - the std::map reflector (and indexedProperty in general) haven't remove method - about the help in wrapper ... why not ... solution : To use the function define by the I_Method, I add a MethodInfo variable in the I_Method0 macro old macro : #define I_Method0(ret, fn) (\ params.clear(),\ addMethod(new osgIntrospection::TypedMethodIn fo0<reflected_type, ret >(qualifyName(#fn), &reflected_type::fn, params))) new macro : #define I_Method0(ret, fn, signature, briefHelp, detailedHelp) \ params.clear(); \ osgIntrospection::MethodInfo* signature = addMethod(new osgIntrospection::TypedMethodInfo0<reflected_type, ret >(qualifyName(#fn), &reflected_type::fn, params, briefHelp, detailedHelp)); sink(signature) the osgIntrospection::MethodInfo* signature is used by the I_Property macro to define the MethodInfo that it use so for I_Property macro : old macro : #define I_PropertyWithReturnType(t, n, r) \ cap=addProperty(new osgIntrospection::PropertyInfo(osgIntrospection::Reflection::getType(typeid(reflected_type)), osgIntrospection::Reflection::getType(typeid(t)), #n, \ I_Method0(t, get##n), \ I_Method1(r, set##n, IN, t, value))) new macro: #define I_SimpleProperty(t, n, get, set) \ get, \ set)) The genwrapper has been modified in this way. The method signature is define by the prototype of the method For example, the "const char* libraryName();" have "__C5_char_P1__libraryName" for signature solution for secondary problem: The genwrapper accept new tokens in the configuration to custumize the property. The new PropertyInserter and the CustomPropertyInsertAttribute class has been defined The PropertyRemover has been added to the StdMapReflector The _briefHelp and _detailedHelp variable has been added in PropertyInfo, MethodInfo and ContructorInfo class modification: I have modify the genwrapper files Configuration.cpp Configuration.h add some tokens to custumize the property Doxyfile.template add the comment in the output xml genwrapper.conf customize some property in osg::Geometry RegistryBuilder.h RegistryBuilder.cpp add the process_help function (to extract help from xml) TypeRegister.cpp TypeRegister.h optimize the property detection TypeDesc.h TypeDesc.cpp modify FunctionDesc and PropertyDesc WrapperGenerator.h WrapperGenerator.cpp modify the output I also modify the fallowing osgIntrospection files: include/osgIntrospection/Attributes add the PropertyInserter and the CustomPropertyInsertAttribute class include/osgIntrospection/ConstructorInfo add the _briefHelp and _detailedHelp variable in the ConstructorInfo class add access function for the two new variables (_briefHelp and _detailedHelp) modify the constructor to define the two new variables (_briefHelp and _detailedHelp) include/osgIntrospection/MethodInfo add the _briefHelp and _detailedHelp variable in the MethodInfo class add access function for the two new variables (_briefHelp and _detailedHelp) modify the constructor to define the two new variables (_briefHelp and _detailedHelp) include/osgIntrospection/PropertyInfo add the _briefHelp and _detailedHelp variable in the PropertyInfo class add access function for the two new variables (_briefHelp and _detailedHelp) modify the constructor to define the two new variables (_briefHelp and _detailedHelp) include/osgIntrospection/ReflectionMacro remove unused I_Property* macro modify all I_Method macro to accept the help string modify all I_Method macro to define a MethodInfo signature include/osgIntrospection/Reflector add the PropertyInserter in StdVectorReflector and StdListReflector add the PropertyRemover in the StdMapReflector include/osgIntrospection/StaticMethodInfo modify all StaticMethodInfo* to accept the help in parameter include/osgIntrospection/TypedMethodInfo modify all TypedMethodInfo* to accept the help in parameter include/osgIntrospection/TypedConstructorInfo modify all TypedConstructorInfo* to accept the help in parameter include/osgIntrospection/Type add the _briefHelp and _detailedHelp variable in the Type class "
2006-10-17 23:17:06 +08:00
const MethodInfo* _insm;
const MethodInfo* _remm;
ParameterInfoList _indices;
bool _is_array;
From David Callu: " the main problem is the wrapper generation: The PropertyInfo class use MethodInfo class to access to the value. When the property are define with the I_Property* macro, the MethodInfo use by the property to have access to the value are instancied in the I_Property* macro, but there are already instantied by the I_Method* macro before secondary problem: - the function used by the property could no be customized in the genwrapper.conf file - an array property can't insert a value - the std::map reflector (and indexedProperty in general) haven't remove method - about the help in wrapper ... why not ... solution : To use the function define by the I_Method, I add a MethodInfo variable in the I_Method0 macro old macro : #define I_Method0(ret, fn) (\ params.clear(),\ addMethod(new osgIntrospection::TypedMethodIn fo0<reflected_type, ret >(qualifyName(#fn), &reflected_type::fn, params))) new macro : #define I_Method0(ret, fn, signature, briefHelp, detailedHelp) \ params.clear(); \ osgIntrospection::MethodInfo* signature = addMethod(new osgIntrospection::TypedMethodInfo0<reflected_type, ret >(qualifyName(#fn), &reflected_type::fn, params, briefHelp, detailedHelp)); sink(signature) the osgIntrospection::MethodInfo* signature is used by the I_Property macro to define the MethodInfo that it use so for I_Property macro : old macro : #define I_PropertyWithReturnType(t, n, r) \ cap=addProperty(new osgIntrospection::PropertyInfo(osgIntrospection::Reflection::getType(typeid(reflected_type)), osgIntrospection::Reflection::getType(typeid(t)), #n, \ I_Method0(t, get##n), \ I_Method1(r, set##n, IN, t, value))) new macro: #define I_SimpleProperty(t, n, get, set) \ get, \ set)) The genwrapper has been modified in this way. The method signature is define by the prototype of the method For example, the "const char* libraryName();" have "__C5_char_P1__libraryName" for signature solution for secondary problem: The genwrapper accept new tokens in the configuration to custumize the property. The new PropertyInserter and the CustomPropertyInsertAttribute class has been defined The PropertyRemover has been added to the StdMapReflector The _briefHelp and _detailedHelp variable has been added in PropertyInfo, MethodInfo and ContructorInfo class modification: I have modify the genwrapper files Configuration.cpp Configuration.h add some tokens to custumize the property Doxyfile.template add the comment in the output xml genwrapper.conf customize some property in osg::Geometry RegistryBuilder.h RegistryBuilder.cpp add the process_help function (to extract help from xml) TypeRegister.cpp TypeRegister.h optimize the property detection TypeDesc.h TypeDesc.cpp modify FunctionDesc and PropertyDesc WrapperGenerator.h WrapperGenerator.cpp modify the output I also modify the fallowing osgIntrospection files: include/osgIntrospection/Attributes add the PropertyInserter and the CustomPropertyInsertAttribute class include/osgIntrospection/ConstructorInfo add the _briefHelp and _detailedHelp variable in the ConstructorInfo class add access function for the two new variables (_briefHelp and _detailedHelp) modify the constructor to define the two new variables (_briefHelp and _detailedHelp) include/osgIntrospection/MethodInfo add the _briefHelp and _detailedHelp variable in the MethodInfo class add access function for the two new variables (_briefHelp and _detailedHelp) modify the constructor to define the two new variables (_briefHelp and _detailedHelp) include/osgIntrospection/PropertyInfo add the _briefHelp and _detailedHelp variable in the PropertyInfo class add access function for the two new variables (_briefHelp and _detailedHelp) modify the constructor to define the two new variables (_briefHelp and _detailedHelp) include/osgIntrospection/ReflectionMacro remove unused I_Property* macro modify all I_Method macro to accept the help string modify all I_Method macro to define a MethodInfo signature include/osgIntrospection/Reflector add the PropertyInserter in StdVectorReflector and StdListReflector add the PropertyRemover in the StdMapReflector include/osgIntrospection/StaticMethodInfo modify all StaticMethodInfo* to accept the help in parameter include/osgIntrospection/TypedMethodInfo modify all TypedMethodInfo* to accept the help in parameter include/osgIntrospection/TypedConstructorInfo modify all TypedConstructorInfo* to accept the help in parameter include/osgIntrospection/Type add the _briefHelp and _detailedHelp variable in the Type class "
2006-10-17 23:17:06 +08:00
std::string _briefHelp;
std::string _detailedHelp;
2005-03-14 17:28:31 +08:00
};
}
#endif