Commit Graph

43 Commits

Author SHA1 Message Date
Robert Osfield
734463fcc7 Warning fixes 2009-02-03 15:28:53 +00:00
Robert Osfield
c5733fef14 Added local disabling the the VS C4121 "alignment of a member was sensitive to packing" warning 2009-02-03 11:54:46 +00:00
Robert Osfield
1153ea5feb Warnings fixes for VS. 2009-02-02 20:35:19 +00:00
Robert Osfield
a5c32da4ff Warning fixes 2008-12-17 11:00:16 +00:00
Robert Osfield
6f6f56c795 Improved the doxygen docs over the various namespaces 2008-08-05 19:17:09 +00:00
Robert Osfield
01f58e2b76 From Donald Cipperly, "This is a fix to eliminate >> errors in VS 7.1" 2008-05-07 14:24:14 +00:00
Robert Osfield
3c2872a36a From Emmanuel Roche, "I'm joining two zip files to this mail for the modified sources and include files of osgIntrospection.
The modifications I made are very small but they are absolutely usefull to use osgIntrospection with visual studio 7.1 or 8 in debug modes.
This should also solve other minor common problems (converter memory leak, virtual destructor for PropertyInfo, etc...).

I choosed two function names : Reflection::uninitialize() and Type::reset(), this can of course be changed if someone has a better idea...

I made the changes against OSG 2.2.0 public release. I tested the result with VS 7.1, VS 7.1 SP1, VS 8.0 SP1 and AQTime 5.0 on Windows XP SP2... All 4 seem to agree : they detected memory leaks before and don't anymore.

Sorry I haven't take the time to test that on linux but the changes are so small I doubt there could be a problem... I let you check that on your side  :-).

I hope this will help making OSG an even more wonderfull library."
2008-02-25 16:26:30 +00:00
Robert Osfield
b20d542317 From David Callu, improved consistency of Version strings and add version support
for osgIntrospection and osgManipulator.
2007-09-05 17:12:24 +00:00
Robert Osfield
f38be8c7a8 From David Callu, "After the mail of Emmanuel Roche to convert a void * in a known pointer (for example osg::Geode *), I has searched an elegant way to introduce this feature.
I just add ReinterpretCastConverter in the Reflector to convert void* in T* and T* in void*
    

    files joint :

        OpenSceneGraph/include/osgIntrospection/Reflector       // modified file
        OpenSceneGraph/src/osgIntrospection/Reflector.cpp      // modified file

"
2007-07-27 17:16:18 +00:00
Robert Osfield
c80313ccd0 From David Callu,
"
Found in the join file the fix for the bug found by Rafa.


    Problem :

        osgIntrospection::Value grp(new osg::Group);

        osgIntrospection::ValueList vlcall;
        vlcall.push_back(osgIntrospection::Value("toto"));

       const osgIntrospection::MethodInfo *m =
grp->getType.getCompatibleMethod("setName", vlcall, true);

       if (m)
       {
            m->invoke(grp, vlcall);      // ** SEGFAULT here
       }





    Algorithm explanation :

          The "invoke" method try to convert "grp", which reflect an
"osg::Group*", in a
          "osgIntrospection::Value", which reflect a "osg::Node*".
This because
          the "setName(const char *)" method found by
"grp->getType.getCompatibleMethod"
          is an "osg::Object" type method.

          When osgIntrospection do this conversion it try :
             - to found a "osgIntrospection::Converter"  to convert
               from "osg::Group*" to "osg::Node*"
             - to found a chain of "osgIntrospection::Converter" to convert
               from "osg::Group*" to "one or many type" to "osg::Node*"
             - to converte an Enum to int or unsigned int
             - to convert the value in its "value string representation",
               then converte this string in the destination value

          Else it throw a "TypeConversionException".







     Bug :

          1)
          When osgIntrospection try to found a chain of
"osgIntrospection::Converter"
          It could do any downcast or (Type to SuperType) or upcast
(SuperType to Type).
          This mean the the chain could be :
          osg::Group to osg::Transform to osg::Camera to
          osg::CullSettings to osg::CullStack to
osg::CollectOccludersVisitor to
          osg::NodeVisitor to osg::Referenced to osg::Object

         During the convertion with this chain, A METTRE failed and
the pointer in
         "grp" is set NULL. But the "grp" is always a valid
"osgIntrospection::Value"
         and so, osgIntrospection accept the conversion. Then it try
to use this pointer
         to call the "setName" function. And Bing SEGFAULT.


         2)
             In "bool Reflection::accum_conv_path( ... )"
             the convection path isn't accumulate in the recursive loop.
             this cause multi request of a conversion path, and a
