#include <HxRgbBuffer.h>
Public Methods | |
HxRgbBuffer (HxCorba::RgbBuffer_ptr buf, int nPixels) | |
Constructor, using RgbBuffer. More... | |
HxRgbBuffer (int nPixels) | |
Constructor, not using RgbBuffer. More... | |
virtual | ~HxRgbBuffer () |
Destructor. More... | |
int * | getBuffer () |
Get the internal buffer. More... | |
HxCorba::RgbSeq * | makeRgbSeq () |
Turn the internal buffer into an RgbSeq. More... |
NOTE that HxRgbBuffer and RgbBuffer are different.
The actual transfer mechanism depends on whether we use an RgbBuffer and, if we use an RgbBuffer, on whether (the servant for) the RgbBuffer object resides in this server or another server. This class handles these differences in a (sort of) transparent way.
An HxRgbBuffer operates in one of three modes:
|
Constructor, using RgbBuffer.
00015 { 00016 _nPixels = nPixels; 00017 _rgbBuffer = buf; 00018 00019 PortableServer::Servant servant = HxServer::instance()->getServant(buf); 00020 00021 if(servant != NULL) { //in-proc pixelBuffer 00022 HxRgbBufferServant* pixbuff = dynamic_cast<HxRgbBufferServant*>(servant); 00023 _intBuffer = pixbuff->getBuffer(); 00024 servant->_remove_ref(); 00025 _haveToSend = false; 00026 } 00027 else { 00028 CORBA::Long* data = HxCorba::RgbSeq::allocbuf(_nPixels); 00029 _intBuffer = (int*)data; 00030 _haveToSend = true; 00031 } 00032 } |
|
Constructor, not using RgbBuffer.
00035 { 00036 _nPixels = nPixels; 00037 CORBA::Long* data = HxCorba::RgbSeq::allocbuf(_nPixels); 00038 _intBuffer = (int*)data; 00039 _haveToSend = false; 00040 } |
|
Destructor. Will check whether data from the internal buffer has to be send to the RgbBuffer.
00044 { 00045 if(_haveToSend) { 00046 HxCorba::RgbSeq_var seq = makeRgbSeq(); 00047 _rgbBuffer->setRgb(seq.in()); 00048 } 00049 00050 //The _intBuffer is deleted by the RgbSeq_var 00051 } |
|
Get the internal buffer.
00055 { 00056 return _intBuffer; 00057 } |
|
Turn the internal buffer into an RgbSeq.
00061 { 00062 CORBA::Long* data = (CORBA::Long*)_intBuffer; 00063 return new HxCorba::RgbSeq(_nPixels, _nPixels, data, true); 00064 } |