0022627: Change OCCT memory management defaults
[occt.git] / src / AlienImage / AlienImage_AlienUserImage.cxx
CommitLineData
7fd59977 1#include <OSD_Process.hxx>
2#include <OSD_Protection.hxx>
3#include <AlienImage_XAlienImage.hxx>
4#include <AlienImage_AlienUserImage.ixx>
5#include <OSD_File.hxx>
6#include <OSD_Path.hxx>
7
8AlienImage_AlienUserImage::AlienImage_AlienUserImage()
9{
10#ifdef TRACE
11 cout << "AlienImage_AlienUserImage constructor \n" ;
12#endif
13}
14
15#ifdef IMPLEMENTED
16AlienImage_AlienUserImage::AlienImage_AlienUserImage(
17 const Standard_CString afile,
18 Standard_Boolean& Success )
19{
20#ifdef TRACE
21 cout << "AlienImage_AlienUserImage constructor \n" ;
22#endif
23
24 Success = Read( afile ) ;
25}
26
27AlienImage_AlienUserImage::AlienImage_AlienUserImage(
28 const Handle(Image_Image)& anImage)
29{
30#ifdef TRACE
31 cout << "AlienImage_AlienUserImage constructor \n" ;
32#endif
33
34 FromImage( anImage ) ;
35}
36#endif
37
38Standard_Boolean AlienImage_AlienUserImage::Read( const Standard_CString file )
39{ OSD_File File ;
40 OSD_Protection Protection ;
41 OSD_Path Path;
42 Standard_Boolean Ret ;
43
44 Protection.SetValues( OSD_R, OSD_R, OSD_R, OSD_R ) ;
45 Path = OSD_Path( TCollection_AsciiString( file ),OSD_Default);
46 File.SetPath ( Path ); // Instanciate
47 File.Open ( OSD_ReadOnly, Protection ) ;
48
49 Ret = Read( File ) ;
50
51 File.Close() ;
52
53 return( Ret ) ;
54}
55
56Standard_Boolean AlienImage_AlienUserImage::Write(
57 const Standard_CString file)const
58
59{ OSD_File File ;
60 OSD_Protection Protection ;
61 OSD_Path Path;
62 Standard_Boolean Ret ;
63
64 Protection.SetValues( OSD_RW, OSD_RW, OSD_RW, OSD_RW ) ;
65 Path = OSD_Path( TCollection_AsciiString( file ),OSD_Default);
66 File.SetPath ( Path ); // Instanciate
67 File.Build ( OSD_WriteOnly, Protection ) ;
68
69 Ret = Write( File ) ;
70
71 File.Close() ;
72
73 return( Ret ) ;
74}
75