slowdown in the
             conversion algorithm.

         3)
             Use of the last conversion way in a conversion from
pointer to pointer
             this mean you can do this :
             "osg::Node*" to " value string representation" to "osg::Material*"
             What a bad thing !!!




    Solution :

         1)
          Introduce the concept of dynamic_cast and static_cast.
          now, to do a conversion, osgIntrospection does this :

             - to found a "osgIntrospection::Converter"  to convert
               from "osg::Group*" to "osg::Node*"
             - to found a chain of "osgIntrospection::Converter" to convert
               from "osg::Group*" to "one or many type" to "osg::Node*"
               only with static_cast, downcast (Type to SuperType)

             - to found, if the source and the destination are two pointer,
               a chain of "osgIntrospection::Converter" to convert
               from "osg::Group*" to "one or many type" to "osg::Node*"
               only with dynamic_cast, upcast (SuperType to Type)

             - to convert an Enum to int or to unsigned int
             - to convert the value in its "value string representation",
               then convert this string in the destination value

          Else it throw a "TypeConversionException".


          Add the "enum CastType" to distinguish the static_cast or
dynamic_cast converter.
          Add file OpenSceneGraph/include/osgIntrospection/CastType

         2)
         add a line to accumulate converter in converter Path.

         3)
         add a line to check if source and destination are pointer.
"
2007-06-30 14:21:34 +00:00
Robert Osfield
2fbbbca1a0 From Mike Wittman, "This change to genwrapper and osgIntrospection gives access to
the declaring file for a given type via the new member function
osgIntrospection::Type::getDeclaringFile.  This information is useful
in order to know what header to include when auto-generating wrappers
for a given type.

During the C# wrapper generator development I've been keeping the
declaring file configuration state up-to-date manually with changes
to OSG, and it's proven to require substantial effort.  So it would be
extremely valuable to get this change in before 2.0 to reduce maintenance
during the lifetime of the release.  It'll also be equally useful to
others looking to create wrapper generators using osgIntrospection.

This is a fairly simple change and was tested with a fresh rebuild of the
entire suite of osgWrapper libraries, so it should be relatively low risk
(fingers crossed)."
2007-06-08 10:11:00 +00:00
Robert Osfield
069adcf555 From David Callu, " bug:
Lost the functionality to find the real type pointed by a pointer.
   Ex: a osg::Node pointer point on a osg::Group, if I look for information
       on the pointer type, the introspection say it is a "osg::Node*".
       But if I want information on the pointed type,
       the introspection must return the "osg::Group".
   

   This bug come from the osgIntrospection::Value::Ptr_instance_box::ptype() function.
   In the original version, this function use the member "Instance_base *inst_"
   like this :
      typeof(*static_cast<Instance<T> *>(inst_)->_data)

   But in the new version, this function use the template argument "T":
      typeof(typename remove_pointer<T>::type)

   This is a good meta-programming use, but here we need a dynamic request.

   Moreover the "typeof" macro define in "Reflection" header accept only a type in parameter with the new version.
   


 fix:
   Add the macro "typeofvalue" in "Reflection" header which accept a value or a type in parameter.
   Restore original code in osgIntrospection::Value::Ptr_instance_box::ptype() function.
