Changeset 160 for osgVisual/src
- Timestamp:
- Nov 14, 2010, 6:32:43 PM (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
osgVisual/src/dataIO/visual_dataIO.cpp
r157 r160 49 49 void visual_dataIO::init(osgViewer::Viewer* viewer_, osg::ArgumentParser& arguments_, std::string configFileName) 50 50 { 51 OSG_NOTIFY( osg::ALWAYS ) << "visual_dataIO init ()" << std::endl;51 OSG_NOTIFY( osg::ALWAYS ) << "visual_dataIO initialize.." << std::endl; 52 52 53 53 // Init variables … … 55 55 56 56 // Process XML configuration 57 this->configFileName = configFileName; 57 58 if(!processXMLConfiguration()) 58 OSG_FATAL << "ERROR: visual_dataIO::init() - Failed to initialize dataIO!"; 59 60 // Parse operating Mode 61 if (arguments_.read("-m")) 62 { 63 OSG_NOTIFY( osg::ALWAYS ) << "Configure osgVisual as MASTER" << std::endl; 64 clusterMode = osgVisual::dataIO_cluster::MASTER; 65 } 66 else if (arguments_.read("-s")) 67 { 68 OSG_NOTIFY( osg::ALWAYS ) << "Configure osgVisual as SLAVE" << std::endl; 69 clusterMode = osgVisual::dataIO_cluster::SLAVE; 70 slotContainer = NULL; // Slave only recieves container, therefor set this Pointer NULL (created instance will be deleted because it is an auto pointer). 71 } 72 else 73 { 74 OSG_NOTIFY( osg::ALWAYS ) << "Configure osgVisual as STANDALONE" << std::endl; 75 clusterMode = osgVisual::dataIO_cluster::STANDALONE; 76 } 59 OSG_FATAL << "ERROR: visual_dataIO::init() - Failed to initialize dataIO via XML configuration!"; 60 77 61 78 62 // Create Cluster. … … 115 99 bool visual_dataIO::processXMLConfiguration() 116 100 { 101 // Init XML 102 xmlDoc* tmpDoc; 103 bool disabled; 104 xmlNode* config = util::getModuleXMLConfig( configFileName, "dataio", tmpDoc, disabled ); 105 106 if( disabled) 107 OSG_NOTIFY( osg::ALWAYS ) << "..disabled by XML configuration file. dataIO can't be disabled. Ignoring." << std::endl; 108 109 // extract configuration values 110 if(config) 111 { 112 xmlNode* a_node = config->children; 113 114 for (xmlNode *cur_node = a_node; cur_node; cur_node = cur_node->next) 115 { 116 std::string node_name=reinterpret_cast<const char*>(cur_node->name); 117 //OSG_ALWAYS << "----visual_distortion::processXMLConfiguration() - node type="<< cur_node->type <<", name=" << cur_node->name << std::endl; 118 119 // Check for dataio node 120 if(cur_node->type == XML_ELEMENT_NODE && node_name == "dataio") 121 { 122 // Extract cluster role 123 xmlAttr *attr = cur_node->properties; 124 while ( attr ) 125 { 126 std::string attr_name=reinterpret_cast<const char*>(attr->name); 127 std::string attr_value=reinterpret_cast<const char*>(attr->children->content); 128 if( attr_name == "clusterrole" ) 129 { 130 if(attr_value == "master") 131 { 132 OSG_NOTIFY( osg::ALWAYS ) << "Configure osgVisual as MASTER" << std::endl; 133 clusterMode = osgVisual::dataIO_cluster::MASTER; 134 } 135 else if(attr_value == "slave") 136 { 137 OSG_NOTIFY( osg::ALWAYS ) << "Configure osgVisual as SLAVE" << std::endl; 138 clusterMode = osgVisual::dataIO_cluster::SLAVE; 139 slotContainer = NULL; // Slave only recieves container, therefor set this Pointer NULL (created instance will be deleted because it is an auto pointer). 140 } 141 else if(attr_value == "standalone") 142 { 143 OSG_NOTIFY( osg::ALWAYS ) << "Configure osgVisual as STANDALONE" << std::endl; 144 clusterMode = osgVisual::dataIO_cluster::STANDALONE; 145 } 146 } 147 attr = attr->next; 148 } // WHILE attrib END 149 } 150 151 // Check for cluster node 152 if(cur_node->type == XML_ELEMENT_NODE && node_name == "cluster") 153 { 154 // Check Attributes to determine if the dummy implementation or any other implementation must be instantiated 155 156 // Pass XML attributes to cluster to analyse and configure it by cluster itself 157 } 158 159 // Check for extLink node 160 if(cur_node->type == XML_ELEMENT_NODE && node_name == "extlink") 161 { 162 // Check Attributes to determine if the dummy implementation or any other implementation must be instantiated 163 164 // Pass XML attributes to extlink to analyse and configure it by extLink itself 165 } 166 167 } // FOR all nodes END 168 169 // clean up 170 xmlFreeDoc(tmpDoc); xmlCleanupParser(); 171 return true; 172 } // IF Config valid END 173 else 174 { 175 OSG_WARN << "ERROR: visual_data::processXMLConfiguration() - Module configuration not found" << std::endl; 176 return false; 177 } 117 178 118 179 return true;
Note: See TracChangeset
for help on using the changeset viewer.