00001 // Filename: dataGraphTraverser.h 00002 // Created by: drose (11Mar02) 00003 // 00004 //////////////////////////////////////////////////////////////////// 00005 // 00006 // PANDA 3D SOFTWARE 00007 // Copyright (c) 2001, Disney Enterprises, Inc. All rights reserved 00008 // 00009 // All use of this software is subject to the terms of the Panda 3d 00010 // Software license. You should have received a copy of this license 00011 // along with this source code; you will also find a current copy of 00012 // the license at http://www.panda3d.org/license.txt . 00013 // 00014 // To contact the maintainers of this program write to 00015 // panda3d@yahoogroups.com . 00016 // 00017 //////////////////////////////////////////////////////////////////// 00018 00019 #ifndef DATAGRAPHTRAVERSER_H 00020 #define DATAGRAPHTRAVERSER_H 00021 00022 #include "pandabase.h" 00023 00024 #include "dataNodeTransmit.h" 00025 #include "pvector.h" 00026 #include "pmap.h" 00027 00028 class DataNode; 00029 class PandaNode; 00030 00031 //////////////////////////////////////////////////////////////////// 00032 // Class : DataGraphTraverser 00033 // Description : This object supervises the traversal of the data 00034 // graph and the moving of data from one DataNode to its 00035 // children. The data graph is used to manage data from 00036 // input devices, etc. See the overview of the data 00037 // graph in dataNode.h. 00038 //////////////////////////////////////////////////////////////////// 00039 class EXPCL_PANDA DataGraphTraverser { 00040 PUBLISHED: 00041 DataGraphTraverser(); 00042 ~DataGraphTraverser(); 00043 00044 void traverse(PandaNode *node); 00045 void traverse_below(PandaNode *node, const DataNodeTransmit &output); 00046 void collect_leftovers(); 00047 00048 private: 00049 void r_transmit(DataNode *data_node, const DataNodeTransmit inputs[]); 00050 00051 typedef pvector<DataNodeTransmit> DataVector; 00052 00053 class CollectedData { 00054 public: 00055 INLINE CollectedData(); 00056 void set_data(int parent_index, const DataNodeTransmit &data); 00057 00058 int _num_parents; 00059 DataVector _data; 00060 }; 00061 typedef pmap<DataNode *, CollectedData> MultipassData; 00062 MultipassData _multipass_data; 00063 }; 00064 00065 #include "dataGraphTraverser.I" 00066 00067 #endif