Salome HOME
Merge from V5_1_main 14/05/2010
[samples/sierpinsky.git] / src / Sierpinsky / SIERPINSKY_Gen_i.hxx
1 //  Copyright (C) 2005-2010  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 ///////////////////////////////////////////////////////////
21 // File    : SIERPINSKY_Gen_i.hxx
22 // Author  : Vadim SANDLER (OCN)
23 // Created : 13/07/05
24 ///////////////////////////////////////////////////////////
25 //
26 #ifndef __SIERPINSKY_GEN_I_HXX
27 #define __SIERPINSKY_GEN_I_HXX
28
29 #include "SALOME_Component_i.hxx"
30
31 #include <SALOMEconfig.h>
32 #include CORBA_SERVER_HEADER(Sierpinsky)
33 #include CORBA_CLIENT_HEADER(SALOMEDS)
34
35 #include <list>
36
37 struct MyPoint
38 {
39   double myX;
40   double myY;
41   MyPoint( const double x = 0., const double y = 0. ) : myX( x ), myY( y ) {}
42 };
43
44 class SIERPINSKY_Gen_i: public virtual POA_SIERPINSKY_ORB::SIERPINSKY,
45                         public virtual Engines_Component_i
46 {
47 public:
48   // Default constructor
49   SIERPINSKY_Gen_i();
50   // Constructor
51   SIERPINSKY_Gen_i( CORBA::ORB_ptr            orb,
52                     PortableServer::POA_ptr   poa,
53                     PortableServer::ObjectId* contId, 
54                     const char*               instanceName, 
55                     const char*               interfaceName );
56   // Destructor
57   ~SIERPINSKY_Gen_i();
58   
59   // Initializes engine with three reference points
60   void Init( CORBA::Double theX1, CORBA::Double theY1, 
61              CORBA::Double theX2, CORBA::Double theY2, 
62              CORBA::Double theX3, CORBA::Double theY3 );
63   
64   // Initializes engine with three default reference points: (0.5, 1), (0, 0), (1, 0)
65   void Reset();
66   
67   // Generates next iteration point
68   void NextPoint( CORBA::Double  theX,  CORBA::Double theY, 
69                   CORBA::Long    theIter, 
70                   CORBA::Double& theNextX, CORBA::Double& theNextY );
71   
72   // Exports data to the JPEG image
73   CORBA::Boolean ExportToJPEG( const char* theFileName, CORBA::Long theSize );
74   
75   // Exports data to the MED file
76   CORBA::Boolean ExportToMED( const char* theFileName, CORBA::Double theSize );
77
78 private:
79   std::list<MyPoint> myPoints;
80   MyPoint            myRefPoints[3];
81 };
82
83 #endif // __SIERPINSKY_GEN_I_HXX