00001 /******************************************************************* 00002 * This file is part of the source code of the SYNAPS kernel. 00003 * Author(s): J.P. Pavone, GALAAD, INRIA 00004 * $Id: View.h,v 1.1 2005/10/04 12:30:09 mourrain Exp $ 00005 ********************************************************************/ 00006 #ifndef synaps_traits_View_H 00007 #define synaps_traits_View_H 00008 //==================================================================== 00009 #include <synaps/init.h> 00010 //==================================================================== 00011 __BEGIN_NAMESPACE_SYNAPS 00012 //==================================================================== 00013 00014 struct ID 00015 { 00016 int id; 00017 ID(): id(-1){}; 00018 }; 00019 00020 template<class Rep> 00021 struct View : ID// Vue (compile-time) 00022 { 00023 static int CID; 00024 Rep a; 00025 View() { ((ID*)this)->id = CID; }; 00026 Rep & rep(){ return a; }; 00027 const Rep & rep() const { return a; }; 00028 }; 00029 00030 template<class R> int View<R>::CID = -1; 00031 00032 //==================================================================== 00033 __END_NAMESPACE_SYNAPS 00034 #endif //