Horus Doc || Corba Reference || Corba   Client Server   Stubs C++   Stubs Java   Servant Generator  

HxRgbBuffer Class Reference

Helper class for transfering RGB data from an "image data object" to an RgbBuffer and/or an RgbSeq. More...

#include <HxRgbBuffer.h>

List of all members.

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::RgbSeqmakeRgbSeq ()
 Turn the internal buffer into an RgbSeq. More...


Detailed Description

Helper class for transfering RGB data from an "image data object" to an RgbBuffer and/or an RgbSeq.

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:

  1. There is no RgbBuffer. In this case an internal buffer is allocated that is compatible with RgbSeq.
  2. There is an RgbBuffer and its servant resides in this Horus server. In this case, the internal buffer of the servant is used as the internal buffer of this HxRgbBuffer.
  3. There is an RgbBuffer but its servant resides in some other Horus server. In this case an internal buffer is allocated that is compatible with RgbSeq and the destructor of this HxRgbBuffer uses an RgbSeq to transfer the data to the servant.
For typical use of this class without an RgbBuffer see HxImageRepTiedSvt::getRgb2d. For typical use of this class with an RgbBuffer see HxImageRepTiedSvt::fillRgb2d


Constructor & Destructor Documentation

HxRgbBuffer::HxRgbBuffer HxCorba::RgbBuffer_ptr    buf,
int    nPixels
 

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 }

HxRgbBuffer::HxRgbBuffer int    nPixels
 

Constructor, not using RgbBuffer.

00035 {
00036     _nPixels = nPixels;
00037     CORBA::Long* data = HxCorba::RgbSeq::allocbuf(_nPixels);
00038     _intBuffer = (int*)data;
00039     _haveToSend = false;
00040 }

HxRgbBuffer::~HxRgbBuffer   [virtual]
 

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 }


Member Function Documentation

int * HxRgbBuffer::getBuffer  
 

Get the internal buffer.

00055 {
00056     return _intBuffer;
00057 }

HxCorba::RgbSeq * HxRgbBuffer::makeRgbSeq  
 

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 }


The documentation for this class was generated from the following files:
Generated on Tue Feb 3 14:20:16 2004 for CorbaReference by doxygen1.2.12 written by Dimitri van Heesch, © 1997-2001