Main Page   Class Hierarchy   Compound List   File List   Compound Members   Related Pages  

find.h

00001 //
00002 // find.h
00003 //
00004 // Copyright (C) 1996 Limit Point Systems, Inc.
00005 //
00006 // Author: Curtis Janssen <cljanss@limitpt.com>
00007 // Maintainer: LPS
00008 //
00009 // This file is part of the SC Toolkit.
00010 //
00011 // The SC Toolkit is free software; you can redistribute it and/or modify
00012 // it under the terms of the GNU Library General Public License as published by
00013 // the Free Software Foundation; either version 2, or (at your option)
00014 // any later version.
00015 //
00016 // The SC Toolkit is distributed in the hope that it will be useful,
00017 // but WITHOUT ANY WARRANTY; without even the implied warranty of
00018 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00019 // GNU Library General Public License for more details.
00020 //
00021 // You should have received a copy of the GNU Library General Public License
00022 // along with the SC Toolkit; see the file COPYING.LIB.  If not, write to
00023 // the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
00024 //
00025 // The U.S. Government is granted a limited license as per AL 91-7.
00026 //
00027 
00028 #ifndef _util_render_find_h
00029 #define _util_render_find_h
00030 
00031 #include <util/render/stack.h>
00032 #include <util/render/parameter.h>
00033 
00034 // cannot be used with g++ 2.6-94q4 and has other bugs anyway
00035 #if 0
00036 template <class T1, class T2>
00037 void
00038 find_parameter_in_stack(Stack<T1>& stack,
00039                         Parameter<T2>& (T1::*access)(),
00040                         T2& result
00041                         )
00042 {
00043   int have_result = 0;
00044   for (int i=stack.n()-1; i>=0; i--) {
00045       if ((stack[i]->*access)().is_set()) {
00046           if (!have_result || (stack[i]->*access)().overrides()) {
00047               result = (stack[i]->*access)().value();
00048               have_result = 1;
00049             }
00050         }
00051     }
00052 }
00053 #endif
00054 
00055 inline void
00056 find_int_parameter_in_appearance_stack(Stack<Ref<Appearance> >& stack,
00057                         Parameter<int>& (Appearance::*access)(),
00058                         int& result
00059                         )
00060 {
00061   int have_result = 0;
00062   for (int i=stack.n()-1; i>=0; i--) {
00063       if ((stack[i].pointer()->*access)().is_set()) {
00064           if (!have_result || (stack[i].pointer()->*access)().overrides()) {
00065               result = (stack[i].pointer()->*access)().value();
00066               have_result = 1;
00067             }
00068         }
00069     }
00070 }
00071 
00072 #endif
00073 
00074 // Local Variables:
00075 // mode: c++
00076 // c-file-style: "CLJ"
00077 // End:

Generated at Thu Oct 4 18:08:44 2001 for MPQC 2.0.0 using the documentation package Doxygen 1.2.5.