summaryrefslogtreecommitdiff
path: root/src/AlienImage/AlienImage_AlienUserImage.cxx
blob: c63be02b44739391ecb4900664969e5a3aa67adc (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
#include <OSD_Process.hxx>
#include <OSD_Protection.hxx>
#include <AlienImage_XAlienImage.hxx>
#include <AlienImage_AlienUserImage.ixx>
#include <OSD_File.hxx>
#include <OSD_Path.hxx>

AlienImage_AlienUserImage::AlienImage_AlienUserImage()
{
#ifdef TRACE
	cout << "AlienImage_AlienUserImage constructor \n" ;
#endif
}

#ifdef IMPLEMENTED
AlienImage_AlienUserImage::AlienImage_AlienUserImage( 
		const Standard_CString afile,
		Standard_Boolean& Success )
{
#ifdef TRACE
	cout << "AlienImage_AlienUserImage constructor \n" ;
#endif

  Success = Read( afile ) ;
}

AlienImage_AlienUserImage::AlienImage_AlienUserImage( 
		const Handle(Image_Image)& anImage)
{
#ifdef TRACE
	cout << "AlienImage_AlienUserImage constructor \n" ;
#endif

  FromImage( anImage ) ;
}
#endif

Standard_Boolean AlienImage_AlienUserImage::Read( const Standard_CString file )
{ OSD_File 		File ;
  OSD_Protection 	Protection ;
  OSD_Path 		Path;
  Standard_Boolean	Ret ;

  Protection.SetValues( OSD_R, OSD_R, OSD_R, OSD_R ) ;   
  Path = OSD_Path( TCollection_AsciiString( file ),OSD_Default);
  File.SetPath   ( Path );                                  // Instanciate
  File.Open      ( OSD_ReadOnly, Protection ) ;

  Ret = Read( File ) ;

  File.Close() ;

  return( Ret ) ; 
}

Standard_Boolean AlienImage_AlienUserImage::Write(
					const Standard_CString file)const

{ OSD_File 		File ;
  OSD_Protection 	Protection ;
  OSD_Path 		Path;
  Standard_Boolean	Ret ;

  Protection.SetValues( OSD_RW, OSD_RW, OSD_RW, OSD_RW ) ;   
  Path = OSD_Path( TCollection_AsciiString( file ),OSD_Default);
  File.SetPath   ( Path );                                  // Instanciate
  File.Build     ( OSD_WriteOnly, Protection ) ;

  Ret = Write( File ) ;

  File.Close() ;

  return( Ret ) ; 
}