orca-robotics INTRODUCTION Overview Download and Install Quick Start Documentation Publications REPOSITORY Interfaces Components Libraries Utilities Software Map DEVELOPER Tutorials Examples Dev Guide Dashboard Wiki login/pass: orca/orca PEOPLE Contributors Users Project Download Mailing lists
|
ptrstore.h00001 /* 00002 * Orca-Robotics Project: Components for robotics 00003 * http://orca-robotics.sf.net/ 00004 * Copyright (c) 2004-2008 Alex Brooks, Alexei Makarenko, Tobias Kaupp 00005 * 00006 * This copy of Orca is licensed to you under the terms described in 00007 * the LICENSE file included in this distribution. 00008 * 00009 */ 00010 00011 #ifndef ORCAICE_ICE_PTR_STORE_H 00012 #define ORCAICE_ICE_PTR_STORE_H 00013 00014 #include <gbxsickacfr/gbxiceutilacfr/store.h> 00015 #include <Ice/Ice.h> 00016 00017 namespace orcaice 00018 { 00019 00029 template<class Type> 00030 class PtrStore : public gbxsickacfr::gbxiceutilacfr::Store<Type> 00031 { 00032 using gbxsickacfr::gbxiceutilacfr::Store<Type>::obj_; 00033 00034 protected: 00035 virtual void internalGet( Type & obj ) const ; 00036 00037 virtual void internalSet( const Type & obj ); 00038 }; 00039 00040 template<class Type> 00041 void PtrStore<Type>::internalGet( Type & obj ) const 00042 { 00043 // create a shallow copy (see Ice manual p.210) 00044 Ice::ObjectPtr superclass = obj_->ice_clone(); 00045 obj = Type::dynamicCast( superclass ); 00046 } 00047 00048 template<class Type> 00049 void PtrStore<Type>::internalSet( const Type & obj ) 00050 { 00051 Ice::ObjectPtr clone = obj->ice_clone(); 00052 Type subclass = Type::dynamicCast( clone ); 00053 obj_ = subclass; 00054 } 00055 00056 } // end namespace 00057 00058 #endif |
Webmaster: Tobias Kaupp (tobasco at users.sourceforge.net)