INTRODUCTION Overview Download and Install Quick Start Documentation Publications NONFRAMEWORK CODE Driver Interfaces Drivers Libraries Utilities FRAMEWORK CODE Interfaces Components Libraries Utilities Full Software Listings DEVELOPER Tutorials Examples Dev Guide Dashboard 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-2009 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/Object.h> 00016 00017 namespace orcaice 00018 { 00019 00030 template<class Type> 00031 class PtrStore : public gbxiceutilacfr::Store<Type> 00032 { 00033 using gbxiceutilacfr::Store<Type>::obj_; 00034 00035 protected: 00036 virtual void internalGet( Type & obj ) const ; 00037 00038 virtual void internalSet( const Type & obj ); 00039 }; 00040 00041 template<class Type> 00042 void PtrStore<Type>::internalGet( Type & obj ) const 00043 { 00044 // create a shallow copy (see Ice manual p.210) 00045 Ice::ObjectPtr superclass = obj_->ice_clone(); 00046 obj = Type::dynamicCast( superclass ); 00047 } 00048 00049 template<class Type> 00050 void PtrStore<Type>::internalSet( const Type & obj ) 00051 { 00052 Ice::ObjectPtr clone = obj->ice_clone(); 00053 Type subclass = Type::dynamicCast( clone ); 00054 obj_ = subclass; 00055 } 00056 00057 } // end namespace 00058 00059 #endif |
Webmaster: Tobias Kaupp (tobasco at users.sourceforge.net)