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

SourceForge.net Logo
Project
Download
Mailing lists

 

         

ptrbuffer.h

00001 /*
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_BUFFER_H
00012 #define ORCAICE_ICE_PTR_BUFFER_H
00013 
00014 #include <gbxsickacfr/gbxiceutilacfr/buffer.h>
00015 #include <Ice/Object.h>
00016 
00017 namespace orcaice
00018 {
00019 
00028 template<class Type>
00029 class PtrBuffer : public gbxiceutilacfr::Buffer<Type>
00030 {
00031     using gbxiceutilacfr::Buffer<Type>::queue_;
00032 
00033 public:
00040     PtrBuffer( int depth, gbxiceutilacfr::BufferType type );
00041     
00042 protected:
00043     virtual void internalGet( Type & obj ) const ;
00044 
00045     virtual void internalGet( Type & obj, unsigned int n ) const ;
00046     
00047     virtual void internalPush( const Type & obj );
00048 };
00049 
00050 template<class Type>
00051 PtrBuffer<Type>::PtrBuffer( int depth, gbxiceutilacfr::BufferType type )
00052     : gbxiceutilacfr::Buffer<Type>(depth,type)
00053 {
00054 }
00055 
00056 template<class Type>
00057 void PtrBuffer<Type>::internalGet( Type & obj ) const
00058 {
00059     // create a shallow copy (see Ice manual p.210)
00060     Ice::ObjectPtr superclass = queue_.front()->ice_clone();
00061     obj = Type::dynamicCast( superclass );
00062 }
00063 
00064 template<class Type>
00065 void PtrBuffer<Type>::internalGet( Type & obj, unsigned int n ) const
00066 {
00067     // create a shallow copy (see Ice manual p.210)
00068     Ice::ObjectPtr superclass = queue_[n]->ice_clone();
00069     obj = Type::dynamicCast( superclass );
00070 }
00071 
00072 template<class Type>
00073 void PtrBuffer<Type>::internalPush( const Type & obj )
00074 {
00075     Ice::ObjectPtr clone = obj->ice_clone();
00076     Type subclass = Type::dynamicCast( clone );
00077     queue_.push_back( subclass );
00078 }
00079 
00080 } // end namespace
00081 
00082 #endif
 

Webmaster: Tobias Kaupp (tobasco at users.sourceforge.net)


Generated for Orca Robotics by  doxygen 1.4.5