[32] | 1 | #pragma once |
---|
| 2 | /* -*-c++-*- osgVisual - Copyright (C) 2009-2010 Torben Dannhauer |
---|
| 3 | * |
---|
| 4 | * This library is based on OpenSceneGraph, open source and may be redistributed and/or modified under |
---|
| 5 | * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or |
---|
| 6 | * (at your option) any later version. The full license is in LICENSE file |
---|
| 7 | * included with this distribution, and on the openscenegraph.org website. |
---|
| 8 | * |
---|
| 9 | * osgVisual requires for some proprietary modules a license from the correspondig manufacturer. |
---|
| 10 | * You have to aquire licenses for all used proprietary modules. |
---|
| 11 | * |
---|
| 12 | * This library is distributed in the hope that it will be useful, |
---|
| 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
---|
| 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
---|
| 15 | * OpenSceneGraph Public License for more details. |
---|
| 16 | */ |
---|
| 17 | |
---|
| 18 | #include "dataIO_cluster.h" |
---|
| 19 | |
---|
| 20 | #include <osg/notify> |
---|
| 21 | #include <osg/ArgumentParser> |
---|
| 22 | #include <osgDB/Registry> |
---|
| 23 | #include <osgDB/ReaderWriter> |
---|
| 24 | #include <iostream> |
---|
[57] | 25 | #include <winsock2.h> |
---|
| 26 | #pragma comment ( lib, "WSock32.lib" ) |
---|
[32] | 27 | |
---|
| 28 | #include "dataIO_clusterUDP_Transmission.h" |
---|
| 29 | |
---|
| 30 | namespace osgVisual |
---|
| 31 | { |
---|
| 32 | |
---|
| 33 | /** |
---|
| 34 | * \brief This is a UDP implementation of dataIO_cluster.. |
---|
| 35 | * |
---|
| 36 | * This class uses UDP to fullfil the functions of dataIO_cluster. |
---|
| 37 | * It sends the clusterdata via UDP Broadcast into the network to any listening client. |
---|
| 38 | * |
---|
| 39 | * |
---|
| 40 | * \todo Add getHorizonColor to transport it to slave for consistent fog. |
---|
| 41 | * @author Torben Dannhauer |
---|
| 42 | * @date Feb 2010 |
---|
| 43 | */ |
---|
| 44 | class dataIO_clusterUDP : public dataIO_cluster |
---|
| 45 | { |
---|
| 46 | public: |
---|
| 47 | dataIO_clusterUDP(); |
---|
| 48 | virtual ~dataIO_clusterUDP(void); |
---|
| 49 | |
---|
[59] | 50 | void init( osg::ArgumentParser& arguments_, clustermode clusterMode_, osgVisual::dataIO_transportContainer* sendContainer_, bool compressionEnabled_, bool asAscii_ ); |
---|
[32] | 51 | void shutdown(); |
---|
| 52 | |
---|
| 53 | bool sendTO_OBJvaluesToSlaves(); |
---|
| 54 | bool readTO_OBJvaluesFromMaster(); |
---|
| 55 | void reportAsReadyToSwap(); |
---|
| 56 | bool waitForSwap(); |
---|
| 57 | bool waitForAllReadyToSwap(); |
---|
| 58 | bool sendSwapCommand(); |
---|
| 59 | |
---|
| 60 | private: |
---|
| 61 | bool compressionEnabled; |
---|
| 62 | osg::ref_ptr<osgDB::Options> readOptions; |
---|
| 63 | osg::ref_ptr<osgDB::Options> writeOptions; |
---|
| 64 | osg::ref_ptr<osgDB::ReaderWriter> rw; |
---|
| 65 | osg::ref_ptr<osgVisual::Broadcaster> broadcaster; |
---|
| 66 | osg::ref_ptr<osgVisual::Receiver> receiver; |
---|
| 67 | }; |
---|
| 68 | |
---|
| 69 | } // END NAMESPACE |
---|