Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-09-14 09:15:39

0001 // Created on: 1992-05-27
0002 // Created by: Stephan GARNAUD (ARM)
0003 // Copyright (c) 1992-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 _OSD_Disk_HeaderFile
0018 #define _OSD_Disk_HeaderFile
0019 
0020 #include <TCollection_AsciiString.hxx>
0021 #include <OSD_Error.hxx>
0022 #include <OSD_Path.hxx>
0023 
0024 //! Disk management (a set of disk oriented tools)
0025 class OSD_Disk
0026 {
0027 public:
0028   DEFINE_STANDARD_ALLOC
0029 
0030   //! Creates a disk object.
0031   //! This is used only when a class contains a Disk field.
0032   //! By default, its name is initialized to current working disk.
0033   Standard_EXPORT OSD_Disk();
0034 
0035   //! Initializes the object Disk with the disk name
0036   //! associated to the OSD_Path.
0037   Standard_EXPORT OSD_Disk(const OSD_Path& Name);
0038 
0039   //! Initializes the object Disk with <PathName>.
0040   //! <PathName> specifies any file within the mounted
0041   //! file system.
0042   //! Example : OSD_Disk myDisk ("/tmp")
0043   //! Initializes a disk object with the mounted
0044   //! file associated to /tmp.
0045   Standard_EXPORT OSD_Disk(const char* const PathName);
0046 
0047   //! Returns disk name of <me>.
0048   Standard_EXPORT OSD_Path Name() const;
0049 
0050   //! Instantiates <me> with <Name>.
0051   Standard_EXPORT void SetName(const OSD_Path& Name);
0052 
0053   //! Returns total disk capacity in 512 bytes blocks.
0054   Standard_EXPORT int DiskSize();
0055 
0056   //! Returns free available 512 bytes blocks on disk.
0057   Standard_EXPORT int DiskFree();
0058 
0059   //! Returns TRUE if an error occurs
0060   bool Failed() const { return myError.Failed(); }
0061 
0062   //! Resets error counter to zero
0063   void Reset() { myError.Reset(); }
0064 
0065   //! Raises OSD_Error
0066   void Perror() { myError.Perror(); }
0067 
0068   //! Returns error number if 'Failed' is TRUE.
0069   int Error() const { return myError.Error(); }
0070 
0071 private:
0072   TCollection_AsciiString myDiskName;
0073   OSD_Error               myError;
0074 };
0075 
0076 #endif // _OSD_Disk_HeaderFile