00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
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
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
00122 protected:
00123
00124
00128 class ParamSet
00129 {
00130 public:
00131
00132 ParamSet(const std::string ¶ms);
00133
00134
00135
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
00165 private:
00166 std::string _name;
00167 };
00168
00169 typedef GraphOp *GraphOpP;
00170 OSG_END_NAMESPACE
00171
00172 #endif