source: osgVisual/src/cluster/dataIO_clusterAsioTcpIostream.cpp @ 62

Last change on this file since 62 was 62, checked in by Torben Dannhauer, 14 years ago
File size: 3.4 KB
Line 
1/* -*-c++-*- osgVisual - Copyright (C) 2009-2010 Torben Dannhauer
2 *
3 * This library is based on OpenSceneGraph, open source and may be redistributed and/or modified under
4 * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or
5 * (at your option) any later version.  The full license is in LICENSE file
6 * included with this distribution, and on the openscenegraph.org website.
7 *
8 * osgVisual requires for some proprietary modules a license from the correspondig manufacturer.
9 * You have to aquire licenses for all used proprietary modules.
10 *
11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14 * OpenSceneGraph Public License for more details.
15*/
16
17#include "dataIO_clusterAsioTcpIostream.h"
18
19using namespace osgVisual;
20
21using boost::asio::ip::tcp;
22
23dataIO_clusterAsioTcpIostream::dataIO_clusterAsioTcpIostream() 
24{
25        OSG_NOTIFY(osg::ALWAYS) << "dataIO_clusterAsioTcpIostream constructed" << std::endl;
26
27        port = 5678;
28        initialized = false;
29}
30
31dataIO_clusterAsioTcpIostream::~dataIO_clusterAsioTcpIostream()
32{
33        OSG_NOTIFY(osg::ALWAYS) << "dataIO_clusterAsioTcpIostream destructed" << std::endl;
34}
35
36void dataIO_clusterAsioTcpIostream::init( osg::ArgumentParser& arguments_, clustermode clusterMode_, osgVisual::dataIO_transportContainer* sendContainer_, bool compressionEnabled_, bool asAscii_ )
37{
38        OSG_NOTIFY(osg::ALWAYS) << "dataIO_clusterAsioTcpIostream initialized" << std::endl;
39
40        clusterMode = clusterMode_;
41
42        if(clusterMode == osgVisual::dataIO_cluster::MASTER)
43        {
44               
45
46                tcp::endpoint endpoint(tcp::v4(), port);
47                tcp::acceptor acceptor(io_service, endpoint);
48
49                                                                                tcp::iostream stream;
50                                                                       
51                                                                                acceptor.accept(*stream.rdbuf());
52                                                                                tcp::no_delay option(true);
53                                                                                boost::system::error_code ec;
54                                                                                stream.rdbuf()->set_option(option, ec);
55                                                                                if (ec)
56                                                                                {
57                                                                                        OSG_NOTIFY(osg::WARN) << "Error: Unable to set TCP_NODELAY option" << ec << std::endl;
58                                                                                        // An error occurred.
59                                                                                }
60        }
61
62        if(clusterMode == osgVisual::dataIO_cluster::SLAVE)
63        {
64
65        }
66
67        initialized = true;
68}
69
70void dataIO_clusterAsioTcpIostream::shutdown()
71{
72        OSG_NOTIFY(osg::ALWAYS) << "dataIO_clusterAsioTcpIostream shut down" << std::endl;
73
74        if(initialized)
75        {
76
77        }
78}
79
80bool dataIO_clusterAsioTcpIostream::sendTO_OBJvaluesToSlaves()
81{
82        OSG_NOTIFY(osg::INFO) << "dataIO_clusterAsioTcpIostream::sendTO_OBJvaluesToSlaves()" << std::endl;
83
84        return true;
85}
86
87bool dataIO_clusterAsioTcpIostream::readTO_OBJvaluesFromMaster()
88{
89        OSG_NOTIFY(osg::INFO) << "dataIO_clusterAsioTcpIostream::readTO_OBJvaluesFromMaster()" << std::endl;
90
91        return true;
92}
93
94void dataIO_clusterAsioTcpIostream::reportAsReadyToSwap()
95{
96        OSG_NOTIFY(osg::INFO) << "dataIO_clusterAsioTcpIostream::reportAsReadyToSwap()" << std::endl;
97}
98
99bool dataIO_clusterAsioTcpIostream::waitForSwap()
100{
101        OSG_NOTIFY(osg::INFO) << "dataIO_clusterAsioTcpIostream::waitForAllReadyToSwap()" << std::endl;
102
103        return true;
104}
105
106bool dataIO_clusterAsioTcpIostream::waitForAllReadyToSwap()
107{
108        OSG_NOTIFY(osg::INFO) << "dataIO_clusterAsioTcpIostream::waitForAllReadyToSwap()" << std::endl;
109
110        return true;
111}
112
113bool dataIO_clusterAsioTcpIostream::sendSwapCommand()
114{
115        OSG_NOTIFY(osg::INFO) << "dataIO_clusterAsioTcpIostream::sendSwapCommand()" << std::endl;
116
117        return true;
118}
Note: See TracBrowser for help on using the repository browser.