Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-09-21 09:19:03

0001 // Created on: 1993-06-09
0002 // Created by: Christian CAILLET
0003 // Copyright (c) 1993-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 _Transfer_Binder_HeaderFile
0018 #define _Transfer_Binder_HeaderFile
0019 
0020 #include <Standard.hxx>
0021 #include <Standard_Type.hxx>
0022 
0023 #include <Transfer_StatusResult.hxx>
0024 #include <Transfer_StatusExec.hxx>
0025 #include <Standard_Transient.hxx>
0026 class Interface_Check;
0027 
0028 // resolve name collisions with X11 headers
0029 #ifdef Status
0030   #undef Status
0031 #endif
0032 
0033 //! A Binder is an auxiliary object to Map the Result of the
0034 //! Transfer of a given Object : it records the Result of the
0035 //! Unitary Transfer (Resulting Object), status of progress and
0036 //! error (if any) of the Process
0037 //!
0038 //! The class Binder itself makes no definition for the Result :
0039 //! it is defined by sub-classes : it can be either Simple (and
0040 //! has to be typed : see generic class SimpleBinder) or Multiple
0041 //! (see class MultipleBinder).
0042 //!
0043 //! In principle, for a Transfer in progress, Result cannot be
0044 //! accessed : this would cause an exception raising.
0045 //! This is controlled by the value if StatusResult : if it is
0046 //! "Used", the Result cannot be changed. This status is normally
0047 //! controlled by TransferProcess but can be directly (see method
0048 //! SetAlreadyUsed)
0049 //!
0050 //! Checks can be completed by a record of cases, as string which
0051 //! can be used as codes, but not to be printed
0052 //!
0053 //! In addition to the Result, a Binder can bring a list of
0054 //! Attributes, which are additional data, each of them has a name
0055 class Transfer_Binder : public Standard_Transient
0056 {
0057 
0058 public:
0059   //! Merges basic data (Check, ExecStatus) from another Binder but
0060   //! keeps its result. Used when a binder is replaced by another
0061   //! one, this allows to keep messages
0062   Standard_EXPORT void Merge(const occ::handle<Transfer_Binder>& other);
0063 
0064   //! Returns True if a Binder has several results, either by itself
0065   //! or because it has next results
0066   //! Can be defined by sub-classes.
0067   Standard_EXPORT virtual bool IsMultiple() const;
0068 
0069   //! Returns the Type which characterizes the Result (if known)
0070   Standard_EXPORT virtual occ::handle<Standard_Type> ResultType() const = 0;
0071 
0072   //! Returns the Name of the Type which characterizes the Result
0073   //! Can be returned even if ResultType itself is unknown
0074   Standard_EXPORT virtual const char* ResultTypeName() const = 0;
0075 
0076   //! Adds a next result (at the end of the list)
0077   //! Remark : this information is not processed by Merge
0078   Standard_EXPORT void AddResult(const occ::handle<Transfer_Binder>& next);
0079 
0080   //! Returns the next result, Null if none
0081   Standard_EXPORT occ::handle<Transfer_Binder> NextResult() const;
0082 
0083   //! Returns True if a Result is available (StatusResult = Defined)
0084   //! A Unique Result will be gotten by Result (which must be
0085   //! defined in each sub-class according to result type)
0086   //! For a Multiple Result, see class MultipleBinder
0087   //! For other case, specific access has to be forecast
0088   Standard_EXPORT bool HasResult() const;
0089 
0090   //! Declares that result is now used by another one, it means that
0091   //! it cannot be modified (by Rebind)
0092   Standard_EXPORT void SetAlreadyUsed();
0093 
0094   //! Returns status, which can be Initial (not yet done), Made (a
0095   //! result is recorded, not yet shared), Used (it is shared and
0096   //! cannot be modified)
0097   Standard_EXPORT Transfer_StatusResult Status() const;
0098 
0099   //! Returns execution status
0100   Standard_EXPORT Transfer_StatusExec StatusExec() const;
0101 
0102   //! Modifies execution status; called by TransferProcess only
0103   //! (for StatusError, rather use SetError, below)
0104   Standard_EXPORT void SetStatusExec(const Transfer_StatusExec stat);
0105 
0106   //! Used to declare an individual transfer as being erroneous
0107   //! (Status is set to Void, StatusExec is set to Error, <errmess>
0108   //! is added to Check's list of Fails)
0109   //! It is possible to record several messages of error
0110   //!
0111   //! It has same effect for TransferProcess as raising an exception
0112   //! during the operation of Transfer, except the Transfer tries to
0113   //! continue (as if ErrorHandle had been set)
0114   Standard_EXPORT void AddFail(const char* const mess, const char* const orig = "");
0115 
0116   //! Used to attach a Warning Message to an individual Transfer
0117   //! It has no effect on the Status
0118   Standard_EXPORT void AddWarning(const char* const mess, const char* const orig = "");
0119 
0120   //! Returns Check which stores Fail messages
0121   //! Note that no Entity is associated in this Check
0122   Standard_EXPORT const occ::handle<Interface_Check> Check() const;
0123 
0124   //! Returns Check which stores Fail messages, in order to modify
0125   //! it (adding messages, or replacing it)
0126   Standard_EXPORT occ::handle<Interface_Check> CCheck();
0127 
0128   //! Destructor
0129   Standard_EXPORT ~Transfer_Binder() override;
0130 
0131   DEFINE_STANDARD_RTTIEXT(Transfer_Binder, Standard_Transient)
0132 
0133 protected:
0134   //! Sets fields at initial values
0135   Standard_EXPORT Transfer_Binder();
0136 
0137   //! Used to declare that a result is recorded for an individual
0138   //! transfer (works by setting StatusResult to Defined)
0139   //!
0140   //! This Method is to be called once a Result is really recorded
0141   //! (see sub-classes of Binder, especially SimpleBinder) : it is
0142   //! senseless if called isolately
0143   Standard_EXPORT void SetResultPresent();
0144 
0145 private:
0146   //! Called by AddResult, to keep unicity of each item in the list
0147   Standard_EXPORT void CutResult(const occ::handle<Transfer_Binder>& next);
0148 
0149   Transfer_StatusResult        thestatus;
0150   Transfer_StatusExec          theexecst;
0151   occ::handle<Interface_Check> thecheck;
0152   occ::handle<Transfer_Binder> thenextr;
0153   occ::handle<Transfer_Binder> theendr;
0154 };
0155 
0156 #endif // _Transfer_Binder_HeaderFile