Code Search for Developers
 
 
  

CValueTreeModifier.h from osgDesigner at Krugle


Show CValueTreeModifier.h syntax highlighted

#ifndef __CVALUETREEMODIFIER_H__
#define __CVALUETREEMODIFIER_H__ 1


#include <osgIntrospectionToolKit/Export.h>
#include <osgIntrospectionToolKit/CValueTreeFunctor.h>
#include <osgIntrospectionToolKit/CValueTree.h>
#include <osgIntrospectionToolKit/IReflectedValue.h>
#include <osgIntrospectionToolKit/IReflectedValueLink.h>

namespace osgIntrospectionToolKit
{
    class OSGINTROSPECTIONTOOLKIT_EXPORT CValueTreeModifier: public CValueTreeFunctor
    {
        public:
//            typedef Base                                                      CValueTreeFunctor;
            typedef CValueTreeFunctor::graph_base                               graph_base;
            typedef graph_base::vertex_descriptor                               vertex_descriptor;
            typedef graph_base::edge_descriptor                                 edge_descriptor;
            typedef std::list< osg::ref_ptr< IReflectedValueLink > >            ReflectedValueLinkList;
            
            struct VertexStackInfo
            {
                typedef CValueTreeFunctor::graph_base                           graph_base;
                typedef graph_base::vertex_descriptor                           vertex_descriptor;
                
                VertexStackInfo() : _vd(0), _value() {}
                VertexStackInfo(vertex_descriptor vd, osgIntrospection::Value& value) : _vd(vd), _value(value) {}
                
                inline void    set(vertex_descriptor vd, osgIntrospection::Value& value)
                { _vd = vd; _value = value;}
                
                vertex_descriptor                               _vd;
                osgIntrospection::Value                         _value;
            };

            struct ReflectedValueLinkListStackInfo
            {
                typedef CValueTreeModifier::ReflectedValueLinkList              ReflectedValueLinkList;

                ReflectedValueLinkListStackInfo() : _pos(0) {}

                ReflectedValueLinkList                          _rvll;
                size_t                                          _pos;
                
                IReflectedValueLink*                            getAndIncrement()
                { 
                    ReflectedValueLinkList::iterator it = _rvll.begin();
                    std::advance(it, _pos++);
                    return (it->get()); 
                }
                
                bool                                            isFinish()
                { return (_pos >= _rvll.size()); }
            };
            
            struct EdgeListStackInfo
            {
                EdgeListStackInfo() : _pos(0) {}

                CValueTree::EdgeList                            _edList;
                size_t                                          _pos;
                
                edge_descriptor                                 getAndIncrement()
                { 
                    CValueTree::EdgeList::iterator it = _edList.begin();
                    std::advance(it, _pos++);
                    return (*it); 
                }
                bool                                            isFinish()
                { return (_pos >= _edList.size()); }
                
            };
                        
            typedef std::list< VertexStackInfo >                            VertexStack;
            typedef std::list< ReflectedValueLinkListStackInfo >            ReflectedValueLinkListStack;
            typedef std::list< EdgeListStackInfo >                          EdgeListStack;




        	CValueTreeModifier(CValueTree* vt):CValueTreeFunctor(vt) {}
        	virtual ~CValueTreeModifier() {}
            
            bool                                                            add(CReflectedRefPointer* rrp);
            bool                                    						explore(vertex_descriptor vd);
            bool                                                            remove(vertex_descriptor vd);
            bool                                                            update(vertex_descriptor vd);
            
        private:

            bool                                                            removeChild(vertex_descriptor vd);

            bool                                                            _exploreStack();
            bool                                                            findValueInParent(osgIntrospection::Value& value);
            osg::ref_ptr<IReflectedValue>                                   createReflectedValue(osgIntrospection::Value& value);
            bool                                                            compareAndInsertChild();
            bool                                                            updateReflectedValue(vertex_descriptor vd, osgIntrospection::Value& value);
            void                                                            compareEdgeAndPropertyInfoList(CValueTree::out_edge_range oer, ReflectedValueLinkList& rvll);
            void                                                            insertNewProperty(ReflectedValueLinkList& rvll);

            VertexStack                                                     _vertexStack;
            ReflectedValueLinkListStack                                     _rvllStack;
            EdgeListStack                                                   _edgeListStack;
            
            VertexStackInfo                                                 _vertexStackInfo;
            ReflectedValueLinkListStackInfo                                 _rvllStackInfo;
            EdgeListStackInfo                                               _edgeListStackInfo;
    };
}

#endif // ** __CVALUETREEMODIFIER_H__ ** //




See more files for this project here

osgDesigner

osgDesigner is a graphical tool used to modify an OpenSceneGraph (OSG) scene using the osgIntrospection framework. OpenSceneGraph developpers will be able to extend osgDesigner at need using (editor | render | osgIntrospection wrapper) plugin system.

Project homepage: http://sourceforge.net/projects/osgdesigner
Programming language(s): C++,Shell Script
License: other

  CArrayItemLink.h
  CIndexedItemLink.h
  CPropertyExtractor.h
  CReflectedInstance.h
  CReflectedPointer.h
  CReflectedRefPointer.h
  CReflectedValueLinkExtractor.h
  CValueTree.h
  CValueTreeFunctor.h
  CValueTreeModifier.h
  CommonStdType.h
  ControlList.h
  ExceptionUtility.h
  Export.h
  IGraph.h
  IReflectedValue.h
  IReflectedValueLink.h
  SMemoryManager.h
  STypeGraph.h
  SWrapperManager.h
  signalslib.hpp