fixed: auto_ptr -> unique_ptr
[opensg.git] / Source / System / Action / Base / OSGAction.inl
blob1041fadfcf031b73784cd9355641c5dfcada8c5d
1 /*---------------------------------------------------------------------------*\
2  *                                OpenSG                                     *
3  *                                                                           *
4  *                                                                           *
5  *                 Copyright (C) 2000 by the OpenSG Forum                    *
6  *                                                                           *
7  *                            www.opensg.org                                 *
8  *                                                                           *
9  *   contact: dirk@opensg.org, gerrit.voss@vossg.org, jbehr@zgdv.de          *
10  *                                                                           *
11 \*---------------------------------------------------------------------------*/
12 /*---------------------------------------------------------------------------*\
13  *                                License                                    *
14  *                                                                           *
15  * This library is free software; you can redistribute it and/or modify it   *
16  * under the terms of the GNU Library General Public License as published    *
17  * by the Free Software Foundation, version 2.                               *
18  *                                                                           *
19  * This library is distributed in the hope that it will be useful, but       *
20  * WITHOUT ANY WARRANTY; without even the implied warranty of                *
21  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU         *
22  * Library General Public License for more details.                          *
23  *                                                                           *
24  * You should have received a copy of the GNU Library General Public         *
25  * License along with this library; if not, write to the Free Software       *
26  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.                 *
27  *                                                                           *
28 \*---------------------------------------------------------------------------*/
29 /*---------------------------------------------------------------------------*\
30  *                                Changes                                    *
31  *                                                                           *
32  *                                                                           *
33  *                                                                           *
34  *                                                                           *
35  *                                                                           *
36  *                                                                           *
37 \*---------------------------------------------------------------------------*/
39 //---------------------------------------------------------------------------
40 //  Includes
41 //---------------------------------------------------------------------------
43 OSG_BEGIN_NAMESPACE
45 inline 
46 Node *Action::getActNode(void)
48     return _actNode;
51     
52 inline 
53 void Action::setActNode(Node * const node)
55     _actNode = node;
58 inline 
59 FieldContainer *Action::getActParent(void)
61     return _actParent;
64     
65 inline 
66 void Action::setActParent(FieldContainer * const parent)
68     _actParent = parent;
71 inline
72 Node *Action::getNode(UInt32 index)
74     if(_actList == NULL)
75     {
76         return _actNode->getChild(index);
77     }
78     else
79     {
80         return (*_actList)[index];
81     }
84 inline
85 void Action::addNode(Node * const node)
87     _newList.push_back(node);
90 inline
91 void Action::useNodeList(bool bVal)
93     _useNewList = bVal;
96 inline
97 UInt32 Action::getNNodes(void) const
99     if(_actList == NULL)
100     {
101         return _actNode->getNChildren();
102     }
103     else
104     {
105         return UInt32((*_actList).size());
106     }
110 inline
111 UInt32 Action::getTravMask(void) const
113     return _travMask;
116 inline
117 void Action::setTravMask(UInt32 val)
119     _travMask = val;
122 inline
123 void Action::andTravMask(UInt32 val)
125     _travMask &= val;
128 inline
129 void Action::orTravMask(UInt32 val)
131     _travMask |= val;
134 inline
135 void Action::pushTravMask(void)
137     _sTravMask.push(_travMask);
140 inline
141 void Action::popTravMask(void)
143     _travMask = _sTravMask.top();
145     _sTravMask.pop();
148 /*-------------------------- your_category---------------------------------*/
150 // callEnter/callLeave: call the right functor. If the type is unknown and new
151 // (i.e. its index is larger than the vector) try to find the function in the
152 // default list.
154 inline
155 Action::ResultE Action::callEnter(NodeCore * const core)
157     ResultE result;
159     UInt32 uiFunctorIndex = core->getType().getId();
161     if(uiFunctorIndex < _enterFunctors.size())
162     {
163         result = _enterFunctors[uiFunctorIndex](core, this);
164     }
165     else // unknown field container
166     {
167         result = _defaultEnterFunction(core, this);
168     }
170     return result;
173 inline
174 Action::ResultE Action::callLeave(NodeCore * const core)
176     ResultE result;
178     UInt32 uiFunctorIndex = core->getType().getId();
180     if(uiFunctorIndex < _leaveFunctors.size())
181     {
182         result = _leaveFunctors[uiFunctorIndex](core, this);
183     }
184     else // unknown field container
185     {
186         result = _defaultLeaveFunction(core, this);
187     }
189     return result;
192 /*-------------------------- assignment -----------------------------------*/
194 /** \brief assignment
195  */
198 /*-------------------------- comparison -----------------------------------*/
200 /** \brief assignment
201  */
204 /** \brief equal
205  */
208 /** \brief unequal
209  */
213 /*-------------------------------------------------------------------------*\
214  -  protected                                                              -
215 \*-------------------------------------------------------------------------*/
219 /*-------------------------------------------------------------------------*\
220  -  private                                                                -
221 \*-------------------------------------------------------------------------*/
223 OSG_END_NAMESPACE