[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 "osg/referenced" |
---|
| 19 | |
---|
| 20 | #include "dataIO_slot.h" |
---|
| 21 | |
---|
| 22 | #include "dataIO_transportContainer.h" |
---|
| 23 | |
---|
| 24 | |
---|
| 25 | namespace osgVisual |
---|
| 26 | { |
---|
| 27 | |
---|
| 28 | /** |
---|
| 29 | * \brief This class is the interface definition class for valid cluster implementations. |
---|
| 30 | * |
---|
| 31 | * This class is an abstract class, thus cannot be instantiated. Derive this class for usage. |
---|
| 32 | * |
---|
| 33 | * @author Torben Dannhauer |
---|
| 34 | * @date Feb 2010 |
---|
| 35 | */ |
---|
| 36 | class dataIO_cluster : public osg::Referenced |
---|
| 37 | { |
---|
| 38 | public: |
---|
| 39 | /** |
---|
[59] | 40 | * This enum defines the three modi of the cluster engine. |
---|
| 41 | */ |
---|
| 42 | enum clustermode {MASTER, SLAVE, STANDALONE}; |
---|
| 43 | |
---|
| 44 | /** |
---|
[32] | 45 | * \brief Empty constructor. |
---|
| 46 | * |
---|
| 47 | */ |
---|
| 48 | dataIO_cluster() {} |
---|
| 49 | |
---|
| 50 | /** |
---|
| 51 | * \brief Empty destructor |
---|
| 52 | * |
---|
| 53 | * @return |
---|
| 54 | */ |
---|
| 55 | virtual ~dataIO_cluster() {} |
---|
| 56 | |
---|
| 57 | /** |
---|
| 58 | * \brief Pure virtual function for initialization. Must be implemented in derived class. |
---|
| 59 | * |
---|
| 60 | */ |
---|
[59] | 61 | virtual void init( osg::ArgumentParser& arguments_, clustermode clusterMode_, osgVisual::dataIO_transportContainer* sendContainer_, bool compressionEnabled_, bool asAscii_ ) = 0; |
---|
[32] | 62 | |
---|
| 63 | |
---|
| 64 | virtual void shutdown() = 0; |
---|
| 65 | |
---|
| 66 | /** |
---|
| 67 | * \brief This function sets the current transportContainer the cluster should send. |
---|
| 68 | * |
---|
| 69 | * The previous container is removed, if set. (smartpointer, will delete itself.). If the cluster is in slave mode, the send_container is ignored. |
---|
| 70 | * |
---|
| 71 | * @param sendContainer_ : New container to set. |
---|
| 72 | */ |
---|
| 73 | void setSendTransportContainer( osgVisual::dataIO_transportContainer* sendContainer_ ) {sendContainer=sendContainer_;} |
---|
| 74 | |
---|
| 75 | /** |
---|
| 76 | * \brief Pure virtual function for sending TO_OBJ values via cluster to slave. Must be implemented in derived class. |
---|
| 77 | * |
---|
| 78 | * @return : See derived class. |
---|
| 79 | */ |
---|
| 80 | virtual bool sendTO_OBJvaluesToSlaves() = 0; |
---|
| 81 | |
---|
| 82 | /** |
---|
| 83 | * \brief Pure virtual function for reading TO_OBJ values from master. Must be implemented in derived class. |
---|
| 84 | * |
---|
| 85 | * @return : See derived class. |
---|
| 86 | */ |
---|
| 87 | virtual bool readTO_OBJvaluesFromMaster() = 0; |
---|
| 88 | |
---|
| 89 | /** |
---|
| 90 | * \brief Pure virtual function for reporting slave as ready to swap. Must be implemented in derived class. |
---|
| 91 | * |
---|
| 92 | */ |
---|
| 93 | virtual void reportAsReadyToSwap() = 0; |
---|
| 94 | |
---|
| 95 | /** |
---|
| 96 | * \brief Pure virtual function for waiting as slave for swap command. Must be implemented in derived class. |
---|
| 97 | * |
---|
| 98 | * @return : See derived class. |
---|
| 99 | */ |
---|
| 100 | virtual bool waitForSwap() = 0; |
---|
| 101 | |
---|
| 102 | /** |
---|
| 103 | * \brief Pure virtual function for waiting as master for all slaves reported as ready to swap. Must be implemented in derived class. |
---|
| 104 | * |
---|
| 105 | * @return : See derived class. |
---|
| 106 | */ |
---|
| 107 | virtual bool waitForAllReadyToSwap() = 0; |
---|
| 108 | |
---|
| 109 | /** |
---|
| 110 | * \brief Pure virtual function for sending swap command to all slaves. Must be implemented in derived class. |
---|
| 111 | * |
---|
| 112 | * @return : See derived class. |
---|
| 113 | */ |
---|
| 114 | virtual bool sendSwapCommand() = 0; |
---|
| 115 | |
---|
| 116 | |
---|
| 117 | |
---|
| 118 | protected: |
---|
| 119 | osg::ref_ptr<osgVisual::dataIO_transportContainer> sendContainer; |
---|
| 120 | }; |
---|
| 121 | |
---|
| 122 | } // END NAMESPACE |
---|