0030959: OSD_Parallel_TBB: number of execution threads is strictly limited by the...
[occt.git] / src / OSD / OSD_Disk.hxx
1 // Created on: 1992-05-27
2 // Created by: Stephan GARNAUD (ARM)
3 // Copyright (c) 1992-1999 Matra Datavision
4 // Copyright (c) 1999-2014 OPEN CASCADE SAS
5 //
6 // This file is part of Open CASCADE Technology software library.
7 //
8 // This library is free software; you can redistribute it and/or modify it under
9 // the terms of the GNU Lesser General Public License version 2.1 as published
10 // by the Free Software Foundation, with special exception defined in the file
11 // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
12 // distribution for complete text of the license and disclaimer of any warranty.
13 //
14 // Alternatively, this file may be used under the terms of Open CASCADE
15 // commercial license or contractual agreement.
16
17 #ifndef _OSD_Disk_HeaderFile
18 #define _OSD_Disk_HeaderFile
19
20 #include <TCollection_AsciiString.hxx>
21 #include <OSD_Error.hxx>
22 #include <OSD_Path.hxx>
23
24 //! Disk management (a set of disk oriented tools)
25 class OSD_Disk 
26 {
27 public:
28
29   DEFINE_STANDARD_ALLOC
30
31   //! Creates a disk object.
32   //! This is used only when a class contains a Disk field.
33   //! By default, its name is initialized to current working disk.
34   Standard_EXPORT OSD_Disk();
35   
36   //! Initializes the object Disk with the disk name
37   //! associated to the OSD_Path.
38   Standard_EXPORT OSD_Disk(const OSD_Path& Name);
39   
40   //! Initializes the object Disk with <PathName>.
41   //! <PathName> specifies any file within the mounted
42   //! file system.
43   //! Example : OSD_Disk myDisk ("/tmp")
44   //! Initializes a disk object with the mounted
45   //! file associated to /tmp.
46   Standard_EXPORT OSD_Disk(const Standard_CString PathName);
47   
48   //! Returns disk name of <me>.
49   Standard_EXPORT OSD_Path Name() const;
50   
51   //! Instantiates <me> with <Name>.
52   Standard_EXPORT void SetName (const OSD_Path& Name);
53   
54   //! Returns total disk capacity in 512 bytes blocks.
55   Standard_EXPORT Standard_Integer DiskSize();
56   
57   //! Returns free available 512 bytes blocks on disk.
58   Standard_EXPORT Standard_Integer DiskFree();
59   
60   //! Returns TRUE if an error occurs
61   Standard_Boolean Failed() const { return myError.Failed(); }
62
63   //! Resets error counter to zero
64   void Reset() { myError.Reset(); }
65
66   //! Raises OSD_Error
67   void Perror() { myError.Perror(); }
68
69   //! Returns error number if 'Failed' is TRUE.
70   Standard_Integer Error() const { return myError.Error(); }
71
72 private:
73
74   TCollection_AsciiString myDiskName;
75   OSD_Error myError;
76
77 };
78
79 #endif // _OSD_Disk_HeaderFile