00001
00002
00003
00004
00005
00006
00007 #ifndef __UIUC_CHARM_LIVEVIZ0_H
00008 #define __UIUC_CHARM_LIVEVIZ0_H
00009
00010 #include "conv-ccs.h"
00011 #include "pup.h"
00012 #include "ckvector3d.h"
00013
00014 typedef unsigned char byte;
00015
00017 struct liveVizRequest {
00018 CcsDelayedReply replyToken;
00019 int code;
00020 int wid,ht;
00021
00022 typedef enum {compressionNone=0, compressionJPEG=1, compressionRunLength=2} compressionType_t;
00023 int compressionType;
00024 int compressionQuality;
00025
00026 void pupNetwork(PUP::er &p);
00027 };
00028
00030 struct liveVizRequest3d {
00031 CkVector3d x,y,z,o;
00032 double minZ,maxZ;
00033
00034 void pup(PUP::er &p);
00035 };
00036
00037
00038
00046 void liveViz0Get(const liveVizRequest &req,void *data,int dataLen);
00047
00053 void liveViz0Deposit(const liveVizRequest &req,byte * imageData);
00054
00055
00062 class liveVizConfig {
00063 public:
00064
00065 typedef enum {
00066
00067 pix_greyscale=0,
00068
00069 pix_color=1,
00070
00071 pix_float=2
00072 } pixel_t;
00073
00074 liveVizConfig() { init(pix_greyscale); }
00075
00077 liveVizConfig(bool isColor,bool serverPush_) {
00078 init(isColor?pix_color:pix_greyscale,serverPush_);
00079 }
00080 liveVizConfig(pixel_t pix,bool serverPush_) {
00081 init(pix,serverPush_);
00082 }
00083
00085 liveVizConfig(bool isColor,bool serverPush_,const CkBbox3d &box_) {
00086 init(isColor?pix_color:pix_greyscale,serverPush_);
00087 is3d=true; box=box_;
00088 }
00089 liveVizConfig(pixel_t pix,bool serverPush_,const CkBbox3d &box_) {
00090 init(pix,serverPush_);
00091 is3d=true; box=box_;
00092 }
00093
00095 void moreVerbose(void) {verbose++;}
00096
00098 bool getColor(void) const {return pixels==pix_color;}
00100 int getBytesPerPixel(void) const {return bytesPerPixel;}
00102 int getNetworkBytesPerPixel(void) const {return (pixels==pix_greyscale)?1:3;}
00103 bool getPush(void) const {return serverPush;}
00104 bool get3d(void) const {return is3d;}
00105 const CkBbox3d &getBox(void) const {return box;}
00106 bool getVerbose(int thanLevel) const {return verbose>=thanLevel;}
00107
00108 void pupNetwork(PUP::er &p);
00109
00110 private:
00111 pixel_t pixels;
00112 int bytesPerPixel;
00113
00122 bool serverPush;
00123
00124 bool is3d;
00125 CkBbox3d box;
00126
00127 int verbose;
00128
00129 void init(pixel_t pix,bool serverPush=false);
00130 };
00131
00132
00138 void liveViz0Init(const liveVizConfig &cfg);
00139 void liveViz0PollInit();
00140
00141
00142
00143 class imageUnit{
00144 public:
00145 int bpp;
00146 int wid;
00147 int ht;
00148 byte * imageData;
00149
00150 int len(){return bpp*wid*ht;}
00151
00152 imageUnit(int _bpp, int _wid, int _ht, byte*_imageData){
00153 bpp=_bpp;
00154 wid=_wid;
00155 ht=_ht;
00156 imageData=_imageData;
00157 }
00158
00159 imageUnit(){}
00160 };
00161
00162
00163
00164
00165 #endif
00166