mirror of
https://git.dev.opencascade.org/repos/occt.git
synced 2025-08-09 13:22:24 +03:00
0027349: XtControl_Reader is not thread-safe
Support of profiles for norms is removed Getting rid of thread-unsafe static variables. Sequence is not thread-safe. Replacing it with Vector. Updating samples due to previous changes. Resolving conflict with system environment.
This commit is contained in:
@@ -20,12 +20,6 @@ MoniTool_Macros.hxx
|
||||
MoniTool_MTHasher.cxx
|
||||
MoniTool_MTHasher.hxx
|
||||
MoniTool_MTHasher.lxx
|
||||
MoniTool_Option.cxx
|
||||
MoniTool_Option.hxx
|
||||
MoniTool_OptValue.cxx
|
||||
MoniTool_OptValue.hxx
|
||||
MoniTool_Profile.cxx
|
||||
MoniTool_Profile.hxx
|
||||
MoniTool_RealVal.cxx
|
||||
MoniTool_RealVal.hxx
|
||||
MoniTool_SequenceOfElement.hxx
|
||||
|
@@ -1,64 +0,0 @@
|
||||
// Copyright (c) 1999-2014 OPEN CASCADE SAS
|
||||
//
|
||||
// This file is part of Open CASCADE Technology software library.
|
||||
//
|
||||
// This library is free software; you can redistribute it and/or modify it under
|
||||
// the terms of the GNU Lesser General Public License version 2.1 as published
|
||||
// by the Free Software Foundation, with special exception defined in the file
|
||||
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
|
||||
// distribution for complete text of the license and disclaimer of any warranty.
|
||||
//
|
||||
// Alternatively, this file may be used under the terms of Open CASCADE
|
||||
// commercial license or contractual agreement.
|
||||
|
||||
|
||||
#include <MoniTool_OptValue.hxx>
|
||||
#include <MoniTool_Profile.hxx>
|
||||
#include <Standard_Transient.hxx>
|
||||
|
||||
MoniTool_OptValue::MoniTool_OptValue (const Standard_CString opt)
|
||||
: theopt (opt)
|
||||
{
|
||||
// CKY: NO CALL TO A VIRTUAL METHOD WITHIN THE CONSTRUCTOR
|
||||
// Explicite Load must be done after creation
|
||||
}
|
||||
|
||||
void MoniTool_OptValue::Clear ()
|
||||
{ theval.Nullify(); }
|
||||
|
||||
void MoniTool_OptValue::SetValue
|
||||
(const Handle(MoniTool_Profile)& prof,
|
||||
const Standard_CString opt, const Standard_Boolean fast)
|
||||
{
|
||||
if (prof.IsNull()) return;
|
||||
if (!opt || opt[0] == '\0') return;
|
||||
Handle(Standard_Transient) val;
|
||||
if (fast) prof->FastValue (opt,val);
|
||||
else prof->Value (opt,val);
|
||||
if (!val.IsNull()) theval = val;
|
||||
}
|
||||
|
||||
|
||||
Standard_Boolean MoniTool_OptValue::IsLoaded () const
|
||||
{ return (!theval.IsNull()); }
|
||||
|
||||
Handle(MoniTool_Profile) MoniTool_OptValue::Prof () const
|
||||
{
|
||||
Handle(MoniTool_Profile) prof;
|
||||
return prof;
|
||||
}
|
||||
|
||||
void MoniTool_OptValue::Load (const Standard_Boolean fast)
|
||||
{ SetValue (Prof(),theopt.ToCString(),fast); }
|
||||
|
||||
|
||||
void MoniTool_OptValue::Value (Handle(Standard_Transient)& val) const
|
||||
{ val = theval; }
|
||||
|
||||
//=======================================================================
|
||||
//function : ~MoniTool_OptValue
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
MoniTool_OptValue::~MoniTool_OptValue()
|
||||
{}
|
@@ -1,105 +0,0 @@
|
||||
// Created on: 1999-12-17
|
||||
// Created by: Christian CAILLET
|
||||
// Copyright (c) 1999 Matra Datavision
|
||||
// Copyright (c) 1999-2014 OPEN CASCADE SAS
|
||||
//
|
||||
// This file is part of Open CASCADE Technology software library.
|
||||
//
|
||||
// This library is free software; you can redistribute it and/or modify it under
|
||||
// the terms of the GNU Lesser General Public License version 2.1 as published
|
||||
// by the Free Software Foundation, with special exception defined in the file
|
||||
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
|
||||
// distribution for complete text of the license and disclaimer of any warranty.
|
||||
//
|
||||
// Alternatively, this file may be used under the terms of Open CASCADE
|
||||
// commercial license or contractual agreement.
|
||||
|
||||
#ifndef _MoniTool_OptValue_HeaderFile
|
||||
#define _MoniTool_OptValue_HeaderFile
|
||||
|
||||
#include <Standard.hxx>
|
||||
#include <Standard_DefineAlloc.hxx>
|
||||
#include <Standard_Handle.hxx>
|
||||
|
||||
#include <TCollection_AsciiString.hxx>
|
||||
#include <Standard_CString.hxx>
|
||||
#include <Standard_Boolean.hxx>
|
||||
class Standard_Transient;
|
||||
class MoniTool_Profile;
|
||||
|
||||
|
||||
//! This class allows two kinds of use
|
||||
//!
|
||||
//! As an object, a OptValue can be put in any operator or
|
||||
//! algorithm ... to use an Option of a Profile, by recording
|
||||
//! its value, hence avoiding to query the Profile eachtime
|
||||
//!
|
||||
//! This object brings a value which can be set as coming from a
|
||||
//! Profile, with a configuration name and for an Option name
|
||||
//! This value is evaluated then returned immediately
|
||||
//!
|
||||
//! As a class, it can be redefined to work on a dedicated
|
||||
//! Profile, provided by such or such specific way (as static
|
||||
//! context for instance)
|
||||
//!
|
||||
//! To change configuration, etc... can be done by querying and
|
||||
//! editing the Profile
|
||||
class MoniTool_OptValue
|
||||
{
|
||||
public:
|
||||
|
||||
DEFINE_STANDARD_ALLOC
|
||||
|
||||
|
||||
//! Creates an OptValue on a given Option
|
||||
//! This allows to use "shortcut" method to set the value
|
||||
//!
|
||||
//! WARNING : loading is not done at creation time. It must be
|
||||
//! done explicitly by call to Load
|
||||
//!
|
||||
//! The reason comes from C++ : the Profile being virtual, and
|
||||
//! intended to be redefined in sub-classes, must not be used in
|
||||
//! the constructor. A separate method, called on the object
|
||||
//! already created with its true type, must be called after
|
||||
Standard_EXPORT MoniTool_OptValue(const Standard_CString opt = "");
|
||||
|
||||
//! Clears the Value of the OptValue
|
||||
Standard_EXPORT void Clear();
|
||||
|
||||
//! Sets the value as coming from the Profile, according to an
|
||||
//! Option name. Access as Fast or regular
|
||||
//! If no value is available, the former one remains : can be
|
||||
//! cleared by call to Clear
|
||||
Standard_EXPORT void SetValue (const Handle(MoniTool_Profile)& prof, const Standard_CString opt, const Standard_Boolean fast = Standard_True);
|
||||
|
||||
//! Returns the Profile which can be used by Short Cut methods
|
||||
//! Defaults returns a Null Handle, can be redefined
|
||||
//! For instance, to return a static used as dictionary or context
|
||||
Standard_EXPORT virtual Handle(MoniTool_Profile) Prof() const;
|
||||
|
||||
//! Sets the value from the Profile returned by method Prof,
|
||||
//! and Option Name given at creation time.
|
||||
//! FastValue by default, else Value
|
||||
//!
|
||||
//! Does not check if already loaded : reloads anyway
|
||||
//! IsLoaded allows to test
|
||||
Standard_EXPORT void Load (const Standard_Boolean fast = Standard_True);
|
||||
|
||||
//! Says if the OptValue is already loaded (i.e. Value defined)
|
||||
Standard_EXPORT Standard_Boolean IsLoaded() const;
|
||||
|
||||
//! Returns the Value set by, either SetConf or SetValue
|
||||
//! Can be Null ... (if not set or not properly set)
|
||||
//!
|
||||
//! Returned as Argument, hence avoiding DownCast
|
||||
//! Warning : type is not controlled
|
||||
Standard_EXPORT void Value (Handle(Standard_Transient)& val) const;
|
||||
|
||||
Standard_EXPORT virtual ~MoniTool_OptValue();
|
||||
|
||||
private:
|
||||
TCollection_AsciiString theopt;
|
||||
Handle(Standard_Transient) theval;
|
||||
};
|
||||
|
||||
#endif // _MoniTool_OptValue_HeaderFile
|
@@ -1,151 +0,0 @@
|
||||
// Copyright (c) 1999-2014 OPEN CASCADE SAS
|
||||
//
|
||||
// This file is part of Open CASCADE Technology software library.
|
||||
//
|
||||
// This library is free software; you can redistribute it and/or modify it under
|
||||
// the terms of the GNU Lesser General Public License version 2.1 as published
|
||||
// by the Free Software Foundation, with special exception defined in the file
|
||||
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
|
||||
// distribution for complete text of the license and disclaimer of any warranty.
|
||||
//
|
||||
// Alternatively, this file may be used under the terms of Open CASCADE
|
||||
// commercial license or contractual agreement.
|
||||
|
||||
|
||||
#include <Dico_DictionaryOfTransient.hxx>
|
||||
#include <Dico_IteratorOfDictionaryOfTransient.hxx>
|
||||
#include <MoniTool_Option.hxx>
|
||||
#include <MoniTool_TypedValue.hxx>
|
||||
#include <Standard_Transient.hxx>
|
||||
#include <Standard_Type.hxx>
|
||||
#include <TCollection_AsciiString.hxx>
|
||||
#include <TCollection_HAsciiString.hxx>
|
||||
|
||||
IMPLEMENT_STANDARD_RTTIEXT(MoniTool_Option,MMgt_TShared)
|
||||
|
||||
MoniTool_Option::MoniTool_Option
|
||||
(const Handle(Standard_Type)& atype, const Standard_CString aname)
|
||||
: thename (aname) , thetype (atype)
|
||||
{ theitems = new Dico_DictionaryOfTransient(); }
|
||||
|
||||
MoniTool_Option::MoniTool_Option
|
||||
(const Handle(MoniTool_TypedValue)& aval, const Standard_CString aname)
|
||||
: thename (aname) ,
|
||||
thetype (STANDARD_TYPE(TCollection_HAsciiString)) ,
|
||||
thevalue (aval)
|
||||
{ theitems = new Dico_DictionaryOfTransient();
|
||||
if (thename.Length() == 0) thename.AssignCat (aval->Name()); }
|
||||
|
||||
MoniTool_Option::MoniTool_Option
|
||||
(const Handle(MoniTool_Option)& other, const Standard_CString aname)
|
||||
: thename (aname) ,
|
||||
thetype (other->Type()) ,
|
||||
thevalue (other->TypedValue()) ,
|
||||
theitems (other->Items())
|
||||
{
|
||||
if (thename.Length() == 0) thename.AssignCat (other->Name());
|
||||
thecase.Clear(); thecase.AssignCat (other->CaseName());
|
||||
other->Value(theval);
|
||||
}
|
||||
|
||||
Standard_Boolean MoniTool_Option::Add
|
||||
(const Standard_CString name, const Handle(Standard_Transient)& val)
|
||||
{
|
||||
if (val.IsNull()) return Standard_False;
|
||||
if (!val->IsKind (thetype)) return Standard_False;
|
||||
if (!thevalue.IsNull()) {
|
||||
Handle(TCollection_HAsciiString) str = Handle(TCollection_HAsciiString)::DownCast(val);
|
||||
if (str.IsNull()) return Standard_False;
|
||||
if (!thevalue->Satisfies(str)) return Standard_False;
|
||||
}
|
||||
theitems->SetItem (name,val);
|
||||
thecase.Clear(); thecase.AssignCat (name); // switch mis a jour par defaut
|
||||
theval = val;
|
||||
return Standard_True;
|
||||
}
|
||||
|
||||
Standard_Boolean MoniTool_Option::AddBasic
|
||||
(const Standard_CString name, const Standard_CString val)
|
||||
{
|
||||
if (thevalue.IsNull()) return Standard_False;
|
||||
Handle(TCollection_HAsciiString) str;
|
||||
if (val && val[0] != '\0') str = new TCollection_HAsciiString (val);
|
||||
else str = new TCollection_HAsciiString (name);
|
||||
return Add (name,str);
|
||||
}
|
||||
|
||||
|
||||
void MoniTool_Option::Duplicate ()
|
||||
{
|
||||
Handle(Dico_DictionaryOfTransient) items = new Dico_DictionaryOfTransient();
|
||||
Dico_IteratorOfDictionaryOfTransient iter(theitems);
|
||||
for (; iter.More(); iter.Next())
|
||||
items->SetItem (iter.Name().ToCString(),iter.Value());
|
||||
theitems = items;
|
||||
}
|
||||
|
||||
const TCollection_AsciiString& MoniTool_Option::Name () const
|
||||
{ return thename; }
|
||||
|
||||
Handle(Standard_Type) MoniTool_Option::Type () const
|
||||
{ return thetype; }
|
||||
|
||||
Handle(MoniTool_TypedValue) MoniTool_Option::TypedValue () const
|
||||
{ return thevalue; }
|
||||
|
||||
Handle(Dico_DictionaryOfTransient) MoniTool_Option::Items () const
|
||||
{ return theitems; }
|
||||
|
||||
Standard_Boolean MoniTool_Option::Item
|
||||
(const Standard_CString name, Handle(Standard_Transient)& val) const
|
||||
{
|
||||
Handle(Standard_Transient) v;
|
||||
if (!theitems->GetItem (name,v)) return Standard_False;
|
||||
val = v;
|
||||
return Standard_True;
|
||||
}
|
||||
|
||||
|
||||
Handle(TColStd_HSequenceOfAsciiString) MoniTool_Option::ItemList () const
|
||||
{
|
||||
Handle(TColStd_HSequenceOfAsciiString) list = new TColStd_HSequenceOfAsciiString();
|
||||
Dico_IteratorOfDictionaryOfTransient iter(theitems);
|
||||
for (; iter.More(); iter.Next()) list->Append (iter.Name());
|
||||
return list;
|
||||
}
|
||||
|
||||
Handle(TColStd_HSequenceOfAsciiString) MoniTool_Option::Aliases
|
||||
(const Standard_CString name, const Standard_Boolean exact) const
|
||||
{
|
||||
Handle(TColStd_HSequenceOfAsciiString) list = new TColStd_HSequenceOfAsciiString();
|
||||
Handle(Standard_Transient) v;
|
||||
if (!theitems->GetItem (name,v, exact)) return list;
|
||||
|
||||
Dico_IteratorOfDictionaryOfTransient iter(theitems);
|
||||
for (; iter.More(); iter.Next()) {
|
||||
if (iter.Value() != v) continue;
|
||||
TCollection_AsciiString itname = iter.Name();
|
||||
if (!itname.IsEqual(name)) list->Append (itname);
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
// #### SWITCH ACTIONS ####
|
||||
|
||||
Standard_Boolean MoniTool_Option::Switch (const Standard_CString name)
|
||||
{
|
||||
Handle(Standard_Transient) val;
|
||||
if (!theitems->GetItem (name,val)) return Standard_False;
|
||||
thecase.Clear(); thecase.AssignCat (name);
|
||||
theval = val;
|
||||
return Standard_True;
|
||||
}
|
||||
|
||||
const TCollection_AsciiString& MoniTool_Option::CaseName () const
|
||||
{ return thecase; }
|
||||
|
||||
Handle(Standard_Transient) MoniTool_Option::CaseValue () const
|
||||
{ return theval; }
|
||||
|
||||
void MoniTool_Option::Value (Handle(Standard_Transient)& val) const
|
||||
{ if (!theval.IsNull()) val = theval; }
|
@@ -1,177 +0,0 @@
|
||||
// Created on: 1998-12-14
|
||||
// Created by: Christian CAILLET
|
||||
// Copyright (c) 1998-1999 Matra Datavision
|
||||
// Copyright (c) 1999-2014 OPEN CASCADE SAS
|
||||
//
|
||||
// This file is part of Open CASCADE Technology software library.
|
||||
//
|
||||
// This library is free software; you can redistribute it and/or modify it under
|
||||
// the terms of the GNU Lesser General Public License version 2.1 as published
|
||||
// by the Free Software Foundation, with special exception defined in the file
|
||||
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
|
||||
// distribution for complete text of the license and disclaimer of any warranty.
|
||||
//
|
||||
// Alternatively, this file may be used under the terms of Open CASCADE
|
||||
// commercial license or contractual agreement.
|
||||
|
||||
#ifndef _MoniTool_Option_HeaderFile
|
||||
#define _MoniTool_Option_HeaderFile
|
||||
|
||||
#include <Standard.hxx>
|
||||
#include <Standard_Type.hxx>
|
||||
|
||||
#include <TCollection_AsciiString.hxx>
|
||||
#include <Standard_Type.hxx>
|
||||
#include <MMgt_TShared.hxx>
|
||||
#include <Standard_CString.hxx>
|
||||
#include <Standard_Boolean.hxx>
|
||||
#include <TColStd_HSequenceOfAsciiString.hxx>
|
||||
class MoniTool_TypedValue;
|
||||
class Dico_DictionaryOfTransient;
|
||||
class Standard_Transient;
|
||||
class TCollection_AsciiString;
|
||||
|
||||
|
||||
class MoniTool_Option;
|
||||
DEFINE_STANDARD_HANDLE(MoniTool_Option, MMgt_TShared)
|
||||
|
||||
//! An Option gives a way of recording an enumerated list of
|
||||
//! instances of a given class, each instance being identified
|
||||
//! by a case name.
|
||||
//!
|
||||
//! Also, an Option allows to manage basic types through a Typed
|
||||
//! Value (which also applies to Static Parameter). It may record
|
||||
//! an enumerated list of values for a TypedValue or Static
|
||||
//! Parameter, each of them is recorded as a string (HAsciiString)
|
||||
//!
|
||||
//! An Option is defined by the type of the class to be optioned,
|
||||
//! or (mutually exclusive) the TypedValue/Static of which values
|
||||
//! are to be optioned, a specific name, a list of named values.
|
||||
//! It brings a current case with its name and value
|
||||
//! It may also have a default case (the first recorded one if not
|
||||
//! precised)
|
||||
//!
|
||||
//! An Option may be created from another one, by sharing its Type
|
||||
//! and its list of Items (one per case), with the same name or
|
||||
//! another one. It may then be duplicated to break this sharing.
|
||||
class MoniTool_Option : public MMgt_TShared
|
||||
{
|
||||
|
||||
public:
|
||||
|
||||
|
||||
//! Creates an Option from scratch, with a Type and a Name
|
||||
Standard_EXPORT MoniTool_Option(const Handle(Standard_Type)& atype, const Standard_CString aname);
|
||||
|
||||
//! Creates an Option for a TypedValue (for basic, non-cdl-typed,
|
||||
//! value : integer, real, string ...)
|
||||
//! If <name> is not given, the name of the TypedValue is taken
|
||||
//! Remark that Type is then enforced to TCollection_HAsciiString
|
||||
Standard_EXPORT MoniTool_Option(const Handle(MoniTool_TypedValue)& aval, const Standard_CString aname = "");
|
||||
|
||||
//! Creates an Option from another one, the name can be redefined
|
||||
//! The Type remains the same. The list of Items, too, it can also
|
||||
//! be later duplicated by call to Duplicate
|
||||
Standard_EXPORT MoniTool_Option(const Handle(MoniTool_Option)& other, const Standard_CString aname = "");
|
||||
|
||||
//! Adds an item : value and name (replaces it if name is already
|
||||
//! recorded)
|
||||
//! Returns True when done, False if <val> is not Kind of the
|
||||
//! definition Type
|
||||
//! For a TypedValue, val must be a HAsciiString, its content must
|
||||
//! satisfy the definition of the TypedValue
|
||||
Standard_EXPORT Standard_Boolean Add (const Standard_CString name, const Handle(Standard_Transient)& val);
|
||||
|
||||
//! Short-cut to add an item for a TypedValue (basic type) : name
|
||||
//! is the name of the case, val is its value as a CString
|
||||
//! If val is not provided, val = name is assumed
|
||||
//! Returns True when done, False if this Option is not for a
|
||||
//! TypedValue or if the new value does not satisfy the definition
|
||||
//! of the TypedValue
|
||||
Standard_EXPORT Standard_Boolean AddBasic (const Standard_CString name, const Standard_CString val = "");
|
||||
|
||||
//! Duplicates the list of items
|
||||
//! It starts with the same definitions as before Duplicate, but
|
||||
//! it is not longer shared with other options
|
||||
Standard_EXPORT void Duplicate();
|
||||
|
||||
//! Returns the Name of the Option
|
||||
Standard_EXPORT const TCollection_AsciiString& Name() const;
|
||||
|
||||
//! Returns the Type of the Option
|
||||
Standard_EXPORT Handle(Standard_Type) Type() const;
|
||||
|
||||
//! Returns the TypedValue of the Option, or a Null Handle
|
||||
Standard_EXPORT Handle(MoniTool_TypedValue) TypedValue() const;
|
||||
|
||||
//! Gives the value bound with a name, in val
|
||||
//! Returns True if <name> is found, False else
|
||||
//! This way of returning a Transient, bound with the Type Control
|
||||
//! avoids DownCast and ensures the value is directly usable
|
||||
Standard_EXPORT Standard_Boolean Item (const Standard_CString name, Handle(Standard_Transient)& val) const;
|
||||
|
||||
//! Returns the list of available item names
|
||||
Standard_EXPORT Handle(TColStd_HSequenceOfAsciiString) ItemList() const;
|
||||
|
||||
//! Returns the list of cases, other than <name>, which bring the
|
||||
//! same value as <name>
|
||||
//! Empty list (not a Null Handle) if no alias, or <name> unknown
|
||||
//! if <exact> is True (D), exact name is required, no completion
|
||||
//! if <exact> is False and <name> is not complete, but addresses
|
||||
//! only one item, completion is done and the list includes the
|
||||
//! complete name
|
||||
Standard_EXPORT Handle(TColStd_HSequenceOfAsciiString) Aliases (const Standard_CString name, const Standard_Boolean exact = Standard_True) const;
|
||||
|
||||
//! Commands the Option to switch on an item name
|
||||
//! Returns True when done, False if <name> is not recorded
|
||||
//! (in that case, former switch remains unchanged)
|
||||
//! If no switch has been called, it is active on the last added
|
||||
//! items
|
||||
Standard_EXPORT Standard_Boolean Switch (const Standard_CString name);
|
||||
|
||||
//! Returns the Name of the currently switched item (Case)
|
||||
Standard_EXPORT const TCollection_AsciiString& CaseName() const;
|
||||
|
||||
//! Returns the Value of the currently switch item
|
||||
//! To be down-casted as needed before use
|
||||
Standard_EXPORT Handle(Standard_Transient) CaseValue() const;
|
||||
|
||||
//! Returns the Value of the currently switch item
|
||||
//! This way of returning a Transient, bound with the Type Control
|
||||
//! avoids DownCast and ensures the value is directly usable
|
||||
//! For a TypedValue, returns the corresponding HAsciiString
|
||||
Standard_EXPORT void Value (Handle(Standard_Transient)& val) const;
|
||||
|
||||
|
||||
|
||||
|
||||
DEFINE_STANDARD_RTTIEXT(MoniTool_Option,MMgt_TShared)
|
||||
|
||||
protected:
|
||||
|
||||
|
||||
|
||||
|
||||
private:
|
||||
|
||||
|
||||
//! Returns the list of items, to be shared (to copy an option)
|
||||
Standard_EXPORT Handle(Dico_DictionaryOfTransient) Items() const;
|
||||
|
||||
TCollection_AsciiString thename;
|
||||
Handle(Standard_Type) thetype;
|
||||
Handle(MoniTool_TypedValue) thevalue;
|
||||
Handle(Dico_DictionaryOfTransient) theitems;
|
||||
TCollection_AsciiString thecase;
|
||||
Handle(Standard_Transient) theval;
|
||||
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#endif // _MoniTool_Option_HeaderFile
|
@@ -1,338 +0,0 @@
|
||||
// Copyright (c) 1999-2014 OPEN CASCADE SAS
|
||||
//
|
||||
// This file is part of Open CASCADE Technology software library.
|
||||
//
|
||||
// This library is free software; you can redistribute it and/or modify it under
|
||||
// the terms of the GNU Lesser General Public License version 2.1 as published
|
||||
// by the Free Software Foundation, with special exception defined in the file
|
||||
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
|
||||
// distribution for complete text of the license and disclaimer of any warranty.
|
||||
//
|
||||
// Alternatively, this file may be used under the terms of Open CASCADE
|
||||
// commercial license or contractual agreement.
|
||||
|
||||
|
||||
#include <Dico_DictionaryOfTransient.hxx>
|
||||
#include <Dico_IteratorOfDictionaryOfTransient.hxx>
|
||||
#include <MoniTool_Option.hxx>
|
||||
#include <MoniTool_Profile.hxx>
|
||||
#include <MoniTool_TypedValue.hxx>
|
||||
#include <Standard_Transient.hxx>
|
||||
#include <Standard_Type.hxx>
|
||||
#include <TCollection_AsciiString.hxx>
|
||||
#include <TCollection_HAsciiString.hxx>
|
||||
|
||||
IMPLEMENT_STANDARD_RTTIEXT(MoniTool_Profile,MMgt_TShared)
|
||||
|
||||
static Standard_Boolean IsCurrent (const Standard_CString name)
|
||||
{ return (name[0] == '.' && name[1] == '\0'); }
|
||||
|
||||
MoniTool_Profile::MoniTool_Profile ()
|
||||
{
|
||||
theopts = new Dico_DictionaryOfTransient;
|
||||
theconfs = new Dico_DictionaryOfTransient;
|
||||
// Current
|
||||
Handle(Dico_DictionaryOfTransient) conf = new Dico_DictionaryOfTransient;
|
||||
theconfs->SetItem (".",conf);
|
||||
thecurname.AssignCat(".");
|
||||
thecurconf = conf;
|
||||
}
|
||||
|
||||
void MoniTool_Profile::AddOption
|
||||
(const Handle(MoniTool_Option)& option,
|
||||
const Standard_CString name)
|
||||
{
|
||||
if (option.IsNull()) return;
|
||||
if (name[0] == '\0') theopts->SetItem (option->Name().ToCString(),option);
|
||||
else theopts->SetItem (name,option);
|
||||
}
|
||||
|
||||
Handle(MoniTool_Option) MoniTool_Profile::Option
|
||||
(const Standard_CString name) const
|
||||
{
|
||||
Handle(MoniTool_Option) opt;
|
||||
if (!theopts->GetItem (name,opt,Standard_True)) opt.Nullify();
|
||||
return opt;
|
||||
}
|
||||
|
||||
Handle(TColStd_HSequenceOfAsciiString) MoniTool_Profile::OptionList () const
|
||||
{
|
||||
Handle(TColStd_HSequenceOfAsciiString) list = new TColStd_HSequenceOfAsciiString();
|
||||
Dico_IteratorOfDictionaryOfTransient iter(theopts);
|
||||
for (; iter.More(); iter.Next()) list->Append (iter.Name());
|
||||
return list;
|
||||
}
|
||||
|
||||
Handle(TColStd_HSequenceOfAsciiString) MoniTool_Profile::TypedValueList () const
|
||||
{
|
||||
Handle(TColStd_HSequenceOfAsciiString) list = new TColStd_HSequenceOfAsciiString();
|
||||
Dico_IteratorOfDictionaryOfTransient iter(theopts);
|
||||
for (; iter.More(); iter.Next()) {
|
||||
Handle(MoniTool_Option) opt = Handle(MoniTool_Option)::DownCast(iter.Value());
|
||||
if (!opt->TypedValue().IsNull()) list->Append (iter.Name());
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
void MoniTool_Profile::NewConf (const Standard_CString name)
|
||||
{
|
||||
if (IsCurrent (name)) return;
|
||||
Handle(Dico_DictionaryOfTransient) conf = new Dico_DictionaryOfTransient;
|
||||
theconfs->SetItem (name,conf);
|
||||
// thecurname.Clear(); thecurname.AssignCat (name);
|
||||
// thecurconf = conf;
|
||||
}
|
||||
|
||||
void MoniTool_Profile::AddConf (const Standard_CString name)
|
||||
{
|
||||
if (IsCurrent (name)) return;
|
||||
Handle(Dico_DictionaryOfTransient) conf;
|
||||
if (theconfs->GetItem (name,conf,Standard_False)) return;
|
||||
conf = new Dico_DictionaryOfTransient;
|
||||
theconfs->SetItem (name,conf);
|
||||
// thecurname.Clear(); thecurname.AssignCat (name);
|
||||
// thecurconf = conf;
|
||||
}
|
||||
|
||||
Standard_Boolean MoniTool_Profile::HasConf (const Standard_CString name) const
|
||||
{ return theconfs->HasItem (name,Standard_False); }
|
||||
|
||||
Handle(TColStd_HSequenceOfAsciiString) MoniTool_Profile::ConfList () const
|
||||
{
|
||||
Handle(TColStd_HSequenceOfAsciiString) list = new TColStd_HSequenceOfAsciiString();
|
||||
Dico_IteratorOfDictionaryOfTransient iter(theconfs);
|
||||
for (; iter.More(); iter.Next()) list->Append (iter.Name());
|
||||
return list;
|
||||
}
|
||||
|
||||
Handle(Dico_DictionaryOfTransient) MoniTool_Profile::Conf
|
||||
(const Standard_CString name) const
|
||||
{
|
||||
Handle(Dico_DictionaryOfTransient) conf;
|
||||
if (!theconfs->GetItem (name,conf,Standard_False)) conf.Nullify();
|
||||
return conf;
|
||||
}
|
||||
|
||||
|
||||
Standard_Boolean MoniTool_Profile::ClearConf
|
||||
(const Standard_CString confname)
|
||||
{
|
||||
Handle(Dico_DictionaryOfTransient) conf;
|
||||
if (!theconfs->GetItem (confname,conf,Standard_False)) return Standard_False;
|
||||
conf->Clear();
|
||||
return Standard_True;
|
||||
}
|
||||
|
||||
Standard_Boolean MoniTool_Profile::AddFromOtherConf
|
||||
(const Standard_CString confname, const Standard_CString otherconf)
|
||||
{
|
||||
Handle(Dico_DictionaryOfTransient) conf, other;
|
||||
if (!theconfs->GetItem (confname,conf,Standard_False)) return Standard_False;
|
||||
if (!theconfs->GetItem (otherconf,other,Standard_False)) return Standard_False;
|
||||
if (conf == other) return Standard_True;
|
||||
Dico_IteratorOfDictionaryOfTransient iter(other);
|
||||
for (; iter.More(); iter.Next()) conf->SetItem (iter.Name(),iter.Value());
|
||||
return Standard_True;
|
||||
}
|
||||
|
||||
Standard_Boolean MoniTool_Profile::SetFromCurrent
|
||||
(const Standard_CString confname)
|
||||
{
|
||||
Handle(Dico_DictionaryOfTransient) conf;
|
||||
if (!theconfs->GetItem (confname,conf,Standard_False)) return Standard_False;
|
||||
Dico_IteratorOfDictionaryOfTransient iter(theopts);
|
||||
for (; iter.More(); iter.Next()) {
|
||||
TCollection_AsciiString name = iter.Name();
|
||||
TCollection_AsciiString cn = CaseName (name.ToCString());
|
||||
AddSwitch (name.ToCString(), cn.ToCString() );
|
||||
}
|
||||
return Standard_True;
|
||||
}
|
||||
|
||||
|
||||
Standard_Boolean MoniTool_Profile::AddSwitch
|
||||
(const Standard_CString confname,
|
||||
const Standard_CString optname,
|
||||
const Standard_CString casename)
|
||||
{
|
||||
Handle(Dico_DictionaryOfTransient) conf = Conf (confname);
|
||||
Handle(MoniTool_Option) opt = Option (optname);
|
||||
if (conf.IsNull() || opt.IsNull()) return Standard_False;
|
||||
Handle(TCollection_HAsciiString) sw = new TCollection_HAsciiString(casename);
|
||||
if (casename[0] == '\0') sw = new TCollection_HAsciiString (opt->CaseName());
|
||||
Handle(Standard_Transient) val;
|
||||
if (!opt->Item (sw->ToCString(),val)) return Standard_False;
|
||||
conf->SetItem (optname,sw);
|
||||
return Standard_True;
|
||||
}
|
||||
|
||||
Standard_Boolean MoniTool_Profile::RemoveSwitch
|
||||
(const Standard_CString confname,
|
||||
const Standard_CString optname)
|
||||
{
|
||||
Handle(Dico_DictionaryOfTransient) conf = Conf (confname);
|
||||
Handle(MoniTool_Option) opt = Option (optname);
|
||||
if (conf.IsNull() || opt.IsNull()) return Standard_False;
|
||||
conf->RemoveItem (optname,Standard_False,Standard_False);
|
||||
return Standard_True;
|
||||
}
|
||||
|
||||
|
||||
void MoniTool_Profile::SwitchList
|
||||
(const Standard_CString confname,
|
||||
Handle(TColStd_HSequenceOfAsciiString)& optlist,
|
||||
Handle(TColStd_HSequenceOfAsciiString)& caselist) const
|
||||
{
|
||||
optlist = new TColStd_HSequenceOfAsciiString();
|
||||
caselist = new TColStd_HSequenceOfAsciiString();
|
||||
Handle(Dico_DictionaryOfTransient) conf = Conf (confname);
|
||||
if (conf.IsNull()) return;
|
||||
Dico_IteratorOfDictionaryOfTransient iter (conf);
|
||||
for (; iter.More(); iter.Next()) {
|
||||
TCollection_AsciiString optname = iter.Name();
|
||||
Handle(TCollection_HAsciiString) cn =
|
||||
Handle(TCollection_HAsciiString)::DownCast(iter.Value());
|
||||
TCollection_AsciiString casename(cn->ToCString());
|
||||
optlist->Append(optname);
|
||||
caselist->Append(casename);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Standard_Boolean MoniTool_Profile::SetCurrent
|
||||
(const Standard_CString confname)
|
||||
{
|
||||
if (!AddFromOtherConf (".",confname)) return Standard_False;
|
||||
thecurname.Clear(); thecurname.AssignCat (confname);
|
||||
return Standard_True;
|
||||
}
|
||||
|
||||
void MoniTool_Profile::RecordCurrent ()
|
||||
{
|
||||
Dico_IteratorOfDictionaryOfTransient iter(theconfs);
|
||||
for (; iter.More(); iter.Next()) {
|
||||
Handle(MoniTool_Option) opt = Option (iter.Name().ToCString());
|
||||
Handle(TCollection_HAsciiString) val =
|
||||
Handle(TCollection_HAsciiString)::DownCast (iter.Value());
|
||||
if (!val.IsNull()) opt->Switch (val->ToCString());
|
||||
}
|
||||
}
|
||||
|
||||
const TCollection_AsciiString& MoniTool_Profile::Current () const
|
||||
{ return thecurname; }
|
||||
|
||||
TCollection_AsciiString MoniTool_Profile::CaseName
|
||||
(const Standard_CString optname, const Standard_Boolean proper) const
|
||||
{
|
||||
TCollection_AsciiString cn;
|
||||
Handle(TCollection_HAsciiString) sw;
|
||||
if (thecurconf->GetItem (optname,sw,Standard_True)) {
|
||||
cn.AssignCat (sw->ToCString());
|
||||
return cn;
|
||||
}
|
||||
if (proper) return cn;
|
||||
Handle(MoniTool_Option) opt = Option (optname);
|
||||
if (opt.IsNull()) return cn;
|
||||
return opt->CaseName();
|
||||
}
|
||||
|
||||
Handle(Standard_Transient) MoniTool_Profile::CaseValue
|
||||
(const Standard_CString optname) const
|
||||
{
|
||||
Handle(Standard_Transient) val;
|
||||
Handle(MoniTool_Option) opt = Option (optname);
|
||||
if (opt.IsNull()) return val;
|
||||
|
||||
Handle(TCollection_HAsciiString) sw;
|
||||
if (!thecurconf->GetItem (optname,sw,Standard_True)) sw.Nullify();
|
||||
|
||||
if (sw.IsNull()) return opt->CaseValue();
|
||||
if (!opt->Item (sw->ToCString(),val)) val.Nullify();
|
||||
return val;
|
||||
}
|
||||
|
||||
|
||||
Standard_Boolean MoniTool_Profile::Value
|
||||
(const Standard_CString optname,
|
||||
Handle(Standard_Transient)& val) const
|
||||
{
|
||||
Handle(MoniTool_Option) opt = Option (optname);
|
||||
if (opt.IsNull()) return Standard_False;
|
||||
|
||||
Handle(TCollection_HAsciiString) sw;
|
||||
if (!thecurconf->GetItem (optname,sw,Standard_True)) sw.Nullify();
|
||||
|
||||
if (sw.IsNull()) { opt->Value(val); return Standard_True; }
|
||||
return opt->Item (sw->ToCString(),val);
|
||||
}
|
||||
|
||||
|
||||
void MoniTool_Profile::SetTypedValues
|
||||
(const Standard_Boolean proper, const Standard_CString name) const
|
||||
{
|
||||
Dico_IteratorOfDictionaryOfTransient iter(theopts,name);
|
||||
for (; iter.More(); iter.Next()) {
|
||||
Handle(MoniTool_Option) opt = Handle(MoniTool_Option)::DownCast(iter.Value());
|
||||
Handle(MoniTool_TypedValue) tv = opt->TypedValue();
|
||||
if (tv.IsNull()) continue;
|
||||
|
||||
// On recherche la valeur: en conf courante, sinon dans l option (cf proper)
|
||||
|
||||
Handle(TCollection_HAsciiString) sw, val;
|
||||
if (!thecurconf->GetItem (name,sw,Standard_True)) sw.Nullify();
|
||||
Handle(Standard_Transient) aVal;
|
||||
if (!sw.IsNull()) {
|
||||
if (!opt->Item (sw->ToCString(),aVal))
|
||||
aVal.Nullify();
|
||||
}
|
||||
if (aVal.IsNull() && !proper)
|
||||
opt->Value(aVal);
|
||||
val = Handle(TCollection_HAsciiString)::DownCast (aVal);
|
||||
|
||||
// On applique
|
||||
if (!val.IsNull()) tv->SetHStringValue (val);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
void MoniTool_Profile::SetFast (const Standard_CString confname)
|
||||
{
|
||||
Standard_Boolean cur = (confname[0] == '\0');
|
||||
thefastval = new Dico_DictionaryOfTransient;
|
||||
Dico_IteratorOfDictionaryOfTransient iter(theopts);
|
||||
for (; iter.More(); iter.Next()) {
|
||||
Handle(MoniTool_Option) opt = Handle(MoniTool_Option)::DownCast(iter.Value());
|
||||
if (opt.IsNull()) continue;
|
||||
Standard_Boolean iaopt = Standard_True;
|
||||
TCollection_AsciiString optnam = iter.Name();
|
||||
Standard_CString optname = optnam.ToCString();
|
||||
Handle(Standard_Transient) val;
|
||||
|
||||
if (cur) {
|
||||
Handle(TCollection_HAsciiString) sw;
|
||||
if (!thecurconf->GetItem (optname,sw,Standard_True)) sw.Nullify();
|
||||
|
||||
if (sw.IsNull()) opt->Value(val);
|
||||
else iaopt = opt->Item (sw->ToCString(),val);
|
||||
}
|
||||
else iaopt = opt->Item (confname,val);
|
||||
|
||||
// Now, recording
|
||||
if (iaopt) thefastval->SetItem (optname,val);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void MoniTool_Profile::ClearFast ()
|
||||
{ thefastval.Nullify(); }
|
||||
|
||||
|
||||
Standard_Boolean MoniTool_Profile::FastValue
|
||||
(const Standard_CString optname,
|
||||
Handle(Standard_Transient)& val) const
|
||||
{
|
||||
if (!thefastval.IsNull()) {
|
||||
if (thefastval->GetItem (optname,val,Standard_True)) return Standard_True;
|
||||
}
|
||||
return Value (optname,val);
|
||||
}
|
@@ -1,237 +0,0 @@
|
||||
// Created on: 1998-12-14
|
||||
// Created by: Christian CAILLET
|
||||
// Copyright (c) 1998-1999 Matra Datavision
|
||||
// Copyright (c) 1999-2014 OPEN CASCADE SAS
|
||||
//
|
||||
// This file is part of Open CASCADE Technology software library.
|
||||
//
|
||||
// This library is free software; you can redistribute it and/or modify it under
|
||||
// the terms of the GNU Lesser General Public License version 2.1 as published
|
||||
// by the Free Software Foundation, with special exception defined in the file
|
||||
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
|
||||
// distribution for complete text of the license and disclaimer of any warranty.
|
||||
//
|
||||
// Alternatively, this file may be used under the terms of Open CASCADE
|
||||
// commercial license or contractual agreement.
|
||||
|
||||
#ifndef _MoniTool_Profile_HeaderFile
|
||||
#define _MoniTool_Profile_HeaderFile
|
||||
|
||||
#include <Standard.hxx>
|
||||
#include <Standard_Type.hxx>
|
||||
|
||||
#include <TCollection_AsciiString.hxx>
|
||||
#include <MMgt_TShared.hxx>
|
||||
#include <Standard_CString.hxx>
|
||||
#include <TColStd_HSequenceOfAsciiString.hxx>
|
||||
#include <Standard_Boolean.hxx>
|
||||
class Dico_DictionaryOfTransient;
|
||||
class MoniTool_Option;
|
||||
class TCollection_AsciiString;
|
||||
class Standard_Transient;
|
||||
|
||||
|
||||
class MoniTool_Profile;
|
||||
DEFINE_STANDARD_HANDLE(MoniTool_Profile, MMgt_TShared)
|
||||
|
||||
//! A Profile gives access to a set of options :
|
||||
//! - it defines and gives access to options, by names specific
|
||||
//! to this Profile, defaulted to basic names of the Options
|
||||
//! - it records one or more Configurations, each of one is
|
||||
//! identified by a name, and commands for each option a switch
|
||||
//! value
|
||||
//! - a Configuration may be partial, i.e. concern only a subset
|
||||
//! of the complete list of options
|
||||
//! - Values are accessed through a Current Configuration, which
|
||||
//! name is fixed as ".", which can cumulate several
|
||||
//! configurations (especially when they are partial)
|
||||
//!
|
||||
//! It may also bring a "fast" access to values, which has been
|
||||
//! formerly computed from current configuration or another given
|
||||
//! one. But its up-to-date status regarding existing
|
||||
//! configurations is not checked : it may be recomputed or
|
||||
//! cleared at any time. If not set, the current configuration
|
||||
//! is then taken
|
||||
class MoniTool_Profile : public MMgt_TShared
|
||||
{
|
||||
|
||||
public:
|
||||
|
||||
|
||||
//! Creates an empty Profile, with an empty Current Configuration
|
||||
//! (named ".")
|
||||
Standard_EXPORT MoniTool_Profile();
|
||||
|
||||
//! Adds an Option, with a Name, by default takes the Name of the
|
||||
//! Option
|
||||
Standard_EXPORT void AddOption (const Handle(MoniTool_Option)& option, const Standard_CString name = "");
|
||||
|
||||
//! Returns an Option from its Name. Null Handle if unknown
|
||||
Standard_EXPORT Handle(MoniTool_Option) Option (const Standard_CString name) const;
|
||||
|
||||
//! Returns the list of Option Names
|
||||
Standard_EXPORT Handle(TColStd_HSequenceOfAsciiString) OptionList() const;
|
||||
|
||||
//! Returns the list of Option Names which are defined on a
|
||||
//! TypedValue/Static, i.e. for Basic Type
|
||||
Standard_EXPORT Handle(TColStd_HSequenceOfAsciiString) TypedValueList() const;
|
||||
|
||||
//! Adds a new Configuration, yet empty, then filled by AddSwitch
|
||||
//! If <confname> already existed, it is replaced from scratch
|
||||
//! While AddConf creates new Conf only if it does not yet exist
|
||||
//!
|
||||
//! Remark : the Current Configuration "." may not be changed
|
||||
Standard_EXPORT void NewConf (const Standard_CString confname);
|
||||
|
||||
//! Adds a new Configuration, yet empty, then filled by AddSwitch
|
||||
//! If <confname> already existed, it is kept as it is
|
||||
//! While NewConf restrts from scratch anyway
|
||||
//!
|
||||
//! Remark : the Current Configuration "." may not be changed
|
||||
Standard_EXPORT void AddConf (const Standard_CString confname);
|
||||
|
||||
//! Tells if <confname> is known as a Configuration
|
||||
Standard_EXPORT Standard_Boolean HasConf (const Standard_CString confname) const;
|
||||
|
||||
//! Returns the list of Configuration Names, including Current "."
|
||||
Standard_EXPORT Handle(TColStd_HSequenceOfAsciiString) ConfList() const;
|
||||
|
||||
//! Clears a configuration (does not remove it)
|
||||
//! A cleared configuration has no effect, it can be reloaded
|
||||
Standard_EXPORT Standard_Boolean ClearConf (const Standard_CString confname);
|
||||
|
||||
//! Adds the definitions from the configuration <otherconf> to
|
||||
//! those of <confname>
|
||||
//! Returns True if done, False if confname or otherconf are unknown
|
||||
Standard_EXPORT Standard_Boolean AddFromOtherConf (const Standard_CString confname, const Standard_CString otherconf);
|
||||
|
||||
//! Sets the definitions of a configuration from the actual state
|
||||
//! (current configuration plus current state of options for those
|
||||
//! which are not recorded in current conf)
|
||||
Standard_EXPORT Standard_Boolean SetFromCurrent (const Standard_CString confname);
|
||||
|
||||
//! Adds to the Configuration <confname>, for the option <optname>
|
||||
//! the command to switch it to <casename>
|
||||
//! If <casename> is not given, records the actual current
|
||||
//! CaseName of this Option
|
||||
//! Returns True if done, False if <confname> or <optname> is
|
||||
//! unknown, or <casename> not allowed for <optname>
|
||||
Standard_EXPORT Standard_Boolean AddSwitch (const Standard_CString confname, const Standard_CString optname, const Standard_CString casename = "");
|
||||
|
||||
//! Removes from the Configuration <confname>, the switch for the
|
||||
//! option <optname>. Hence, it will consider the basic default
|
||||
//! switch for this option
|
||||
//! Returns True if done or switch was not recorded, False if
|
||||
//! <confname> or <optname> is unknown
|
||||
Standard_EXPORT Standard_Boolean RemoveSwitch (const Standard_CString confname, const Standard_CString optname);
|
||||
|
||||
//! Returns the list of switches properly concerned by a config :
|
||||
//! two lists in parallel, <optlist> lists the names of options
|
||||
//! and for each one, <caselist> gives the case for this config
|
||||
Standard_EXPORT void SwitchList (const Standard_CString confname, Handle(TColStd_HSequenceOfAsciiString)& optlist, Handle(TColStd_HSequenceOfAsciiString)& caselist) const;
|
||||
|
||||
//! Copies (Cumulates) the definition of <confname> to current
|
||||
//! Records the current name as the last current setting
|
||||
//!
|
||||
//! Returns True if done, False (and does nothing> if <confname>
|
||||
//! is not recorded as a Configuration
|
||||
//! If no SetCurrent has been called, the last added one is taken
|
||||
//!
|
||||
//! Remark : SetCurrent is for the Profile : the individual
|
||||
//! options are not switched themselves, they are only queried
|
||||
//! To switch the options themselves, see below RecordCurrent
|
||||
//!
|
||||
//! Remark : for Options which are listed in the Profile but not
|
||||
//! in the current Configuration, their current switch is taken
|
||||
Standard_EXPORT Standard_Boolean SetCurrent (const Standard_CString confname);
|
||||
|
||||
//! Records the switches of current configuration in the options
|
||||
//! themselves
|
||||
Standard_EXPORT void RecordCurrent();
|
||||
|
||||
//! Returns the name of last current configuration
|
||||
Standard_EXPORT const TCollection_AsciiString& Current() const;
|
||||
|
||||
//! Returns the selected case name of option <optname> in current
|
||||
//! configuration
|
||||
//! Empty String if <optname> unknown
|
||||
//!
|
||||
//! If <proper> is False (D), if <optname> is not recorded in the
|
||||
//! current configuration, the own current name of the option
|
||||
//! itself is taken
|
||||
//! Else, an empty string is returned
|
||||
Standard_EXPORT TCollection_AsciiString CaseName (const Standard_CString optname, const Standard_Boolean proper = Standard_False) const;
|
||||
|
||||
//! Returns the Value of the switch selected for option <optname>
|
||||
//! in current configuration
|
||||
//! Null Handle if <optname> unknown
|
||||
//! To be down-casted as needed before use
|
||||
Standard_EXPORT Handle(Standard_Transient) CaseValue (const Standard_CString optname) const;
|
||||
|
||||
//! Returns the Value of the switch selected for option <optname>
|
||||
//! in current configuration
|
||||
//! Returns True if done, False + Null Handle if <optname> unknown
|
||||
//! This way of returning a Transient, bound with the Type Control
|
||||
//! avoids DownCast and ensures the value is directly usable
|
||||
Standard_EXPORT Standard_Boolean Value (const Standard_CString optname, Handle(Standard_Transient)& val) const;
|
||||
|
||||
//! For the Options which are defined with a TypedValue/Static,
|
||||
//! takes the value defined in current configuration, and sets
|
||||
//! the TypedValue with it
|
||||
//!
|
||||
//! If <proper> is False (D), takes the current value, whatever
|
||||
//! it is properly recorded in current configuration or not
|
||||
//! If <proper> is True, sets the value only if it is properly
|
||||
//! recorded in the current configuration
|
||||
//!
|
||||
//! By default, considers all the Options with a TypedValue
|
||||
//! If <name> is given, considers the Options of which the name
|
||||
//! begins by <name>
|
||||
Standard_EXPORT void SetTypedValues (const Standard_Boolean proper = Standard_False, const Standard_CString name = "") const;
|
||||
|
||||
//! Recomputes fast access from the definition of a configuration
|
||||
//! By default, the current one
|
||||
//! Else, a configuration identified by its name
|
||||
Standard_EXPORT void SetFast (const Standard_CString confname = "");
|
||||
|
||||
//! Clears definitions of fast access
|
||||
Standard_EXPORT void ClearFast();
|
||||
|
||||
//! Gets the value corresponding to Option <optname>, as fast
|
||||
//! If not defined as fast, check "normal" access by calling Value
|
||||
//! Returns True if OK (either Fast or normal), False if not found
|
||||
//! (if not found, <val> is returned Null Handle)
|
||||
Standard_EXPORT Standard_Boolean FastValue (const Standard_CString optname, Handle(Standard_Transient)& val) const;
|
||||
|
||||
|
||||
|
||||
|
||||
DEFINE_STANDARD_RTTIEXT(MoniTool_Profile,MMgt_TShared)
|
||||
|
||||
protected:
|
||||
|
||||
|
||||
|
||||
|
||||
private:
|
||||
|
||||
|
||||
//! Internal
|
||||
Standard_EXPORT Handle(Dico_DictionaryOfTransient) Conf (const Standard_CString confname) const;
|
||||
|
||||
Handle(Dico_DictionaryOfTransient) theopts;
|
||||
Handle(Dico_DictionaryOfTransient) theconfs;
|
||||
TCollection_AsciiString thecurname;
|
||||
Handle(Dico_DictionaryOfTransient) thecurconf;
|
||||
Handle(Dico_DictionaryOfTransient) thefastval;
|
||||
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#endif // _MoniTool_Profile_HeaderFile
|
Reference in New Issue
Block a user