Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 10:05:28

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