00001 /***************************************************************************** 00002 * SGL: A Scene Graph Library 00003 * 00004 * Copyright (C) 1997-2001 Scott McMillan All Rights Reserved. 00005 * 00006 * This library is free software; you can redistribute it and/or 00007 * modify it under the terms of the GNU Library General Public 00008 * License as published by the Free Software Foundation; either 00009 * version 2 of the License, or (at your option) any later version. 00010 * 00011 * This library is distributed in the hope that it will be useful, 00012 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00013 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00014 * Library General Public License for more details. 00015 * 00016 * You should have received a copy of the GNU Library General Public 00017 * License along with this library; if not, write to the Free 00018 * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 00019 ***************************************************************************** 00020 * File: sglIndexedBitMaskSwitch.hpp 00021 * Author: Michael Morrison 00022 * Created: October 2001 00023 * Summary: select (or not) the children to be traversed 00024 *****************************************************************************/ 00025 00026 #ifndef __SGL_INDEXED_BIT_MASK_SWITCH_HPP 00027 #define __SGL_INDEXED_BIT_MASK_SWITCH_HPP 00028 00029 #include <sgl.h> 00030 #include <sglGroup.hpp> 00031 #include <sglBitMaskSwitch.hpp> 00032 #include <vector> 00033 00034 //---------------------------------------------------------------------------- 00035 00079 //---------------------------------------------------------------------------- 00080 00081 class SGL_DLL_API sglIndexedBitMaskSwitch : public sglBitMaskSwitch 00082 { 00083 public: 00085 sglIndexedBitMaskSwitch(); 00087 virtual ~sglIndexedBitMaskSwitch(); 00088 00092 void setIndex(unsigned int index) 00093 { 00094 if (index >= m_index.size()) 00095 return; 00096 00097 m_switch_index = index; 00098 setMask( m_index[ m_switch_index ] ); 00099 } 00100 00104 unsigned int getIndex() const { return m_switch_index; } 00105 00109 void addMask( unsigned int mask) { m_index.push_back( mask ); } 00110 00111 // See sglNode::clone() for details. 00112 virtual sglNode *clone(unsigned int mode) const; 00113 00114 // See sglObject::printInfo() for details. 00115 virtual void printInfo(ostream &ostrm, const char *indent_string) const; 00116 00117 protected: 00118 void copyTo(sglIndexedBitMaskSwitch *dst, unsigned int mode) const; 00119 00120 private: 00121 sglIndexedBitMaskSwitch(const sglIndexedBitMaskSwitch &); // not imp 00122 sglIndexedBitMaskSwitch &operator=(const sglIndexedBitMaskSwitch &); 00123 00124 protected: 00125 unsigned int m_switch_index; 00126 vector<unsigned int> m_index; 00127 }; 00128 00129 #endif
1.2.6 written by Dimitri van Heesch,
© 1997-2001