Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2024-11-15 09:48:07

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 
0029   DEFINE_STANDARD_ALLOC
0030 
0031   //! Creates a disk object.
0032   //! This is used only when a class contains a Disk field.
0033   //! By default, its name is initialized to current working disk.
0034   Standard_EXPORT OSD_Disk();
0035   
0036   //! Initializes the object Disk with the disk name
0037   //! associated to the OSD_Path.
0038   Standard_EXPORT OSD_Disk(const OSD_Path& Name);
0039   
0040   //! Initializes the object Disk with <PathName>.
0041   //! <PathName> specifies any file within the mounted
0042   //! file system.
0043   //! Example : OSD_Disk myDisk ("/tmp")
0044   //! Initializes a disk object with the mounted
0045   //! file associated to /tmp.
0046   Standard_EXPORT OSD_Disk(const Standard_CString PathName);
0047   
0048   //! Returns disk name of <me>.
0049   Standard_EXPORT OSD_Path Name() const;
0050   
0051   //! Instantiates <me> with <Name>.
0052   Standard_EXPORT void SetName (const OSD_Path& Name);
0053   
0054   //! Returns total disk capacity in 512 bytes blocks.
0055   Standard_EXPORT Standard_Integer DiskSize();
0056   
0057   //! Returns free available 512 bytes blocks on disk.
0058   Standard_EXPORT Standard_Integer DiskFree();
0059   
0060   //! Returns TRUE if an error occurs
0061   Standard_Boolean Failed() const { return myError.Failed(); }
0062 
0063   //! Resets error counter to zero
0064   void Reset() { myError.Reset(); }
0065 
0066   //! Raises OSD_Error
0067   void Perror() { myError.Perror(); }
0068 
0069   //! Returns error number if 'Failed' is TRUE.
0070   Standard_Integer Error() const { return myError.Error(); }
0071 
0072 private:
0073 
0074   TCollection_AsciiString myDiskName;
0075   OSD_Error myError;
0076 
0077 };
0078 
0079 #endif // _OSD_Disk_HeaderFile