Main Page | Modules | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members | Related Pages

OSGGraphOp.h

Go to the documentation of this file.
00001 /*---------------------------------------------------------------------------*\
00002 *                                OpenSG                                     *
00003 *                                                                           *
00004 *                                                                           *
00005 *             Copyright (C) 2000-2002 by the OpenSG Forum                   *
00006 *                                                                           *
00007 *                            www.opensg.org                                 *
00008 *                                                                           *
00009 *   contact: dirk@opensg.org, gerrit.voss@vossg.org, jbehr@zgdv.de          *
00010 *                                                                           *
00011 \*---------------------------------------------------------------------------*/
00012 /*---------------------------------------------------------------------------*\
00013 *                                License                                    *
00014 *                                                                           *
00015 * This library is free software; you can redistribute it and/or modify it   *
00016 * under the terms of the GNU Library General Public License as published    *
00017 * by the Free Software Foundation, version 2.                               *
00018 *                                                                           *
00019 * This library is distributed in the hope that it will be useful, but       *
00020 * WITHOUT ANY WARRANTY; without even the implied warranty of                *
00021 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU         *
00022 * Library General Public License for more details.                          *
00023 *                                                                           *
00024 * You should have received a copy of the GNU Library General Public         *
00025 * License along with this library; if not, write to the Free Software       *
00026 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.                 *
00027 *                                                                           *
00028 \*---------------------------------------------------------------------------*/
00029 /*---------------------------------------------------------------------------*\
00030 *                                Changes                                    *
00031 *                                                                           *
00032 *                                                                           *
00033 *                                                                           *
00034 *                                                                           *
00035 *                                                                           *
00036 *                                                                           *
00037 \*---------------------------------------------------------------------------*/
00038 
00039 
00040 #ifndef _OSGGRAPHOP_H_
00041 #define _OSGGRAPHOP_H_
00042 #ifdef __sgi
00043 #pragma once
00044 #endif
00045 
00046 #include <OSGConfig.h>
00047 
00048 #include <OSGSystemDef.h>
00049 #include <OSGAction.h>
00050 #include <OSGBaseTypes.h>
00051 
00052 #include <map>
00053 #include <string>
00054 
00055 OSG_BEGIN_NAMESPACE
00056 
00059 
00060 class OSG_SYSTEMLIB_DLLMAPPING GraphOp
00061 {
00062     /*==========================  PUBLIC  =================================*/
00063 public:
00064 
00065     /*---------------------------------------------------------------------*/
00069     static const char *getClassname(void) { return "GraphOp"; };
00070 
00072     /*---------------------------------------------------------------------*/
00076     GraphOp(const char* name = "");
00077 
00078     virtual GraphOp *create(void) = 0;
00079 
00081     /*---------------------------------------------------------------------*/
00085     virtual ~GraphOp(void);
00086 
00088     /*---------------------------------------------------------------------*/
00092     virtual void setParams(const std::string params) = 0;
00093     virtual std::string usage(void) = 0;
00094 
00096     /*---------------------------------------------------------------------*/
00100     virtual bool traverse(NodePtr& root);
00101 
00102     const std::string &getName(void);
00103     void              setName(const char *name);
00104 
00106     /*---------------------------------------------------------------------*/
00110     void addToExcludeList       (NodePtr& node           );
00111     void addToExcludeList       (const std::string &name );
00112     void removeFromExcludeList  (NodePtr& node           );
00113     void removeFromExcludeList  (const std::string &name );
00114     void clearExcludeList       (void                    );
00115     bool isInExcludeListNodes   (NodePtr& node           );
00116     bool isInExcludeListNames   (const std::string &name );
00117     bool isInExcludeList        (NodePtr& node           );        
00118 
00121     /*=========================  PROTECTED  ===============================*/
00122 protected:
00123 
00124     /*---------------------------------------------------------------------*/
00128     class ParamSet
00129     {
00130       public:
00131         
00132         ParamSet(const std::string &params);
00133     
00134         // Set given value to parameter value, return true if set,
00135         // false if not
00136         bool operator()(const char *name, std::string &val); 
00137         bool operator()(const char *name, Real32 &val); 
00138         bool operator()(const char *name, UInt16 &val); 
00139         bool operator()(const char *name, UInt32 &val); 
00140         bool operator()(const char *name, bool &val); 
00141 
00142         void markUsed(const char *name);
00143         
00144         std::string getUnusedParams(void);
00145         
00146       private:
00147       
00148         typedef std::map<std::string, std::string> valuesT;
00149         typedef std::map<std::string, bool>        usedT;
00150         
00151         valuesT _values;
00152         usedT _used;    
00153     };
00154 
00156     /*---------------------------------------------------------------------*/
00157 
00158     virtual Action::ResultE traverseEnter(NodePtr& node) = 0;
00159     virtual Action::ResultE traverseLeave(NodePtr& node, Action::ResultE res) = 0;
00160 
00161     std::list<NodePtr>     _excludeListNodes;
00162     std::list<std::string> _excludeListNames;
00163 
00164     /*==========================  PRIVATE  ================================*/
00165 private:
00166     std::string            _name;
00167 };
00168 
00169 typedef GraphOp *GraphOpP;
00170 OSG_END_NAMESPACE
00171 
00172 #endif /* _OSGGRAPHOP_H_ */

Generated on Thu Aug 25 04:05:52 2005 for OpenSG by  doxygen 1.4.3