Show
Ignore:
Timestamp:
12/12/07 18:00:42 (1 year ago)
Author:
cneumann
Message:

added: generic interface
changed: factory functions return RefPtr?

The unittests don't pass right now, because of the change
to the factory functions, which leads to containers
being immediately destroyed as they are not assigned to
a RefPtr?.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • branches/Carsten_PtrWork2/Source/System/FieldContainer/Fields/OSGEditSFCPointerFieldHandle.inl

    r1017 r1032  
    1 /*---------------------------------------------------------------------------*\ 
    2  *                                OpenSG                                     * 
    3  *                                                                           * 
    4  *                                                                           * 
    5  *                       Copyright 2007 by OpenSG Forum                      * 
    6  *                                                                           * 
    7  *   contact: dirk@opensg.org, gerrit.voss@vossg.org, jbehr@zgdv.de          * 
    8  *                                                                           * 
    9 \*---------------------------------------------------------------------------*/ 
    10 /*---------------------------------------------------------------------------*\ 
    11  *                                License                                    * 
    12  *                                                                           * 
    13  * This library is free software; you can redistribute it and/or modify it   * 
    14  * under the terms of the GNU Library General Public License as published    * 
    15  * by the Free Software Foundation, version 2.                               * 
    16  *                                                                           * 
    17  * This library is distributed in the hope that it will be useful, but       * 
    18  * WITHOUT ANY WARRANTY; without even the implied warranty of                * 
    19  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU         * 
    20  * Library General Public License for more details.                          * 
    21  *                                                                           * 
    22  * You should have received a copy of the GNU Library General Public         * 
    23  * License along with this library; if not, write to the Free Software       * 
    24  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.                 * 
    25  *                                                                           * 
    26 \*---------------------------------------------------------------------------*/ 
    27 /*---------------------------------------------------------------------------*\ 
    28  *                                Changes                                    * 
    29  *                                                                           * 
    30  *                                                                           * 
    31  *                                                                           * 
    32  *                                                                           * 
    33  *                                                                           * 
    34  *                                                                           * 
    35 \*---------------------------------------------------------------------------*/ 
    36  
    371/*---------------------------------------------------------------------------*\ 
    382 *                                OpenSG                                     * 
     
    10165inline 
    10266EditSFCPointerFieldBaseHandle::EditSFCPointerFieldBaseHandle( 
    103     Field                      *pField,  
     67    Field                      *pField, 
    10468    FieldDescriptionBase const *pDescription) 
    10569     
     
    159123    Self const &other) 
    160124     
    161     : Inherited(other) 
     125    : Inherited (other           ), 
     126      _sfSetFunc(other._sfSetFunc) 
    162127{ 
    163128} 
     
    166131inline 
    167132EditSFCPointerFieldHandle<FieldT>::EditSFCPointerFieldHandle( 
    168     Field                      *pField,  
     133    Field                      *pField, 
    169134    FieldDescriptionBase const *pDescription) 
    170135     
    171     : Inherited(pField, pDescription) 
     136    : Inherited (pField, pDescription), 
     137      _sfSetFunc(                    ) 
    172138{ 
    173139} 
     
    256222 
    257223/*-------------------------------------------------------------------------*/ 
     224/* Setup                                                                   */ 
     225 
     226template <class FieldT> 
     227inline void 
     228EditSFCPointerFieldHandle<FieldT>::setSetFunc(SFSetFunction const &func) 
     229{ 
     230    _sfSetFunc = func; 
     231} 
     232 
     233/*-------------------------------------------------------------------------*/ 
    258234/* Operations                                                              */ 
    259235 
     
    269245EditSFCPointerFieldHandle<FieldT>::set(FieldContainer * const pNewValue) 
    270246{ 
    271     HandledFieldValueType pCastNewValue = 
     247    HandledFieldValueType pTypedNewValue = 
    272248        dynamic_cast<HandledFieldValueType>(pNewValue); 
    273          
    274     if(pCastNewValue != NULL) 
    275         castFieldDown()->setValue(pCastNewValue); 
     249 
     250    if(pTypedNewValue != NULL) 
     251    { 
     252        _sfSetFunc(pTypedNewValue); 
     253    } 
    276254} 
    277255