dataProxy.h

00001 /*
00002  * Copyright (c) 2009, Philippe Robert <probert@eyescale.ch> 
00003  *
00004  * This library is free software; you can redistribute it and/or modify it under
00005  * the terms of the GNU Lesser General Public License version 2.1 as published
00006  * by the Free Software Foundation.
00007  *  
00008  * This library is distributed in the hope that it will be useful, but WITHOUT
00009  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
00010  * FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public License for more
00011  * details.
00012  * 
00013  * You should have received a copy of the GNU Lesser General Public License
00014  * along with this library; if not, write to the Free Software Foundation, Inc.,
00015  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
00016  */
00017 
00018 #ifndef EQNBODY_DATAPROXY_H
00019 #define EQNBODY_DATAPROXY_H
00020 
00021 #include <eq/eq.h>
00022 
00023 namespace eqNbody
00024 {
00025     class DataProxy : public eq::Object
00026     {
00027     public:
00028 
00029         DataProxy();
00030 
00031         void init(const unsigned int offset, const unsigned int numBytes, float *pos, float *vel, float *col);
00032         void init(float *pos, float *vel, float *col);
00033         void exit();    
00034         
00035         void markDirty();
00036 
00037         unsigned int getOffset() const {return _offset;}
00038         unsigned int getNumBytes() const {return _numBytes;}
00039         
00040         float* getPosition() const {return _hPos;}
00041         float* getVelocity() const {return _hVel;}
00042         
00043     protected:
00044         virtual void serialize( eq::net::DataOStream& os, const uint64_t dirtyBits );
00045         virtual void deserialize( eq::net::DataIStream& is, const uint64_t dirtyBits );
00046 
00047         enum DirtyBits
00048         {
00049             DIRTY_DATA   = eq::Object::DIRTY_CUSTOM << 0
00050         };
00051         
00052     private:                
00053         unsigned int _offset;   // offset into the frameData's memory chunk
00054         unsigned int _numBytes; // number of bytes to be written
00055         
00056         float*  _hPos;          // frameData's position data on the host
00057         float*  _hVel;          // frameData's velocity data on the host
00058         float*  _hCol;          // frameData's color data on the host
00059     };
00060 }
00061 
00062 
00063 #endif // EQNBODY_DATAPROXY_H
00064 
Generated on Mon Aug 10 18:58:32 2009 for Equalizer 0.9 by  doxygen 1.5.8