OSG  3.4.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
ModularProgram.h
Go to the documentation of this file.
1 /* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield
2  *
3  * This library is open source and may be redistributed and/or modified under
4  * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or
5  * (at your option) any later version. The full license is in LICENSE file
6  * included with this distribution, and on the openscenegraph.org website.
7  *
8  * This library is distributed in the hope that it will be useful,
9  * but WITHOUT ANY WARRANTY; without even the implied warranty of
10  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11  * OpenSceneGraph Public License for more details.
12 */
13 //osgParticle - Copyright (C) 2002 Marco Jez
14 
15 #ifndef OSGPARTICLE_MODULARPROGRAM
16 #define OSGPARTICLE_MODULARPROGRAM 1
17 
18 #include <osgParticle/Export>
19 #include <osgParticle/Program>
20 #include <osgParticle/Operator>
21 
22 #include <osg/CopyOp>
23 #include <osg/Object>
24 #include <osg/Node>
25 #include <osg/NodeVisitor>
26 
27 namespace osgParticle
28 {
29 
36  public:
39 
41 
43  inline int numOperators() const;
44 
46  inline void addOperator(Operator* o);
47 
49  inline Operator* getOperator(int i);
50 
52  inline const Operator* getOperator(int i) const;
53 
55  inline void removeOperator(int i);
56 
57  protected:
58  virtual ~ModularProgram() {}
59  ModularProgram& operator=(const ModularProgram&) { return *this; }
60 
61  void execute(double dt);
62 
63  private:
64  typedef std::vector<osg::ref_ptr<Operator> > Operator_vector;
65 
66  Operator_vector _operators;
67  };
68 
69  // INLINE FUNCTIONS
70 
71  inline int ModularProgram::numOperators() const
72  {
73  return static_cast<int>(_operators.size());
74  }
75 
77  {
78  _operators.push_back(o);
79  }
80 
82  {
83  return _operators[i].get();
84  }
85 
86  inline const Operator* ModularProgram::getOperator(int i) const
87  {
88  return _operators[i].get();
89  }
90 
91  inline void ModularProgram::removeOperator(int i)
92  {
93  _operators.erase(_operators.begin()+i);
94  }
95 
96 
97 }
98 
99 #endif
int numOperators() const
Get the number of operators.
void removeOperator(int i)
Remove an operator from the list.
#define META_Node(library, name)
Definition: Node.h:59
ModularProgram & operator=(const ModularProgram &)
#define OSGPARTICLE_EXPORT
Definition: Export.h:40
void addOperator(Operator *o)
Add an operator to the list.
Operator * getOperator(int i)
Get a pointer to an operator in the list.