Back to index

salome-gui  6.5.0
Public Types | Public Member Functions | Protected Attributes
SVTK_ImageWriterMgr Class Reference

#include <SVTK_ImageWriterMgr.h>

Collaboration diagram for SVTK_ImageWriterMgr:
Collaboration graph
[legend]

List of all members.

Public Types

typedef std::vector
< SVTK_ImageWriter * > 
TWriterThreads

Public Member Functions

 SVTK_ImageWriterMgr ()
 ~SVTK_ImageWriterMgr ()
void StartImageWriter (vtkImageData *theImageData, const std::string &theName, const int theProgressive, const int theQuality)
void Stop ()

Protected Attributes

TWriterThreads myThreads
QSemaphore * mySemaphore

Detailed Description

Definition at line 31 of file SVTK_ImageWriterMgr.h.


Member Typedef Documentation

Definition at line 46 of file SVTK_ImageWriterMgr.h.


Constructor & Destructor Documentation

Definition at line 38 of file SVTK_ImageWriterMgr.cxx.

{
  int aMax = std::numeric_limits<int>::max() / 2;
  mySemaphore = new QSemaphore(aMax);
  mySemaphore->acquire( aMax );
  if(MYDEBUG) cout<<"SVTK_ImageWriterMgr::SVTK_ImageWriterMgr "<<
                //"- total = "<<mySemaphore->total()<<
                "; available = "<<mySemaphore->available()<<endl;
}

Definition at line 51 of file SVTK_ImageWriterMgr.cxx.

{
  Stop();
  delete mySemaphore;
}

Member Function Documentation

void SVTK_ImageWriterMgr::StartImageWriter ( vtkImageData *  theImageData,
const std::string &  theName,
const int  theProgressive,
const int  theQuality 
)

Definition at line 61 of file SVTK_ImageWriterMgr.cxx.

{
  SVTK_ImageWriter *anImageWriter = 
    new SVTK_ImageWriter(mySemaphore,
                         theImageData,
                         theName,
                         theProgressive,
                         theQuality);
  myThreads.push_back(anImageWriter);

  anImageWriter->start();

}

Definition at line 82 of file SVTK_ImageWriterMgr.cxx.

{
  if(MYDEBUG) cout<<"SVTK_ImageWriterMgr::Stop "<<
                //"- total = "<<mySemaphore->total()<<
                "; available = "<<mySemaphore->available()<<endl;
  if(MYDEBUG) cout<<"SVTK_ImageWriterMgr::Stop - *mySemaphore += "<<myThreads.size()<<endl;
  mySemaphore->acquire( myThreads.size() );

  for(size_t anId = 0, anEnd = myThreads.size(); anId < anEnd; anId++){
    SVTK_ImageWriter* anImageWriter = myThreads[anId];
    anImageWriter->wait();
    delete anImageWriter;
  }
  myThreads.clear();
}

Member Data Documentation

QSemaphore* SVTK_ImageWriterMgr::mySemaphore [protected]

Definition at line 51 of file SVTK_ImageWriterMgr.h.

Definition at line 49 of file SVTK_ImageWriterMgr.h.


The documentation for this class was generated from the following files: