synaps/base/ReferTo.h

00001 /********************************************************************
00002  *   This file is part of the source code of the SYNAPS kernel.
00003  *   Author(s): B. Mourrain, GALAAD, INRIA
00004  *   $Id: ReferTo.h,v 1.1 2005/07/11 11:23:12 mourrain Exp $
00005  ********************************************************************/
00006 #ifndef SYNAPS_UTIL_REFERTO_H
00007 #define SYNAPS_UTIL_REFERTO_H
00008 #include <synaps/init.h>
00009 #include <synaps/base/shared_object.h>
00010 /********************************************************************/
00011 __BEGIN_NAMESPACE_SYNAPS
00012 //--------------------------------------------------------------------
00014 template<class R>
00015 inline       R & Rep(R & r)       {return r;}
00016 
00018 template<class R>
00019 inline const R & Rep(const R & r) {return r;}
00020 
00022 template<class R>
00023 inline       R & Rep(shared_object<R> & r)       {return *r;}
00024 
00026 template<class R>
00027 inline const R & Rep(const shared_object<R> & r) {return *r;}
00028 
00029 //--------------------------------------------------------------------
00031 
00037 template<class T>
00038 struct ReferTo
00039 {
00041   typedef T value_type;
00042 };
00043 
00045 
00051 template<class T>
00052 struct ReferTo<shared_object<T> >
00053 {
00055   typedef T value_type;
00056 };
00057 //--------------------------------------------------------------------
00058 __END_NAMESPACE_SYNAPS
00059 /********************************************************************/
00060 #endif //

SYNAPS DOCUMENTATION
logo