Changeset 186
- Timestamp:
- Jan 8, 2011, 8:13:43 PM (14 years ago)
- Location:
- osgVisual/trunk
- Files:
-
- 10 edited
Legend:
- Unmodified
- Added
- Removed
-
osgVisual/trunk/include/cluster/dataIO_cluster.h
r185 r186 69 69 70 70 /** 71 * \brief Pure virtual function for initialization. Must be implemented in derived class.71 * \brief Pure virtual function for XML configuration. Must be implemented in derived class. 72 72 * 73 73 */ … … 82 82 83 83 /** 84 * \brief Pure virtual function for initialization. Must be implemented in derived class.84 * \brief Pure virtual function for shutdown. Must be implemented in derived class. 85 85 * 86 86 */ -
osgVisual/trunk/include/dataIO/visual_dataIO.h
r185 r186 133 133 * @return : True if parsing was successful. 134 134 */ 135 bool processXMLConfiguration( xmlNode* extLinkConfig_);135 bool processXMLConfiguration(); 136 136 137 137 /** -
osgVisual/trunk/include/extLink/dataIO_extLink.h
r118 r186 19 19 #include <osg/Node> 20 20 #include <dataIO_slot.h> 21 22 // XML Parser 23 #include <stdio.h> 24 #include <libxml/parser.h> 25 #include <libxml/tree.h> 21 26 22 27 … … 54 59 * 55 60 */ 56 virtual void init() = 0;61 virtual bool init( xmlNode* configurationNode) = 0; 57 62 63 /** 64 * \brief Pure virtual function for XML configuration. Must be implemented in derived class. 65 * 66 */ 67 virtual bool processXMLConfiguration(xmlNode* extLinkConfig_) = 0; 68 69 /** 70 * \brief Pure virtual function for shutdown. Must be implemented in derived class. 71 * 72 */ 58 73 virtual void shutdown() = 0; 59 74 -
osgVisual/trunk/include/extLink/dataIO_extLinkDummy.h
r132 r186 37 37 virtual ~dataIO_extLinkDummy(void); 38 38 39 void init(); 39 bool processXMLConfiguration(xmlNode* extLinkConfig_); 40 bool init(xmlNode* configurationNode); 40 41 void shutdown(); 41 42 -
osgVisual/trunk/include/extLink/dataIO_extLinkVCL.h
r180 r186 79 79 virtual ~dataIO_extLinkVCL(void); 80 80 81 void init(); 81 bool init(xmlNode* configurationNode); 82 bool processXMLConfiguration(xmlNode* extLinkConfig_); 82 83 void shutdown(); 83 84 -
osgVisual/trunk/src/cluster/dataIO_clusterDummy.cpp
r183 r186 32 32 { 33 33 sendContainer = sendContainer_; 34 OSG_NOTIFY( osg::ALWAYS ) << "clusterDummy init() ;" << std::endl;34 OSG_NOTIFY( osg::ALWAYS ) << "clusterDummy init()" << std::endl; 35 35 return true; 36 36 } … … 38 38 bool dataIO_clusterDummy::processXMLConfiguration(xmlNode* clusterConfig_) 39 39 { 40 OSG_NOTIFY( osg::ALWAYS ) << "clusterDummy processXMLConfiguration() ;" << std::endl;40 OSG_NOTIFY( osg::ALWAYS ) << "clusterDummy processXMLConfiguration()" << std::endl; 41 41 return true; 42 42 } -
osgVisual/trunk/src/cluster/dataIO_clusterENet.cpp
r185 r186 109 109 bool dataIO_clusterENet::processXMLConfiguration(xmlNode* clusterConfig_) 110 110 { 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 111 // Extract cluster role 112 xmlAttr *attr = clusterConfig_->properties; 113 while ( attr ) 114 { 115 std::string attr_name=reinterpret_cast<const char*>(attr->name); 116 std::string attr_value=reinterpret_cast<const char*>(attr->children->content); 117 if( attr_name == "implementation" ) 118 { 119 if(attr_value != "enet") 120 { 121 OSG_NOTIFY( osg::ALWAYS ) << "WARNING: Cluster configuration does not match the currently used 'enet' implementation, falling back to clusterDummy" << std::endl; 122 return false; 123 } 124 } 125 if( attr_name == "hardsync" ) 126 { 127 if(attr_value == "yes") 128 hardSync = true; 129 else 130 hardSync = false; 131 } 132 if( attr_name == "master_ip" ) 133 { 134 serverToConnect = attr_value; 135 } 136 if( attr_name == "port" ) 137 { 138 std::istringstream i(attr_value); 139 if (!(i >> port)) 140 { 141 OSG_NOTIFY( osg::ALWAYS ) << "WARNING: Cluster configuration : Invalid port number '" << attr_value << "', falling back to clusterDummy" << std::endl; 142 return false; 143 } 144 } 145 if( attr_name == "use_zlib_compressor" ) 146 { 147 if(attr_value == "yes") 148 compressionEnabled = true; 149 else 150 compressionEnabled = false; 151 } 152 attr = attr->next; 153 } // WHILE attrib END 154 154 155 155 return true; -
osgVisual/trunk/src/dataIO/visual_dataIO.cpp
r185 r186 54 54 viewer = viewer_; 55 55 56 // Process XML configuration 56 // Process XML configuration - all XML dependen initializations are performed in processXMLConfiguration() 57 57 this->configFileName = configFileName; 58 xmlNode *extLinkConfig=NULL; 59 if(!processXMLConfiguration(extLinkConfig)) 58 if(!processXMLConfiguration()) 60 59 OSG_FATAL << "ERROR: visual_dataIO::init() - Failed to initialize dataIO via XML configuration!"; 61 60 62 // Create extLink.63 #ifdef USE_EXTLINK_DUMMY64 extLink = new dataIO_extLinkDummy( dataSlots );65 #endif66 #ifdef USE_EXTLINK_VCL67 extLink = new dataIO_extLinkVCL( dataSlots );68 #endif69 extLink->init();70 71 72 61 // Install callbacks to perform DataIO activities every frame: 73 62 //// EventCallback at the absolute beginning of the frame … … 81 70 } 82 71 83 bool visual_dataIO::processXMLConfiguration( xmlNode* extLinkConfig_)72 bool visual_dataIO::processXMLConfiguration() 84 73 { 85 74 // Init XML … … 87 76 bool disabled; 88 77 xmlNode* config = util::getModuleXMLConfig( configFileName, "dataio", tmpDoc, disabled ); 89 xmlNode* clusterConfig = NULL ;78 xmlNode* clusterConfig = NULL, *extLinkConfig = NULL; 90 79 91 80 if( disabled) … … 147 136 if(cur_node->type == XML_ELEMENT_NODE && node_name == "extlink") 148 137 { 149 // Check Attributes to determine if the dummy implementation or any other implementation must be instantiated150 151 // Pass XML attributes to extlink to analyse and configure it by extLink itself138 // Pass extLink configuration to the used extLink implementation. 139 // The implementation will use the configuration if it matches, otherwise falls back to dummy extLink 140 extLinkConfig = cur_node; 152 141 } 153 142 154 143 } // FOR all nodes END 155 156 144 157 145 … … 169 157 } 170 158 159 // Create extLink. 160 #ifdef USE_EXTLINK_VCL 161 extLink = new dataIO_extLinkVCL( dataSlots ); 162 #endif 163 if( !extLink.valid() || !extLinkConfig || !extLink->init(extLinkConfig) ) 164 { 165 extLink = new dataIO_extLinkDummy( dataSlots ); 166 extLink->init(extLinkConfig); 167 } 171 168 172 169 -
osgVisual/trunk/src/extLink/dataIO_extLinkDummy.cpp
r132 r186 32 32 } 33 33 34 void dataIO_extLinkDummy::init()34 bool dataIO_extLinkDummy::init(xmlNode* configurationNode) 35 35 { 36 36 OSG_NOTIFY( osg::ALWAYS ) << "extLinkDummy init()" << std::endl; 37 return true; 38 } 39 40 bool dataIO_extLinkDummy::processXMLConfiguration(xmlNode* extLinkConfig_) 41 { 42 OSG_NOTIFY( osg::ALWAYS ) << "extLinkDummy processXMLConfiguration()" << std::endl; 43 return true; 37 44 } 38 45 -
osgVisual/trunk/src/extLink/dataIO_extLinkVCL.cpp
r121 r186 31 31 } 32 32 33 void dataIO_extLinkVCL::init() 34 { 33 bool dataIO_extLinkVCL::init(xmlNode* configurationNode) 34 { 35 if (!configurationNode || !processXMLConfiguration(configurationNode)) 36 return false; 37 35 38 OSG_NOTIFY( osg::ALWAYS ) << "extLinkVCL init()" << std::endl; 36 39 37 VCLConfigFilename = "osgVisual.xml";38 39 40 if ( osgDB::fileExists( VCLConfigFilename ) ) 40 41 { … … 47 48 else 48 49 { 49 OSG_NOTIFY( osg::FATAL ) << "ERROR: Could not find VCL Configuration file " << VCLConfigFilename << std::endl; 50 exit(-1); 51 } 52 50 OSG_NOTIFY( osg::FATAL ) << "ERROR: Could not find VCL Configuration file '" << VCLConfigFilename << "', falling back to extLinkDummy" << std::endl; 51 return false; 52 } 53 return true; 54 } 55 56 bool dataIO_extLinkVCL::processXMLConfiguration(xmlNode* extLinkConfig_) 57 { 58 // Extract VCL config file 59 xmlAttr *attr = extLinkConfig_->properties; 60 while ( attr ) 61 { 62 std::string attr_name=reinterpret_cast<const char*>(attr->name); 63 std::string attr_value=reinterpret_cast<const char*>(attr->children->content); 64 if( attr_name == "implementation" ) 65 { 66 if(attr_value != "vcl") 67 { 68 OSG_NOTIFY( osg::ALWAYS ) << "WARNING: extLink configuration does not match the currently used 'vcl' implementation, falling back to extLinkDummy" << std::endl; 69 return false; 70 } 71 } 72 if( attr_name == "filename" ) 73 { 74 VCLConfigFilename = attr_value; 75 } 76 attr = attr->next; 77 } // WHILE attrib END 78 79 return true; 53 80 } 54 81
Note: See TracChangeset
for help on using the changeset viewer.