class SalomeApp_Module;
class VisuGUI_InputPane;
-namespace VISU{
+namespace VISU
+{
class CutLines_i;
}
// this, SLOT(onWindowActivated(SUIT_ViewWindow*)));
}
+VisuGUI_CutPlanesDlg::~VisuGUI_CutPlanesDlg()
+{}
+
void VisuGUI_CutPlanesDlg::initFromPrsObject (VISU::ColoredPrs3d_i* thePrs, bool theInit)
{
if( theInit )
#define VISUGUI_CUTPLANESDLG_H
#include "VisuGUI_Prs3dDlg.h"
-#include "VISU_CutPlanes_i.hh"
#include <SALOME_Actor.h>
#include "SALOMEconfig.h"
#include CORBA_CLIENT_HEADER(VISU_Gen)
+namespace VISU
+{
+ class CutPlanes_i;
+};
+
class SUIT_ViewWindow;
class SUIT_ViewManager;
class SalomeApp_Module;
public:
VisuGUI_CutPlanesDlg (SalomeApp_Module* theModule);
- ~VisuGUI_CutPlanesDlg() {};
+ ~VisuGUI_CutPlanesDlg();
virtual void initFromPrsObject(VISU::ColoredPrs3d_i* thePrs, bool theInit = true);
virtual int storeToPrsObject(VISU::ColoredPrs3d_i* thePrs);
connect(buttonHelp, SIGNAL(clicked()), this, SLOT(onHelp()));
}
+VisuGUI_DeformedShapeDlg::~VisuGUI_DeformedShapeDlg()
+{}
+
void VisuGUI_DeformedShapeDlg::initFromPrsObject (VISU::ColoredPrs3d_i* thePrs, bool theInit)
{
if( theInit )
class SalomeApp_Module;
class VisuGUI_InputPane;
-namespace VISU{
+namespace VISU
+{
class DeformedShape_i;
}
public:
VisuGUI_DeformedShapeDlg (SalomeApp_Module* theModule);
- ~VisuGUI_DeformedShapeDlg() {};
+ ~VisuGUI_DeformedShapeDlg();
double getFactor()
{ return ScalFact->value(); }
connect( buttonHelp, SIGNAL( clicked() ), this, SLOT( onHelp() ) );
}
+VisuGUI_GaussPointsDlg::~VisuGUI_GaussPointsDlg()
+{}
+
void VisuGUI_GaussPointsDlg::initFromPrsObject(VISU::ColoredPrs3d_i* thePrs, bool theInit)
{
if( theInit )
public:
VisuGUI_GaussPointsDlg (SalomeApp_Module* theModule, bool SetPref = FALSE);
- ~VisuGUI_GaussPointsDlg() {}
+ ~VisuGUI_GaussPointsDlg();
//! Initializing dialog from the Gauss Points presentation.
virtual void initFromPrsObject(VISU::ColoredPrs3d_i* thePrs, bool theInit = true);
connect( buttonHelp, SIGNAL( clicked() ), this, SLOT( onHelp() ) );
}
+VisuGUI_IsoSurfacesDlg::~VisuGUI_IsoSurfacesDlg()
+{}
+
void VisuGUI_IsoSurfacesDlg::accept()
{
if (myIsoPane->check() && myScalarPane->check())
#define VISUGUI_ISOSURFACESDLG_H
#include "VisuGUI_Prs3dDlg.h"
-#include "VISU_IsoSurfaces_i.hh"
#include <qdialog.h>
#include <qlabel.h>
#include <qlineedit.h>
#include <qtabwidget.h>
+namespace VISU
+{
+ class IsoSurfaces_i;
+};
+
class SalomeApp_Module;
class VisuGUI_InputPane;
public:
VisuGUI_IsoSurfacesDlg (SalomeApp_Module* theModule);
- ~VisuGUI_IsoSurfacesDlg() {};
+ ~VisuGUI_IsoSurfacesDlg();
virtual void initFromPrsObject(VISU::ColoredPrs3d_i* thePrs, bool theInit = true);
virtual int storeToPrsObject(VISU::ColoredPrs3d_i* thePrs);
//purpose :
//=======================================================================
VisuGUI_Plot3DPane::~VisuGUI_Plot3DPane()
-{
-}
+{}
//=======================================================================
//function : storePrsParams
connect(buttonHelp, SIGNAL(clicked()), this, SLOT(onHelp()));
}
+VisuGUI_Plot3DDlg::~VisuGUI_Plot3DDlg()
+{}
+
//=======================================================================
//function : accept
//purpose :
#include "VisuGUI_Prs3dDlg.h"
-#include "VISU_Plot3D_i.hh"
-
#include <qhbuttongroup.h>
#include <qtabwidget.h>
class SalomeApp_Module;
class VisuGUI_InputPane;
-namespace VISU {
+namespace VISU
+{
class Plot3D_i;
};
public:
VisuGUI_Plot3DDlg (SalomeApp_Module* theModule);
- ~VisuGUI_Plot3DDlg() {};
+ ~VisuGUI_Plot3DDlg();
virtual void initFromPrsObject(VISU::ColoredPrs3d_i* thePrs, bool theInit = true);
virtual int storeToPrsObject(VISU::ColoredPrs3d_i* thePrs);
connect( buttonHelp, SIGNAL( clicked() ), this, SLOT( onHelp() ) );
}
+VisuGUI_ScalarBarDlg::~VisuGUI_ScalarBarDlg()
+{}
+
/*!
Called when <OK> button is clicked, validates data and closes dialog
*/
#include "QtxDblSpinBox.h"
-#include "VISU_ScalarMap_i.hh"
-
class VisuGUI_InputPane;
+namespace VISU
+{
+ class ScalarMap_i;
+}
+
class VisuGUI_ScalarBarDlg : public VisuGUI_Prs3dDlg
{
Q_OBJECT;
public:
VisuGUI_ScalarBarDlg (SalomeApp_Module* theModule, bool SetPref = FALSE);
- ~VisuGUI_ScalarBarDlg() {};
+ ~VisuGUI_ScalarBarDlg();
bool isToSave() {return myScalarPane->isToSave();}
connect(myTimeStampsCombo, SIGNAL(activated(int)), this, SLOT(onTimeStampChanged(int)));
}
+VisuGUI_ScalarMapOnDeformedShapeDlg::~VisuGUI_ScalarMapOnDeformedShapeDlg()
+{}
+
void VisuGUI_ScalarMapOnDeformedShapeDlg::initFromPrsObject(VISU::ColoredPrs3d_i* thePrs, bool theInit)
{
if( theInit )
class SalomeApp_Module;
class VisuGUI_InputPane;
-namespace VISU{
+namespace VISU
+{
class ScalarMapOnDeformedShape_i;
}
public:
VisuGUI_ScalarMapOnDeformedShapeDlg (SalomeApp_Module* theModule);
- ~VisuGUI_ScalarMapOnDeformedShapeDlg() {};
+ ~VisuGUI_ScalarMapOnDeformedShapeDlg();
double getFactor()
{ return ScalFact->value(); }
enableSetColor();
}
+VisuGUI_StreamLinesDlg::~VisuGUI_StreamLinesDlg()
+{}
void VisuGUI_StreamLinesDlg::initFromPrsObject (VISU::ColoredPrs3d_i* thePrs, bool theInit)
{
class VisuGUI_InputPane;
class QtxDblSpinBox;
-namespace VISU{
+namespace VISU
+{
class StreamLines_i;
}
Q_OBJECT
public:
VisuGUI_StreamLinesDlg (SalomeApp_Module* theModule);
- ~VisuGUI_StreamLinesDlg() {};
+ ~VisuGUI_StreamLinesDlg();
virtual void initFromPrsObject(VISU::ColoredPrs3d_i* thePrs, bool theInit = true);
virtual int storeToPrsObject(VISU::ColoredPrs3d_i* thePrs);
enableSetColor();
}
-
+VisuGUI_VectorsDlg::~VisuGUI_VectorsDlg()
+{}
void VisuGUI_VectorsDlg::initFromPrsObject(VISU::ColoredPrs3d_i* thePrs, bool theInit) {
if( theInit )
class SalomeApp_Module;
class VisuGUI_InputPane;
-namespace VISU{
+namespace VISU
+{
class Vectors_i;
}
public:
VisuGUI_VectorsDlg (SalomeApp_Module* theModule);
- ~VisuGUI_VectorsDlg() {};
+ ~VisuGUI_VectorsDlg();
void setScaleFactor( double sf );
double getScaleFactor();
// Module : SALOME
#include "SALOME_GenericObjPointer.hh"
-
-using namespace SALOME;
-
-//----------------------------------------------------------------------------
-GenericObjPtrBase
-::GenericObjPtrBase() :
- Object(0)
-{
- // Add a reference to the object.
- this->Register();
-}
-
-//----------------------------------------------------------------------------
-GenericObjPtrBase
-::GenericObjPtrBase(GenericObj_i* r):
- Object(r)
-{
- // Add a reference to the object.
- this->Register();
-}
-
-//----------------------------------------------------------------------------
-GenericObjPtrBase
-::GenericObjPtrBase(const GenericObjPtrBase& r):
- Object(r.Object)
-{
- // Add a reference to the object.
- this->Register();
-}
-
-//----------------------------------------------------------------------------
-GenericObjPtrBase
-::GenericObjPtrBase(GenericObj_i* r, const GenericObjPtrBase::NoReference&):
- Object(r)
-{
- // Do not add a reference to the object because we received the
- // NoReference argument.
-}
-
-//----------------------------------------------------------------------------
-GenericObjPtrBase
-::~GenericObjPtrBase()
-{
- // The main pointer must be set to NULL before calling UnRegister,
- // so use a local variable to save the pointer. This is because the
- // garbage collection reference graph traversal may make it back to
- // this smart pointer, and we do not want to include this reference.
- if(GenericObj_i* object = this->Object)
- {
- this->Object = 0;
- object->Destroy();
- }
-}
-
-//----------------------------------------------------------------------------
-GenericObjPtrBase&
-GenericObjPtrBase
-::operator=(GenericObj_i* r)
-{
- // This is an exception-safe assignment idiom that also gives the
- // correct order of register/unregister calls to all objects
- // involved. A temporary is constructed that references the new
- // object. Then the main pointer and temporary are swapped and the
- // temporary's destructor unreferences the old object.
- GenericObjPtrBase(r).Swap(*this);
- return *this;
-}
-
-//----------------------------------------------------------------------------
-GenericObjPtrBase&
-GenericObjPtrBase
-::operator=(const GenericObjPtrBase& r)
-{
- // This is an exception-safe assignment idiom that also gives the
- // correct order of register/unregister calls to all objects
- // involved. A temporary is constructed that references the new
- // object. Then the main pointer and temporary are swapped and the
- // temporary's destructor unreferences the old object.
- GenericObjPtrBase(r).Swap(*this);
- return *this;
-}
-
-//----------------------------------------------------------------------------
-void GenericObjPtrBase
-::Swap(GenericObjPtrBase& r)
-{
- // Just swap the pointers. This is used internally by the
- // assignment operator.
- GenericObj_i* temp = r.Object;
- r.Object = this->Object;
- this->Object = temp;
-}
-
-//----------------------------------------------------------------------------
-void GenericObjPtrBase
-::Register()
-{
- // Add a reference only if the object is not NULL.
- if(this->Object)
- this->Object->Register();
-}
#ifndef SALOME_GenericObjPointer_HH
#define SALOME_GenericObjPointer_HH
-#include "SALOME_GenericObj_i.hh"
+#include "SALOMEconfig.h"
+#include CORBA_SERVER_HEADER(SALOME_GenericObj)
+
+#include <iosfwd> // for std::basic_ostream
namespace SALOME
{
- class GenericObjPtrBase
+ //----------------------------------------------------------------------------
+ template <class TGenericObj>
+ class GenericObjPtr
{
- public:
- // Description:
- // Initialize smart pointer to NULL.
- GenericObjPtrBase();
-
- // Description:
- // Initialize smart pointer to given object.
- GenericObjPtrBase( GenericObj_i* );
-
- // Description:
- // Initialize smart pointer with a new reference to the same object
- // referenced by given smart pointer.
- GenericObjPtrBase( const GenericObjPtrBase& );
-
- // Description:
- // Destroy smart pointer and remove the reference to its object.
- ~GenericObjPtrBase();
-
- // Description:
- // Assign object to reference. This removes any reference to an old object.
- GenericObjPtrBase& operator=( GenericObj_i* );
- GenericObjPtrBase& operator=( const GenericObjPtrBase& );
-
- // Description:
- // Get the contained pointer.
- GenericObj_i* GetPointer() const
+ //! Pointer to the actual object.
+ TGenericObj* myPointer;
+
+ void
+ swap(GenericObjPtr& thePointer)
{
- return this->Object;
+ TGenericObj* aPointer = thePointer.myPointer;
+ thePointer.myPointer = this->myPointer;
+ this->myPointer = aPointer;
}
- protected:
- // Initialize smart pointer to given object, but do not increment
- // reference count. The destructor will still decrement the count.
- // This effectively makes it an auto-ptr.
- class NoReference {};
- GenericObjPtrBase(GenericObj_i* r, const NoReference&);
-
- // Pointer to the actual object.
- GenericObj_i* Object;
+ void
+ Register()
+ {
+ if(this->myPointer)
+ this->myPointer->Register();
+ }
- private:
- // Internal utility methods.
- void Swap( GenericObjPtrBase& );
- void Register();
- };
+ void
+ Destroy()
+ {
+ if(this->myPointer){
+ this->myPointer->Destroy();
+ this->myPointer = NULL;
+ }
+ }
- template <class T>
- class GenericObjPtr: public GenericObjPtrBase
- {
public:
- // Description:
- // Initialize smart pointer to NULL.
- GenericObjPtr() {}
-
- // Description:
- // Initialize smart pointer to given object.
- GenericObjPtr(T* r): GenericObjPtrBase(r) {}
-
- // Description:
- // Initialize smart pointer with a new reference to the same object
- // referenced by given smart pointer.
- GenericObjPtr(const GenericObjPtrBase& r): GenericObjPtrBase(r) {}
-
- // Description:
- // Assign object to reference. This removes any reference to an old
- // object.
- GenericObjPtr& operator=(T* r)
+ //! Initialize smart pointer to NULL.
+ GenericObjPtr():
+ myPointer(NULL)
+ {}
+
+ //! Initialize smart pointer to given object (TSGenericObj must be complete).
+ template<class TSGenericObj>
+ explicit
+ GenericObjPtr(TSGenericObj* thePointer):
+ myPointer(thePointer)
{
- this->GenericObjPtrBase::operator=(r);
- return *this;
+ this->Register();
+ }
+
+ /*!
+ Initialize smart pointer with a new reference to the same object
+ referenced by given smart pointer.
+ */
+ GenericObjPtr(const GenericObjPtr& thePointer):
+ myPointer(thePointer.myPointer)
+ {
+ this->Register();
+ }
+
+ //! Destroy smart pointer and remove the reference to its object.
+ ~GenericObjPtr()
+ {
+ this->Destroy();
}
- // Description:
- // Assign object to reference. This removes any reference to an old
- // object.
- GenericObjPtr& operator=(const GenericObjPtrBase& r)
+ /*!
+ Assign object to reference. This removes any reference to an old
+ object.
+ */
+ GenericObjPtr&
+ operator=(TGenericObj* thePointer)
{
- this->GenericObjPtrBase::operator=(r);
+ GenericObjPtr(thePointer).swap(*this);
return *this;
}
- // Description:
- // Get the contained pointer.
- T* GetPointer() const
+ /*!
+ Assign object to reference. This removes any reference to an old
+ object.
+ */
+ GenericObjPtr&
+ operator=(const GenericObjPtr& thePointer)
{
- return dynamic_cast<T*>(this->Object);
+ GenericObjPtr(thePointer).swap(*this);
+ return *this;
}
- // Description:
- // Get the contained pointer.
- operator T* () const
+ //! Get the contained pointer.
+ virtual
+ TGenericObj*
+ get() const
{
- return dynamic_cast<T*>(this->Object);
+ return this->myPointer;
}
- // Description:
- // Dereference the pointer and return a reference to the contained
- // object.
- T& operator*() const
+ //! Get the contained pointer.
+ operator TGenericObj* () const
{
- return *dynamic_cast<T*>(this->Object);
+ return this->get();
}
- // Description:
- // Provides normal pointer target member access using operator ->.
- T* operator->() const
+ /*!
+ Dereference the pointer and return a reference to the contained
+ object.
+ */
+ TGenericObj&
+ operator*() const
{
- return dynamic_cast<T*>(this->Object);
+ return *this->get();
}
- // Description:
- // Create an instance of an object.
- static GenericObjPtr<T> New()
+ //! Provides normal pointer target member access using operator ->.
+ TGenericObj* operator->() const
{
- return GenericObjPtr<T>(T::New(), NoReference());
+ return this->get();
}
- protected:
- GenericObjPtr(T* r, const NoReference& n): GenericObjPtrBase(r, n) {}
+ operator bool () const
+ {
+ return this->get() != 0;
+ }
};
}
+template<class T, class U>
+inline
+bool
+operator==(SALOME::GenericObjPtr<T> const & a, SALOME::GenericObjPtr<U> const & b)
+{
+ return a.get() == b.get();
+}
+
+template<class T, class U>
+inline
+bool
+operator!=(SALOME::GenericObjPtr<T> const & a, SALOME::GenericObjPtr<U> const & b)
+{
+ return a.get() != b.get();
+}
+
+template<class Y>
+std::ostream&
+operator<< (std::ostream & os, SALOME::GenericObjPtr<Y> const & p)
+{
+ os << p.get();
+ return os;
+}
+
+
#endif
return aPrs3d;
}
}
- return NULL;
+ return VISU::TPrs3dPtr();
}
const size_t theRawEstimatedMemorySize)
{
VISU::TPrs3dPtr aPrs3d = FindSameFieldPrs(theHolderMap, theInput, theType);
- if(aPrs3d.GetPointer())
+ if(aPrs3d)
return aPrs3d->GetMemorySize();
return CORBA::Float(theRawEstimatedMemorySize/(1024.0*1024.0)); // convert to Mb
}
VISU::TLastVisitedPrsList::iterator aEndIter = thePrsList.end();
for(; anIter != aEndIter; anIter++){
VISU::TPrs3dPtr aPrs3d = *anIter;
- if(aPrs3d.GetPointer() == thePrs3d.GetPointer())
+ if(aPrs3d == thePrs3d)
thePrsList.erase(anIter);
}
}
::RegisterInHolder(VISU::ColoredPrs3d_i* thePrs3d,
const std::string& theHolderEntry)
{
- TPrs3dPtr aPrs3d( thePrs3d );
- thePrs3d->Destroy();
-
- thePrs3d->SetHolderEntry( theHolderEntry );
+ TPrs3dPtr aPrs3d(thePrs3d);
myHolderMap[theHolderEntry].push_front(aPrs3d);
+ thePrs3d->SetHolderEntry( theHolderEntry );
+ thePrs3d->Destroy();
return thePrs3d;
}
VISU::ColoredPrs3dCache_i
::GetLastVisitedPrs(VISU::ColoredPrs3dHolder_i* theHolder)
{
- TLastVisitedPrsList aList = GetLastVisitedPrsList(theHolder);
+ const TLastVisitedPrsList& aList = GetLastVisitedPrsList(theHolder);
if( !aList.empty() )
return aList.front();
-
- return NULL;
+ return VISU::TPrs3dPtr();
}
return aPrs3d;
}
}
- return NULL;
+ return VISU::TPrs3dPtr();
}
std::string aHolderEntry = theHolder->GetEntry();
VISU::VISUType aPrsType = theHolder->GetPrsType();
CORBA::Float aRequiredMemory = 0.0;
- if(aPrs3d.GetPointer()){
+ if(aPrs3d){
aLastVisitedPrsList.push_front(aPrs3d);
if(MYDEBUG) cout << "FindPrsByInput " << aPrs3d << endl;
}else if(anIsCheckPossible && IsPossible(aPrsType, theInput, aRequiredMemory, aHolderEntry)){
for(; aPrsIter != aPrsIterEnd; aPrsIter++)
if(TPrs3dPtr aPrs3d = *aPrsIter)
{
- cout << aPrs3d.GetPointer() << " (" << aPrs3d->GetMemorySize() << " Mb)";
+ cout << aPrs3d << " (" << aPrs3d->GetMemorySize() << " Mb)";
if(aPrsIter == aPrsList.begin())
cout << " (device)";
cout << endl;
struct TPrs3dPtr: SALOME::GenericObjPtr<ColoredPrs3d_i>
{
typedef SALOME::GenericObjPtr<ColoredPrs3d_i> TSuperClass;
- //! Initialize smart pointer to given object.
- TPrs3dPtr(ColoredPrs3d_i* r): TSuperClass(r) {}
-
- //! Initialize smart pointer with a new reference to the same object
- // referenced by given smart pointer.
- TPrs3dPtr(const SALOME::GenericObjPtrBase& r): TSuperClass(r) {}
-
- //! Get the contained pointer.
- ColoredPrs3d_i* GetPointer() const
+
+ //! Initialize smart pointer to NULL.
+ TPrs3dPtr():
+ TSuperClass()
+ {}
+
+ //! Initialize smart pointer to given object (TSGenericObj must be complete).
+ TPrs3dPtr(ColoredPrs3d_i* thePointer):
+ TSuperClass(thePointer)
+ {}
+
+ /*!
+ Initialize smart pointer with a new reference to the same object
+ referenced by given smart pointer.
+ */
+ TPrs3dPtr(const TPrs3dPtr& thePointer):
+ TSuperClass(thePointer)
+ {}
+
+
+ /*!
+ Assign object to reference. This removes any reference to an old
+ object.
+ */
+ TPrs3dPtr&
+ operator=(const TPrs3dPtr& thePointer)
{
- ColoredPrs3d_i* aColoredPrs3d = TSuperClass::GetPointer();
- // To implement postponed restoring of the presentation
- aColoredPrs3d->InitFromRestoringState();
- return aColoredPrs3d;
+ TSuperClass::operator=(thePointer);
+ return *this;
}
- //! Get the contained pointer.
- operator ColoredPrs3d_i* () const
+ /*!
+ Assign object to reference. This removes any reference to an old
+ object.
+ */
+ TPrs3dPtr&
+ operator=(ColoredPrs3d_i* thePointer)
{
- return this->GetPointer();
+ TSuperClass::operator=(thePointer);
+ return *this;
}
- //! Provides normal pointer target member access using operator ->.
- ColoredPrs3d_i* operator->() const
+ //! Get the contained pointer.
+ ColoredPrs3d_i*
+ get() const
{
- return this->GetPointer();
+ ColoredPrs3d_i* aColoredPrs3d = TSuperClass::get();
+ // To implement postponed restoring of the presentation
+ if(aColoredPrs3d)
+ aColoredPrs3d->InitFromRestoringState();
+ return aColoredPrs3d;
}
};
VISU::Prs3d_i
::OnRestoreInput()
{
- SetCResult(myPreviousResult.GetPointer());
+ SetCResult(myPreviousResult);
myMeshName = myPreviousMeshName;
}
VISU::Prs3d_i
::GetCResult() const
{
- return myResult.GetPointer();
+ return myResult;
}
#include "VISU_ActorFactory.h"
#include "VISU_ConvertorDef.hxx"
-#include "SALOME_GenericObj.hh"
+#include "SALOME_GenericObj_i.hh"
#include "SALOME_GenericObjPointer.hh"
#include "SALOME_InteractiveObject.hxx"