Salome HOME
Merge from BR_V5_DEV 17Feb09
[samples/sierpinsky.git] / src / Sierpinsky / SIERPINSKY_Gen_i.hxx
1 //  Copyright (C) 2005-2008  OPEN CASCADE
2 //
3 //  This library is free software; you can redistribute it and/or
4 //  modify it under the terms of the GNU Lesser General Public
5 //  License as published by the Free Software Foundation; either
6 //  version 2.1 of the License.
7 //
8 //  This library is distributed in the hope that it will be useful,
9 //  but WITHOUT ANY WARRANTY; without even the implied warranty of
10 //  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
11 //  Lesser General Public License for more details.
12 //
13 //  You should have received a copy of the GNU Lesser General Public
14 //  License along with this library; if not, write to the Free Software
15 //  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
16 //
17 //  See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
18 //
19 ///////////////////////////////////////////////////////////
20 // File    : SIERPINSKY_Gen_i.hxx
21 // Author  : Vadim SANDLER (OCN)
22 // Created : 13/07/05
23 ///////////////////////////////////////////////////////////
24 //
25 #ifndef __SIERPINSKY_GEN_I_HXX
26 #define __SIERPINSKY_GEN_I_HXX
27
28 #include "SALOME_Component_i.hxx"
29
30 #include <SALOMEconfig.h>
31 #include CORBA_SERVER_HEADER(Sierpinsky)
32 #include CORBA_CLIENT_HEADER(SALOMEDS)
33
34 #include <list>
35
36 struct MyPoint
37 {
38   double myX;
39   double myY;
40   MyPoint( const double x = 0., const double y = 0. ) : myX( x ), myY( y ) {}
41 };
42
43 class SIERPINSKY_Gen_i: public virtual POA_SIERPINSKY_ORB::SIERPINSKY,
44                         public virtual Engines_Component_i
45 {
46 public:
47   // Default constructor
48   SIERPINSKY_Gen_i();
49   // Constructor
50   SIERPINSKY_Gen_i( CORBA::ORB_ptr            orb,
51                     PortableServer::POA_ptr   poa,
52                     PortableServer::ObjectId* contId, 
53                     const char*               instanceName, 
54                     const char*               interfaceName );
55   // Destructor
56   ~SIERPINSKY_Gen_i();
57   
58   // Initializes engine with three reference points
59   void Init( CORBA::Double theX1, CORBA::Double theY1, 
60              CORBA::Double theX2, CORBA::Double theY2, 
61              CORBA::Double theX3, CORBA::Double theY3 );
62   
63   // Initializes engine with three default reference points: (0.5, 1), (0, 0), (1, 0)
64   void Reset();
65   
66   // Generates next iteration point
67   void NextPoint( CORBA::Double  theX,  CORBA::Double theY, 
68                   CORBA::Long    theIter, 
69                   CORBA::Double& theNextX, CORBA::Double& theNextY );
70   
71   // Exports data to the JPEG image
72   CORBA::Boolean ExportToJPEG( const char* theFileName, CORBA::Long theSize );
73   
74   // Exports data to the MED file
75   CORBA::Boolean ExportToMED( const char* theFileName, CORBA::Double theSize );
76
77 private:
78   std::list<MyPoint> myPoints;
79   MyPoint            myRefPoints[3];
80 };
81
82 #endif // __SIERPINSKY_GEN_I_HXX