|
|
|||
Warning, file /include/opencascade/Interface_Static.hxx was not indexed or was modified since last indexation (in which case cross-reference links may be missing, inaccurate or erroneous).
0001 // Created on: 1995-12-08 0002 // Created by: Christian CAILLET 0003 // Copyright (c) 1995-1999 Matra Datavision 0004 // Copyright (c) 1999-2014 OPEN CASCADE SAS 0005 // 0006 // This file is part of Open CASCADE Technology software library. 0007 // 0008 // This library is free software; you can redistribute it and/or modify it under 0009 // the terms of the GNU Lesser General Public License version 2.1 as published 0010 // by the Free Software Foundation, with special exception defined in the file 0011 // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT 0012 // distribution for complete text of the license and disclaimer of any warranty. 0013 // 0014 // Alternatively, this file may be used under the terms of Open CASCADE 0015 // commercial license or contractual agreement. 0016 0017 #ifndef _Interface_Static_HeaderFile 0018 #define _Interface_Static_HeaderFile 0019 0020 #include <Standard.hxx> 0021 0022 #include <Standard_Integer.hxx> 0023 #include <Standard_Real.hxx> 0024 #include <Interface_StaticSatisfies.hxx> 0025 #include <Interface_TypedValue.hxx> 0026 #include <TCollection_HAsciiString.hxx> 0027 #include <NCollection_Sequence.hxx> 0028 #include <NCollection_HSequence.hxx> 0029 class TCollection_HAsciiString; 0030 0031 //! This class gives a way to manage meaningful static variables, 0032 //! used as "global" parameters in various procedures. 0033 //! 0034 //! A Static brings a specification (its type, constraints if any) 0035 //! and a value. Its basic form is a string, it can be specified 0036 //! as integer or real or enumerative string, and queried as such. 0037 //! Its string content, which is a occ::handle<HAsciiString> can be 0038 //! shared by other data structures, hence gives a direct on line 0039 //! access to its value. 0040 //! 0041 //! All this description is inherited from TypedValue 0042 //! 0043 //! A Static can be given an initial value, it can be filled from, 0044 //! either a set of Resources (an applicative feature which 0045 //! accesses and manages parameter files), or environment or 0046 //! internal definition : these define families of Static. 0047 //! In addition, it supports a status for reinitialisation : an 0048 //! initialisation procedure can ask if the value of the Static 0049 //! has changed from its last call, in this case does something 0050 //! then marks the Status "uptodate", else it does nothing. 0051 //! 0052 //! Statics are named and recorded then accessed in an alphabetic 0053 //! dictionary 0054 class Interface_Static : public Interface_TypedValue 0055 { 0056 0057 public: 0058 //! Creates and records a Static, with a family and a name 0059 //! family can report to a name of resource or to a system or 0060 //! internal definition. The name must be unique. 0061 //! 0062 //! type gives the type of the parameter, default is free text 0063 //! Also available : Integer, Real, Enum, Entity (i.e. Object) 0064 //! More precise specifications, titles, can be given to the 0065 //! Static once created 0066 //! 0067 //! init gives an initial value. If it is not given, the Static 0068 //! begin as "not set", its value is empty 0069 Standard_EXPORT Interface_Static(const char* const family, 0070 const char* const name, 0071 const Interface_ParamType type = Interface_ParamText, 0072 const char* const init = ""); 0073 0074 //! Creates a new Static with same definition as another one 0075 //! (value is copied, except for Entity : it remains null) 0076 Standard_EXPORT Interface_Static(const char* const family, 0077 const char* const name, 0078 const occ::handle<Interface_Static>& other); 0079 0080 //! Writes the properties of a 0081 //! parameter in the diagnostic file. These include: 0082 //! - Name 0083 //! - Family, 0084 //! - Wildcard (if it has one) 0085 //! - Current status (empty string if it was updated or 0086 //! if it is the original one) 0087 //! - Value 0088 Standard_EXPORT void PrintStatic(Standard_OStream& S) const; 0089 0090 //! Returns the family. It can be : a resource name for applis, 0091 //! an internal name between : $e (environment variables), 0092 //! $l (other, purely local) 0093 Standard_EXPORT const char* Family() const; 0094 0095 //! Sets a "wild-card" static : its value will be considered 0096 //! if <me> is not properly set. (reset by set a null one) 0097 Standard_EXPORT void SetWild(const occ::handle<Interface_Static>& wildcard); 0098 0099 //! Returns the wildcard static, which can be (is most often) null 0100 Standard_EXPORT occ::handle<Interface_Static> Wild() const; 0101 0102 //! Records a Static has "uptodate", i.e. its value has been taken 0103 //! into account by a reinitialisation procedure 0104 //! This flag is reset at each successful SetValue 0105 Standard_EXPORT void SetUptodate(); 0106 0107 //! Returns the status "uptodate" 0108 Standard_EXPORT bool UpdatedStatus() const; 0109 0110 //! Declares a new Static (by calling its constructor) 0111 //! If this name is already taken, does nothing and returns False 0112 //! Else, creates it and returns True 0113 //! For additional definitions, get the Static then edit it 0114 Standard_EXPORT static bool Init(const char* const family, 0115 const char* const name, 0116 const Interface_ParamType type, 0117 const char* const init = ""); 0118 0119 //! As Init with ParamType, but type is given as a character 0120 //! This allows a simpler call 0121 //! Types : 'i' Integer, 'r' Real, 't' Text, 'e' Enum, 'o' Object 0122 //! '=' for same definition as, <init> gives the initial Static 0123 //! Returns False if <type> does not match this list 0124 Standard_EXPORT static bool Init(const char* const family, 0125 const char* const name, 0126 const char type, 0127 const char* const init = ""); 0128 0129 //! Returns a Static from its name. Null Handle if not present 0130 Standard_EXPORT static occ::handle<Interface_Static> Static(const char* const name); 0131 0132 //! Returns True if a Static named <name> is present, False else 0133 Standard_EXPORT static bool IsPresent(const char* const name); 0134 0135 //! Returns a part of the definition of a Static, as a CString 0136 //! The part is designated by its name, as a CString 0137 //! If the required value is not a string, it is converted to a 0138 //! CString then returned 0139 //! If <name> is not present, or <part> not defined for <name>, 0140 //! this function returns an empty string 0141 //! 0142 //! Allowed parts for CDef : 0143 //! family : the family 0144 //! type : the type ("integer","real","text","enum") 0145 //! label : the label 0146 //! satis : satisfy function name if any 0147 //! rmin : minimum real value 0148 //! rmax : maximum real value 0149 //! imin : minimum integer value 0150 //! imax : maximum integer value 0151 //! enum nn (nn : value of an integer) : enum value for nn 0152 //! unit : unit definition for a real 0153 Standard_EXPORT static const char* CDef(const char* const name, const char* const part); 0154 0155 //! Returns a part of the definition of a Static, as an Integer 0156 //! The part is designated by its name, as a CString 0157 //! If the required value is not a string, returns zero 0158 //! For a Boolean, 0 for false, 1 for true 0159 //! If <name> is not present, or <part> not defined for <name>, 0160 //! this function returns zero 0161 //! 0162 //! Allowed parts for IDef : 0163 //! imin, imax : minimum or maximum integer value 0164 //! estart : starting number for enum 0165 //! ecount : count of enum values (starting from estart) 0166 //! ematch : exact match status 0167 //! eval val : case determined from a string 0168 Standard_EXPORT static int IDef(const char* const name, const char* const part); 0169 0170 //! Returns True if <name> is present AND set 0171 //! <proper> True (D) : considers this item only 0172 //! <proper> False : if not set and attached to a wild-card, 0173 //! considers this wild-card 0174 Standard_EXPORT static bool IsSet(const char* const name, const bool proper = true); 0175 0176 //! Returns the value of the 0177 //! parameter identified by the string name. 0178 //! If the specified parameter does not exist, an empty 0179 //! string is returned. 0180 //! Example 0181 //! Interface_Static::CVal("write.step.schema"); 0182 //! which could return: 0183 //! "AP214" 0184 Standard_EXPORT static const char* CVal(const char* const name); 0185 0186 //! Returns the integer value of 0187 //! the translation parameter identified by the string name. 0188 //! Returns the value 0 if the parameter does not exist. 0189 //! Example 0190 //! Interface_Static::IVal("write.step.schema"); 0191 //! which could return: 3 0192 Standard_EXPORT static int IVal(const char* const name); 0193 0194 //! Returns the value of a static 0195 //! translation parameter identified by the string name. 0196 //! Returns the value 0.0 if the parameter does not exist. 0197 Standard_EXPORT static double RVal(const char* const name); 0198 0199 //! Modifies the value of the 0200 //! parameter identified by name. The modification is specified 0201 //! by the string val. false is returned if the parameter does not exist. 0202 //! Example 0203 //! Interface_Static::SetCVal 0204 //! ("write.step.schema","AP203") 0205 //! This syntax specifies a switch from the default STEP 214 mode to STEP 203 mode. 0206 Standard_EXPORT static bool SetCVal(const char* const name, const char* const val); 0207 0208 //! Modifies the value of the 0209 //! parameter identified by name. The modification is specified 0210 //! by the integer value val. false is returned if the 0211 //! parameter does not exist. 0212 //! Example 0213 //! Interface_Static::SetIVal 0214 //! ("write.step.schema", 3) 0215 //! This syntax specifies a switch from the default STEP 214 mode to STEP 203 mode.S 0216 Standard_EXPORT static bool SetIVal(const char* const name, const int val); 0217 0218 //! Modifies the value of a 0219 //! translation parameter. false is returned if the 0220 //! parameter does not exist. The modification is specified 0221 //! by the real number value val. 0222 Standard_EXPORT static bool SetRVal(const char* const name, const double val); 0223 0224 //! Sets a Static to be "uptodate" 0225 //! Returns False if <name> is not present 0226 //! This status can be used by a reinitialisation procedure to 0227 //! rerun if a value has been changed 0228 Standard_EXPORT static bool Update(const char* const name); 0229 0230 //! Returns the status "uptodate" from a Static 0231 //! Returns False if <name> is not present 0232 Standard_EXPORT static bool IsUpdated(const char* const name); 0233 0234 //! Returns a list of names of statics : 0235 //! <mode> = 0 (D) : criter is for family 0236 //! <mode> = 1 : criter is regexp on names, takes final items 0237 //! (ignore wild cards) 0238 //! <mode> = 2 : idem but take only wilded, not final items 0239 //! <mode> = 3 : idem, take all items matching criter 0240 //! idem + 100 : takes only non-updated items 0241 //! idem + 200 : takes only updated items 0242 //! criter empty (D) : returns all names 0243 //! else returns names which match the given criter 0244 //! Remark : families beginning by '$' are not listed by criter "" 0245 //! they are listed only by criter "$" 0246 //! 0247 //! This allows for instance to set new values after having loaded 0248 //! or reloaded a resource, then to update them as required 0249 Standard_EXPORT static occ::handle<NCollection_HSequence<occ::handle<TCollection_HAsciiString>>> 0250 Items(const int mode = 0, const char* const criter = ""); 0251 0252 //! Initializes all standard static parameters, which can be used 0253 //! by every function. statics specific of a norm or a function 0254 //! must be defined around it 0255 Standard_EXPORT static void Standards(); 0256 0257 //! Fills given string-to-string map with all static data 0258 Standard_EXPORT static void FillMap( 0259 NCollection_DataMap<TCollection_AsciiString, TCollection_AsciiString>& theMap); 0260 0261 DEFINE_STANDARD_RTTIEXT(Interface_Static, Interface_TypedValue) 0262 0263 private: 0264 TCollection_AsciiString thefamily; 0265 TCollection_AsciiString thename; 0266 TCollection_AsciiString thelabel; 0267 Interface_ParamType thetype; 0268 occ::handle<Standard_Type> theotyp; 0269 occ::handle<Interface_Static> thewild; 0270 int thelims; 0271 int theintlow; 0272 int theintup; 0273 double therealow; 0274 double therealup; 0275 TCollection_AsciiString theunidef; 0276 occ::handle<NCollection_HArray1<TCollection_AsciiString>> theenums; 0277 NCollection_DataMap<TCollection_AsciiString, int> theeadds; 0278 Interface_StaticSatisfies thesatisf; 0279 TCollection_AsciiString thesatisn; 0280 bool theupdate; 0281 int theival; 0282 occ::handle<TCollection_HAsciiString> thehval; 0283 occ::handle<Standard_Transient> theoval; 0284 }; 0285 0286 #endif // _Interface_Static_HeaderFile
| [ Source navigation ] | [ Diff markup ] | [ Identifier search ] | [ general search ] |
|
This page was automatically generated by the 2.3.7 LXR engine. The LXR team |
|