mirror of
https://git.dev.opencascade.org/repos/occt.git
synced 2025-08-04 13:13:25 +03:00
0024023: Revamp the OCCT Handle -- general
Missing headers added; includes of headers "Handle_...hxx" removed. Misuses of macro Handle() and its use in typedefs corrected. Alias classes Profile and Option are removed from IFSelect; ones defined in MoniTool are used directly. Removed header files defining only Handle classes (except Image_PixMap_Handle.hxx) Classes SelectMgr_BaseFrustum and now inherit Standard_Transient and can be manipulated by Handle (not NCollection_Handle) Fixed reference-type local variable pointing to temporary object Use of handle in conditional expressions and comparisons to NULL are replaced by call to method IsNull()
This commit is contained in:
@@ -20,7 +20,7 @@ package XSControl
|
||||
-- control of a session
|
||||
|
||||
uses Standard , MMgt, TCollection , TColStd, Dico,
|
||||
Interface, Transfer, IFSelect, Message,
|
||||
Interface, Transfer, IFSelect, Message, MoniTool,
|
||||
TopoDS, TopTools, TopAbs , Geom, Geom2d, gp
|
||||
|
||||
is
|
||||
|
@@ -49,7 +49,7 @@ uses CString, AsciiString, SequenceOfTransient, SequenceOfInteger,
|
||||
FinderProcess from Transfer,
|
||||
Shape from TopoDS,
|
||||
WorkLibrary from IFSelect,
|
||||
Profile from IFSelect,
|
||||
Profile from MoniTool,
|
||||
WorkSession from XSControl,
|
||||
ReturnStatus from IFSelect
|
||||
|
||||
@@ -90,7 +90,7 @@ is
|
||||
-- rsc = False (D) : True Name attached to the Norm (long name)
|
||||
-- rsc = True : Name of the ressource set (i.e. short name)
|
||||
|
||||
Profile (me) returns Profile from IFSelect;
|
||||
Profile (me) returns Profile from MoniTool;
|
||||
---Purpose : Returns the Profile
|
||||
-- It starts with a first configuration Base (empty) and the
|
||||
-- following options :
|
||||
|
@@ -16,13 +16,14 @@
|
||||
#include <Dico_IteratorOfDictionaryOfTransient.hxx>
|
||||
#include <Dico_IteratorOfDictionaryOfInteger.hxx>
|
||||
#include <TColStd_IndexedMapOfTransient.hxx>
|
||||
#include <IFSelect_Option.hxx>
|
||||
#include <MoniTool_Option.hxx>
|
||||
|
||||
#include <IFSelect_SelectModelEntities.hxx>
|
||||
#include <IFSelect_SelectModelRoots.hxx>
|
||||
#include <IFSelect_SelectPointed.hxx>
|
||||
#include <IFSelect_SelectSharing.hxx>
|
||||
#include <IFSelect_SelectShared.hxx>
|
||||
#include <IFSelect_ShareOut.hxx>
|
||||
#include <IFSelect_GraphCounter.hxx>
|
||||
#include <XSControl_SelectForTransfer.hxx>
|
||||
#include <XSControl_ConnectedShapes.hxx>
|
||||
@@ -98,10 +99,10 @@ static TColStd_IndexedMapOfTransient& mapadapt()
|
||||
|
||||
// Initialisation du Profile
|
||||
|
||||
theProfile = new IFSelect_Profile;
|
||||
theProfile = new MoniTool_Profile;
|
||||
|
||||
/* essai option sur parametre
|
||||
Handle(IFSelect_Option) optrdprec = new IFSelect_Option
|
||||
Handle(MoniTool_Option) optrdprec = new MoniTool_Option
|
||||
(Interface_Static::Static ("read.precision.mode"),"readprecision.mode");
|
||||
optrdprec->AddBasic("default","File");
|
||||
optrdprec->AddBasic("Session");
|
||||
@@ -109,24 +110,24 @@ static TColStd_IndexedMapOfTransient& mapadapt()
|
||||
theProfile->AddOption (optrdprec);
|
||||
*/
|
||||
|
||||
// Handle(IFSelect_Option) optproto = new IFSelect_Option
|
||||
// Handle(MoniTool_Option) optproto = new MoniTool_Option
|
||||
// (STANDARD_TYPE(Interface_Protocol),"protocol");
|
||||
// theProfile->AddOption (optproto);
|
||||
|
||||
Handle(IFSelect_Option) optsign = new IFSelect_Option
|
||||
Handle(MoniTool_Option) optsign = new MoniTool_Option
|
||||
(STANDARD_TYPE(IFSelect_Signature),"sign-type");
|
||||
optsign->Add ("default",theSignType);
|
||||
theProfile->AddOption (optsign);
|
||||
|
||||
// Handle(IFSelect_Option) optwlib = new IFSelect_Option
|
||||
// Handle(MoniTool_Option) optwlib = new MoniTool_Option
|
||||
// (STANDARD_TYPE(IFSelect_WorkLibrary),"access");
|
||||
// theProfile->AddOption (optwlib);
|
||||
|
||||
Handle(IFSelect_Option) optactrd = new IFSelect_Option
|
||||
Handle(MoniTool_Option) optactrd = new MoniTool_Option
|
||||
(STANDARD_TYPE(Transfer_ActorOfTransientProcess),"tr-read");
|
||||
theProfile->AddOption (optactrd);
|
||||
|
||||
Handle(IFSelect_Option) optactwr = new IFSelect_Option
|
||||
Handle(MoniTool_Option) optactwr = new MoniTool_Option
|
||||
(STANDARD_TYPE(Transfer_ActorOfFinderProcess),"tr-write");
|
||||
theProfile->AddOption (optactwr);
|
||||
|
||||
@@ -155,7 +156,7 @@ static TColStd_IndexedMapOfTransient& mapadapt()
|
||||
Standard_Boolean deja;
|
||||
Handle(Standard_Transient)& newadapt = listadapt()->NewItem (name,deja);
|
||||
if (deja) {
|
||||
Handle(Standard_Transient) thisadapt = this;
|
||||
Handle(Standard_Transient) thisadapt (this);
|
||||
if (newadapt->IsKind(thisadapt->DynamicType()))
|
||||
{
|
||||
}
|
||||
@@ -177,9 +178,9 @@ static TColStd_IndexedMapOfTransient& mapadapt()
|
||||
Handle(XSControl_Controller) XSControl_Controller::Recorded
|
||||
(const Standard_CString name)
|
||||
{
|
||||
Handle(XSControl_Controller) recorded;
|
||||
Handle(Standard_Transient) recorded;
|
||||
if (!listadapt()->GetItem (name,recorded)) recorded.Nullify();
|
||||
return recorded;
|
||||
return Handle(XSControl_Controller)::DownCast (recorded);
|
||||
}
|
||||
|
||||
Handle(TColStd_HSequenceOfHAsciiString) XSControl_Controller::ListRecorded
|
||||
@@ -211,7 +212,7 @@ static TColStd_IndexedMapOfTransient& mapadapt()
|
||||
|
||||
// #### PROFILE ####
|
||||
|
||||
Handle(IFSelect_Profile) XSControl_Controller::Profile () const
|
||||
Handle(MoniTool_Profile) XSControl_Controller::Profile () const
|
||||
{ return theProfile; }
|
||||
|
||||
void XSControl_Controller::DefineProfile
|
||||
@@ -226,11 +227,15 @@ static TColStd_IndexedMapOfTransient& mapadapt()
|
||||
{
|
||||
if (!theProfile->SetCurrent (confname)) return Standard_False;
|
||||
|
||||
Handle(Standard_Transient) anItem;
|
||||
// theProfile->Value("protocol",theAdaptorProtocol);
|
||||
theProfile->Value("sign-type",theSignType);
|
||||
if (theProfile->Value("sign-type",anItem))
|
||||
theSignType = Handle(IFSelect_Signature)::DownCast (anItem);
|
||||
// theProfile->Value("access",theAdaptorLibrary);
|
||||
theProfile->Value("tr-read",theAdaptorRead);
|
||||
theProfile->Value("tr-write",theAdaptorWrite);
|
||||
if (theProfile->Value("tr-read",anItem))
|
||||
theAdaptorRead = Handle(Transfer_ActorOfTransientProcess)::DownCast (anItem);
|
||||
if (theProfile->Value("tr-write",anItem))
|
||||
theAdaptorWrite = Handle(Transfer_ActorOfFinderProcess)::DownCast (anItem);
|
||||
|
||||
return SettingProfile (confname);
|
||||
}
|
||||
@@ -249,21 +254,21 @@ static TColStd_IndexedMapOfTransient& mapadapt()
|
||||
theProfile->SetTypedValues();
|
||||
|
||||
// SignType
|
||||
Handle(IFSelect_Signature) signtype;
|
||||
Handle(Standard_Transient) signtype;
|
||||
theProfile->Value ("sign-type",signtype);
|
||||
WS->SetSignType (signtype);
|
||||
WS->SetSignType (Handle(IFSelect_Signature)::DownCast (signtype));
|
||||
|
||||
// ActorRead
|
||||
|
||||
Handle(Transfer_ActorOfTransientProcess) actrd;
|
||||
Handle(Standard_Transient) actrd;
|
||||
theProfile->Value ("tr-read",actrd);
|
||||
WS->TransferReader()->SetActor (actrd);
|
||||
WS->TransferReader()->SetActor (Handle(Transfer_ActorOfTransientProcess)::DownCast (actrd));
|
||||
|
||||
// ActorWrite : dans le Controller meme
|
||||
|
||||
Handle(Transfer_ActorOfFinderProcess) actwr;
|
||||
Handle(Standard_Transient) actwr;
|
||||
theProfile->Value ("tr-write",actwr);
|
||||
theAdaptorWrite = actwr;
|
||||
theAdaptorWrite = Handle (Transfer_ActorOfFinderProcess)::DownCast (actwr);
|
||||
|
||||
return ApplyingProfile (WS,confname);
|
||||
}
|
||||
@@ -557,7 +562,7 @@ static IFSelect_ReturnStatus TransferFinder
|
||||
// Loading Options of the Profile
|
||||
|
||||
// Available Signatures
|
||||
Handle(IFSelect_Option) optsign = theProfile->Option ("sign-type");
|
||||
Handle(MoniTool_Option) optsign = theProfile->Option ("sign-type");
|
||||
// Handle(TColStd_HSequenceOfHAsciiString) signs =
|
||||
// WS->ItemNames (STANDARD_TYPE(IFSelect_Signature));
|
||||
// Standard_Integer isign, nbsign = (signs.IsNull() ? 0 : signs->Length());
|
||||
@@ -570,12 +575,12 @@ static IFSelect_ReturnStatus TransferFinder
|
||||
optsign->Switch ("default"); // garder courante la definition par defaut !
|
||||
|
||||
// Actor Read
|
||||
Handle(IFSelect_Option) optacrd = theProfile->Option ("tr-read");
|
||||
Handle(MoniTool_Option) optacrd = theProfile->Option ("tr-read");
|
||||
optacrd->Add ("default",theAdaptorRead);
|
||||
optacrd->Switch ("default");
|
||||
|
||||
// Actor Write
|
||||
Handle(IFSelect_Option) optacwr = theProfile->Option ("tr-write");
|
||||
Handle(MoniTool_Option) optacwr = theProfile->Option ("tr-write");
|
||||
optacwr->Add ("default",theAdaptorWrite);
|
||||
optacwr->Switch ("default");
|
||||
|
||||
|
@@ -15,8 +15,8 @@
|
||||
|
||||
#include <XSControl.hxx>
|
||||
#include <XSControl_Controller.hxx>
|
||||
#include <IFSelect_Profile.hxx>
|
||||
#include <IFSelect_Option.hxx>
|
||||
#include <MoniTool_Profile.hxx>
|
||||
#include <MoniTool_Option.hxx>
|
||||
#include <MoniTool_TypedValue.hxx>
|
||||
#include <Interface_Static.hxx>
|
||||
#include <TColStd_HSequenceOfAsciiString.hxx>
|
||||
@@ -150,7 +150,7 @@ static IFSelect_ReturnStatus XSControl_xprofile(const Handle(IFSelect_SessionPil
|
||||
Handle(XSControl_WorkSession) WS = XSControl::Session(pilot);
|
||||
Handle(XSControl_Controller) control = WS->NormAdaptor();
|
||||
if (control.IsNull()) return IFSelect_RetFail;
|
||||
Handle(IFSelect_Profile) prof = control->Profile();
|
||||
Handle(MoniTool_Profile) prof = control->Profile();
|
||||
Handle(Message_Messenger) sout = Message::DefaultMessenger();
|
||||
sout<<"Current Profile : "<<prof->Current().ToCString()<<endl;
|
||||
|
||||
@@ -267,7 +267,7 @@ static IFSelect_ReturnStatus XSControl_xoption(const Handle(IFSelect_SessionPilo
|
||||
Handle(XSControl_WorkSession) WS = XSControl::Session(pilot);
|
||||
Handle(XSControl_Controller) control = WS->NormAdaptor();
|
||||
if (control.IsNull()) return IFSelect_RetFail;
|
||||
Handle(IFSelect_Profile) prof = control->Profile();
|
||||
Handle(MoniTool_Profile) prof = control->Profile();
|
||||
Handle(Message_Messenger) sout = Message::DefaultMessenger();
|
||||
sout<<"Current Profile : "<<prof->Current().ToCString()<<endl;
|
||||
|
||||
@@ -285,7 +285,7 @@ static IFSelect_ReturnStatus XSControl_xoption(const Handle(IFSelect_SessionPilo
|
||||
sout<<"Total : "<<nbopt<<" Options"<<endl;
|
||||
for (iopt = 1; iopt <= nbopt; iopt ++) {
|
||||
TCollection_AsciiString optname = optlist->Value(iopt);
|
||||
Handle(IFSelect_Option) opt = prof->Option (optname.ToCString());
|
||||
Handle(MoniTool_Option) opt = prof->Option (optname.ToCString());
|
||||
sout<<optname.ToCString()<<" : "<<opt->CaseName()<<endl;
|
||||
}
|
||||
return IFSelect_RetVoid;
|
||||
@@ -294,7 +294,7 @@ static IFSelect_ReturnStatus XSControl_xoption(const Handle(IFSelect_SessionPilo
|
||||
// xoption optname : description
|
||||
|
||||
if (argc == 2) {
|
||||
Handle(IFSelect_Option) opt = prof->Option (arg1);
|
||||
Handle(MoniTool_Option) opt = prof->Option (arg1);
|
||||
if (opt.IsNull()) { sout<<"Not a recorded Option : "<<arg1<<endl; return IFSelect_RetError; }
|
||||
|
||||
// On va lister les valeurs admises
|
||||
@@ -316,9 +316,9 @@ static IFSelect_ReturnStatus XSControl_xoption(const Handle(IFSelect_SessionPilo
|
||||
for (ial = 1; ial <= nbal; ial ++) sout<<" "<<aliases->Value(ial);
|
||||
if (!tv.IsNull()) {
|
||||
// TypedValue : on peut afficher la valeur
|
||||
Handle(TCollection_HAsciiString) str;
|
||||
Handle(Standard_Transient) str;
|
||||
opt->Item (acase.ToCString(),str);
|
||||
if (!str.IsNull()) sout<<" - Value:"<<str->ToCString();
|
||||
if (!str.IsNull()) sout<<" - Value:"<< Handle(TCollection_HAsciiString)::DownCast(str)->ToCString();
|
||||
}
|
||||
|
||||
sout<<endl;
|
||||
@@ -332,14 +332,14 @@ static IFSelect_ReturnStatus XSControl_xoption(const Handle(IFSelect_SessionPilo
|
||||
Handle(Interface_Static) param = Interface_Static::Static(parname);
|
||||
if (param.IsNull()) { sout<<"No static parameter is named "<<parname<<endl;
|
||||
return IFSelect_RetError; }
|
||||
Handle(IFSelect_Option) opt = new IFSelect_Option(param,arg2);
|
||||
Handle(MoniTool_Option) opt = new MoniTool_Option(param,arg2);
|
||||
prof->AddOption (opt);
|
||||
return IFSelect_RetDone;
|
||||
}
|
||||
|
||||
// xoption optname + case [val]
|
||||
if (argc >= 4 && arg2[0] == '+' && arg2[1] == '\0') {
|
||||
Handle(IFSelect_Option) opt = prof->Option (arg1);
|
||||
Handle(MoniTool_Option) opt = prof->Option (arg1);
|
||||
if (opt.IsNull()) { sout<<"Not a recorded Option : "<<arg1<<endl; return IFSelect_RetError; }
|
||||
Handle(MoniTool_TypedValue) tv = opt->TypedValue();
|
||||
if (tv.IsNull()) { sout<<"Option not for a Parameter : "<<arg1<<endl; return IFSelect_RetError; }
|
||||
@@ -353,7 +353,7 @@ static IFSelect_ReturnStatus XSControl_xoption(const Handle(IFSelect_SessionPilo
|
||||
|
||||
// xoption optname newcase : edition
|
||||
if (argc == 3) {
|
||||
Handle(IFSelect_Option) opt = prof->Option (arg1);
|
||||
Handle(MoniTool_Option) opt = prof->Option (arg1);
|
||||
if (opt.IsNull()) { sout<<"Not a recorded Option : "<<arg1<<endl; return IFSelect_RetError; }
|
||||
if (!opt->Switch (arg2)) {
|
||||
sout<<"Option : "<<arg1<<" , Not a suitable case : "<<arg2<<endl;
|
||||
|
@@ -14,6 +14,7 @@
|
||||
#include <XSControl_TransferWriter.ixx>
|
||||
#include <Standard_ErrorHandler.hxx>
|
||||
#include <Standard_Failure.hxx>
|
||||
#include <Transfer_ActorOfFinderProcess.hxx>
|
||||
#include <Transfer_SimpleBinderOfTransient.hxx>
|
||||
#include <Transfer_TransientMapper.hxx>
|
||||
#include <XSControl_Utils.hxx>
|
||||
|
@@ -19,7 +19,7 @@
|
||||
#include <Interface_HGraph.hxx>
|
||||
#include <Interface_Graph.hxx>
|
||||
|
||||
#include <IFSelect_Profile.hxx>
|
||||
#include <MoniTool_Profile.hxx>
|
||||
|
||||
#include <Transfer_TransientProcess.hxx>
|
||||
#include <Transfer_ResultFromModel.hxx>
|
||||
|
Reference in New Issue
Block a user