00001 /* 00002 Copyright (c) 2010, Dan Bethell, Johannes Saam. 00003 All rights reserved. 00004 00005 Redistribution and use in source and binary forms, with or without modification, 00006 are permitted provided that the following conditions are met: 00007 00008 * Redistributions of source code must retain the above copyright notice, 00009 this list of conditions and the following disclaimer. 00010 00011 * Redistributions in binary form must reproduce the above copyright notice, 00012 this list of conditions and the following disclaimer in the documentation 00013 and/or other materials provided with the distribution. 00014 00015 * Neither the name of RmanConnect nor the names of its contributors may be 00016 used to endorse or promote products derived from this software without 00017 specific prior written permission. 00018 00019 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 00020 ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 00021 WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 00022 DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR 00023 ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 00024 (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 00025 LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON 00026 ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 00027 (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 00028 SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 00029 */ 00030 00031 #ifndef RMAN_CONNECT_DATA_H_ 00032 #define RMAN_CONNECT_DATA_H_ 00033 00034 #include <vector> 00035 00037 namespace rmanconnect 00038 { 00051 class Data 00052 { 00053 friend class Client; 00054 friend class Server; 00055 public: 00057 Data( int x=0, int y=0, 00058 int width=0, int height=0, 00059 int spp=0, const float *data=0 ); 00061 ~Data(); 00062 00069 const int type() const { return mType; } 00070 00072 int x() const { return mX; } 00074 int y() const { return mY; } 00076 int width() const { return mWidth; } 00078 int height() const { return mHeight; } 00080 int spp() const { return mSpp; } 00082 const float *data() const { return mpData; } 00084 const float *pixels() const { return &mPixelStore[0]; } 00085 00086 private: 00087 // what type of data is this? 00088 int mType; 00089 00090 // x & y position 00091 int mX, mY; 00092 00093 // width, height, num channels (samples) 00094 unsigned int mWidth, mHeight, mSpp; 00095 00096 // our pixel data pointer (for driver-owned pixels) 00097 float *mpData; 00098 00099 // our persistent pixel storage (for Data-owned pixels) 00100 std::vector<float> mPixelStore; 00101 }; 00102 } 00103 00104 #endif // RMAN_CONNECT_DATA_H_