Hello,

I have implemented a class that contains a multi field of category 
'weakpointer' (see extract of fcd file below) representing the beacons of the 
lights managed  by this class. Now I would like to add a function 
setBeacon(const UInt32 idx, Node* beacon) to my class. But I could not succeed 
in implementing that function . I always get compile errors. What I expected to 
be the right implementation is the following

void MultiRangeLightChunk::setBeacon(const UInt32 idx, Node* const beacon)
{
    OSG_ASSERT(idx < _mfBeacon.size());
    editMField(BeaconFieldMask, _mfBeacon);
    _mfBeacon.replace(idx, beacon);
}

but that is not going to work. I get the following error for that code:

OSGPointerMField.inl(1173): error C2664:

    typedef 
OSG::PointerMFieldCommon<OSG::PointerAccessHandler<OSG::WeakRefCountPolicy>,0>  
 PointerMFieldCommon_t
    typedef OSG::PointerMField<OSG::Node *,OSG::WeakRefCountPolicy,0>   
PointerMField_t

    'void 
PointerMFieldCommon_t::ptrStoreReplace(PointerMFieldCommon_t::PtrStoreItType,PointerMFieldCommon_t::const_value)'

    : cannot convert argument 2 from
        'OSG::Node *const ' to
        'PointerMFieldCommon_t::const_value'

          Types pointed to are unrelated; conversion requires reinterpret_cast, 
C-style cast or function-style cast

          OSGPointerMField.inl(1172) : while compiling class template member 
function 'void PointerMField_t::replace(OSG::UInt32,OSG::Node *const )'
          OSGMultiRangeLightChunk.cpp(151) : see reference to function template 
instantiation 'void PointerMField_t::replace(OSG::UInt32,OSG::Node *const )' 
being compiled
          OSGMultiRangeLightChunkBase.h(222) : see reference to class template 
instantiation 'PointerMField_t' being compiled

I have tried a lot but do get not my head around this error. Does anyone know 
how to write correct setBeacon function in that scenario?

Help is really appreciated here.

Best,
Johannes




<FieldContainer
    name="MultiRangeLightChunk"
    parent="ShaderStorageBufferObjStdLayoutChunk"
    library="System"
    pointerfieldtypes="both"
    structure="concrete"
    systemcomponent="true"
    parentsystemcomponent="true"
    decoratable="false"
    useLocalIncludes="false"
    docGroupBase="GrpSystemState"
>
    <Field
        name="color"
        type="Color3f"
        cardinality="multi"
        visibility="external"
        access="protected"
    >
   </Field>
...
    <Field
        name="beacon"
        type="Node"
        category="weakpointer"
        cardinality="multi"
        visibility="external"
        access="protected"
    >
    </Field>
</FieldContainer>


------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, SlashDot.org! http://sdm.link/slashdot
_______________________________________________
Opensg-users mailing list
Opensg-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/opensg-users

Reply via email to