"
2007-03-16 14:28:27 +00:00
Robert Osfield
6c56383ba9 From Mike Wittman, added protected function support 2007-03-01 11:54:30 +00:00
Robert Osfield
3e6a91c079 From Mike Wittman, "The template-argument-list errors look to be due to a lack of spaces in the typeof macro. Here's a new Reflection header which should fix those problems. For consistency I think that's the best solution." 2007-02-15 15:03:30 +00:00
Robert Osfield
f60330df31 Added extra spaces between <> template declarations 2007-02-15 09:17:03 +00:00
Robert Osfield
5dcb7af6a4 From Mike Wittman, added spaces into < > macros 2007-02-14 11:21:41 +00:00
Robert Osfield
264d69e0c9 From Mike Wittman, support for reference parameters 2007-02-13 09:33:35 +00:00
Robert Osfield
d28a6011f1 From Mike Wittman, "Here is the next in the series of changes I'm making to OSG introspection to support the attributes needed for C# bindings. This change adds virtual/pure virtual attributes to MethodInfo and an explicit attribute to ConstructorInfo using the implementation strategy that David Callu recommended a few months back (thanks David!). This change updates both genwrapper and osgIntrospection, and assumes the osgIntrospection reference support that's still pending in your submission queue." 2007-02-12 17:59:18 +00:00
Robert Osfield
a725e0af7d From Mike Wittman, "These changes add support for reflection of reference and const reference type representations via osgIntrospection::Type. This covers just the static type information; the dynamic behavior via Type::createInstance/Type::InvokeMethod should not be affected." 2007-02-12 17:14:46 +00:00
Robert Osfield
f3b71fc2ac 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 15:17:06 +00:00
Robert Osfield
9d02b2314f From Mike Weiblen, build fixes for Windows. 2006-09-05 09:51:33 +00:00
Robert Osfield
616097e465 From David Callu,
"bug fix to reflect the wchar_t in Value and Value.cpp I add the toWString() function.
in Type and Type.cpp I just add two function to get a map of propertyList and a map of methodList
i need this map in my editor a i think it's could be util to put this functionnality in osgIntrospection,
2006-09-01 12:52:15 +00:00
Robert Osfield
f1c2694c17 Updated copyright years. 2006-07-18 15:21:48 +00:00
Robert Osfield
9c93332c03 From Rodger James, changed the Win32 static library compilation support to use
OSG_LIBRARY_STATIC to avoid problems with building libs when not required.
2005-11-18 09:52:24 +00:00
Robert Osfield
35fcaf7bde Convert tabs to spaces. 2005-11-17 17:44:48 +00:00
Robert Osfield
20ce2ada9f From Marco Jez, warning fixes. 2005-11-15 11:43:29 +00:00
Robert Osfield
8558a2b046 From Marco Jez, compile for a syntax error problem. 2005-11-10 20:56:16 +00:00
Robert Osfield
fc675f7706 From Marco Jez, fix for gcc build. 2005-09-29 13:00:23 +00:00
Robert Osfield
3ef0406105 From Marco Jez, "Problems fixed:
1. type converters created automatically by the I_BaseType macro use
static_cast<> even for base-to-derived conversions. dynamic_cast<> should be
used instead.
2. as a consequence of the above fix, I_BaseType must now differentiate
between polymorphic and non-polymorphic base classes, because the latter
can't be dynamic_cast'd to derived classes. Some template magic (see
is_polymorphic<> in ReflectionMacros) is used to detect polymorphism at
compile time (I'm NOT sure it works on all platforms as it's partly
implementation-dependent. Please test!).
3. predefined custom property getters/setters/counters/etc. (as those
defined for STL containers) only work on Value objects that contain
non-pointer instances. This was an unwanted restriction that no longer
exists.

Wrappers will need to be recompiled. This is a good time to give them a
fresh update with genwrapper.

NOTE: fix #1 should get rid of those crashes and strange behaviours that
some users noticed while using osgIntrospection through osgTcl or in their
own code."
2005-09-28 14:18:31 +00:00
Robert Osfield
f26c3da074 From Chris Hanson, "The following files are drop-in replacements for the include/*/Export files to permit
building statically linked osg libraries under Win32."
2005-09-28 14:05:05 +00:00
Robert Osfield
40ef0026df Updated doxgen docs. 2005-05-25 11:45:02 +00:00
Robert Osfield
668aada787 From Marco Jez, fixes to/and for osgIntrospection. 2005-05-15 20:32:10 +00:00
Robert Osfield
7781be9cc9 Compile fix 2005-04-29 11:22:15 +00:00
Robert Osfield
f2d696f871 Moved osgIntrospection across to standard OSG coding style. 2005-04-29 11:19:58 +00:00
Robert Osfield
af13199e05 Added Copyright 2005-04-29 10:06:50 +00:00
Robert Osfield
678b22ce83 Updated Copyright notices to 1998-2005. 2005-04-14 21:41:28 +00:00
Robert Osfield
7a27a0bef7 From Marco Jez, improvements to osgIntrospection, and new automatically generated
osgWrappers/osg set.
2005-04-07 20:00:17 +00:00
Robert Osfield
5f75f765f0 From Marco Jez, updates to osgIntrospection. 2005-04-04 13:50:07 +00:00
Robert Osfield
4beb385d2d Changed tabs to four spaces 2005-03-14 09:28:31 +00:00
Robert Osfield
21ae4c6c65 From Marco Jez, fix for data corruption bug in TypedMethodInfo*::invoke() 2005-03-14 09:13:38 +00:00
Robert Osfield
d2c235a52b From Fredric Marmond, fix to gcc3.4 build 2004-12-14 01:38:45 +00:00
Robert Osfield
d9802310dc From Marco, fixes to osgIntrospection and related libs 2004-12-13 02:39:47 +00:00
Robert Osfield
28d31c96b6 Added Marco Jez's osgIntrospection + osgWrapper libs with osgintrospection
example
2004-12-09 05:28:20 +00:00