Hello Andreas,

Andreas Halm wrote:
> I have a problem using a field container derived class. For simplicity 
> let’s just name my classes type1 and type2, both defined using fcd 
> files. Now type2 needs to have a multifield of type1.

hm, FieldContainer do not support value semantics (there is too much 
happening behind the scenes to allow copies to be created just because 
(for example) an FC is put into a std::vector<>). Does type1 have to be 
a FC (that also makes it quite a bit larger than the 5 floats you claim 
below).

> First I tried this:
> 
>   <Field
>     name="locations"
>     type="type1"
>     header="./OSGType1Fields.h"
>     cardinality="multi"
>     visibility="external"
>     access="public"
>   </Field>
> 
> This would be the preferred solution as type1 is quite small (only 5 
> floats) and the whole multifield is not changed after loading.
> 
> This didn’t work because MFType1 was not defined.

right, only fields of pointers to a container exist. If you want to 
store a type that has value semantics in a MF you need a suitable 
specialization of FieldTraits<T> (examples can be found for example in 
Source/System/NodeCores/Drawables/Particles/OSGParticleBSP.h).

> However the file 
> OSGType1Fields.h contains all the definitions for pointers so I tried:
> 
> <Field
> name="locations"
> category="pointer"
> type="type1"
> header="./OSGType1Fields.h"
> cardinality="multi"
> visibility="external"
> access="public">
> </Field>
> 
> This does not compile either, because fcd2code insists to add the 
> following include to OSGType2Base.cpp:
> 
> #include <OpenSG/OSGType1.h> // Locations Class
> 
> Which doesn’t exist of course as type1 is not part of OpenSG 2.
> 
> Besides the fact that the effect in part #2 is obviously a bug, what is 
> the preferred way of using such a small class?

the include problem should be fixed in r2011, I split the header 
attribute into fieldHeader (header that defines the field type, e.g. 
MFFoo) and typeHeader (header that defines the type stored in the field, 
e.g. Foo) - wiki is updated as well.

        Cheers,
                Carsten

------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
trial. Simplify your report design, integration and deployment - and focus on 
what you do best, core application coding. Discover what's new with 
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
_______________________________________________
Opensg-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/opensg-users

Reply via email to