Salome HOME
Sierpinsky sample module
[samples/sierpinsky.git] / src / Sierpinsky / SIERPINSKY_Gen_i.hxx
1 ///////////////////////////////////////////////////////////
2 // File    : SIERPINSKY_Gen_i.hxx
3 // Author  : Vadim SANDLER (OCN)
4 // Created : 13/07/05
5 // Copyright (C) 2005 Open CASCADE
6 ///////////////////////////////////////////////////////////
7
8 #ifndef __SIERPINSKY_GEN_I_HXX
9 #define __SIERPINSKY_GEN_I_HXX
10
11 #include "SALOME_Component_i.hxx"
12
13 #include <SALOMEconfig.h>
14 #include CORBA_SERVER_HEADER(Sierpinsky)
15 #include CORBA_CLIENT_HEADER(SALOMEDS)
16
17 #include <list>
18
19 struct MyPoint
20 {
21   double myX;
22   double myY;
23   MyPoint( const double x = 0., const double y = 0. ) : myX( x ), myY( y ) {}
24 };
25
26 class SIERPINSKY_Gen_i: public virtual POA_SIERPINSKY_ORB::SIERPINSKY,
27                         public virtual Engines_Component_i
28 {
29 public:
30   // Default constructor
31   SIERPINSKY_Gen_i();
32   // Constructor
33   SIERPINSKY_Gen_i( CORBA::ORB_ptr            orb,
34                     PortableServer::POA_ptr   poa,
35                     PortableServer::ObjectId* contId, 
36                     const char*               instanceName, 
37                     const char*               interfaceName );
38   // Destructor
39   ~SIERPINSKY_Gen_i();
40   
41   // Initializes engine with three reference points
42   void Init( CORBA::Double theX1, CORBA::Double theY1, 
43              CORBA::Double theX2, CORBA::Double theY2, 
44              CORBA::Double theX3, CORBA::Double theY3 );
45   
46   // Initializes engine with three default reference points: (0.5, 1), (0, 0), (1, 0)
47   void Reset();
48   
49   // Generates next iteration point
50   void NextPoint( CORBA::Double  theX,  CORBA::Double theY, 
51                   CORBA::Long    theIter, 
52                   CORBA::Double& theNextX, CORBA::Double& theNextY );
53   
54   // Exports data to the JPEG image
55   CORBA::Boolean ExportToJPEG( const char* theFileName, CORBA::Long theSize );
56   
57   // Exports data to the MED file
58   CORBA::Boolean ExportToMED( const char* theFileName, CORBA::Double theSize );
59
60 private:
61   std::list<MyPoint> myPoints;
62   MyPoint            myRefPoints[3];
63 };
64
65 #endif // __SIERPINSKY_GEN_I_HXX