Panda3D
|
00001 // Filename: dataGraphTraverser.h 00002 // Created by: drose (11Mar02) 00003 // 00004 //////////////////////////////////////////////////////////////////// 00005 // 00006 // PANDA 3D SOFTWARE 00007 // Copyright (c) Carnegie Mellon University. All rights reserved. 00008 // 00009 // All use of this software is subject to the terms of the revised BSD 00010 // license. You should have received a copy of this license along 00011 // with this source code in a file named "LICENSE." 00012 // 00013 //////////////////////////////////////////////////////////////////// 00014 00015 #ifndef DATAGRAPHTRAVERSER_H 00016 #define DATAGRAPHTRAVERSER_H 00017 00018 #include "pandabase.h" 00019 00020 #include "dataNodeTransmit.h" 00021 #include "pvector.h" 00022 #include "pmap.h" 00023 00024 class DataNode; 00025 class PandaNode; 00026 00027 //////////////////////////////////////////////////////////////////// 00028 // Class : DataGraphTraverser 00029 // Description : This object supervises the traversal of the data 00030 // graph and the moving of data from one DataNode to its 00031 // children. The data graph is used to manage data from 00032 // input devices, etc. See the overview of the data 00033 // graph in dataNode.h. 00034 //////////////////////////////////////////////////////////////////// 00035 class EXPCL_PANDA_DGRAPH DataGraphTraverser { 00036 PUBLISHED: 00037 DataGraphTraverser(Thread *current_thread = Thread::get_current_thread()); 00038 ~DataGraphTraverser(); 00039 00040 INLINE Thread *get_current_thread() const; 00041 00042 void traverse(PandaNode *node); 00043 void traverse_below(PandaNode *node, const DataNodeTransmit &output); 00044 void collect_leftovers(); 00045 00046 private: 00047 void r_transmit(DataNode *data_node, const DataNodeTransmit inputs[]); 00048 00049 typedef pvector<DataNodeTransmit> DataVector; 00050 00051 Thread *_current_thread; 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