Salome HOME
Copyright update 2021
[samples/sierpinsky.git] / src / Sierpinsky / SIERPINSKY_Gen_i.hxx
1 // Copyright (C) 2005-2021  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, or (at your option) any later version.
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 #ifdef WIN32
38  #if defined SIERPINSKYENGINE_EXPORTS || defined SIERPINSKYEngine_EXPORTS
39   #define SIERPINSKYENGINE_EXPORT __declspec( dllexport )
40  #else
41   #define SIERPINSKYENGINE_EXPORT __declspec( dllimport )
42  #endif
43 #else
44  #define SIERPINSKYENGINE_EXPORT
45 #endif
46
47 struct MyPoint
48 {
49   double myX;
50   double myY;
51   MyPoint( const double x = 0., const double y = 0. ) : myX( x ), myY( y ) {}
52 };
53
54 class SIERPINSKYENGINE_EXPORT SIERPINSKY_Gen_i: public virtual POA_SIERPINSKY_ORB::SIERPINSKY,
55                         public virtual Engines_Component_i
56 {
57 public:
58   // Default constructor
59   SIERPINSKY_Gen_i();
60   // Constructor
61   SIERPINSKY_Gen_i( CORBA::ORB_ptr            orb,
62                     PortableServer::POA_ptr   poa,
63                     PortableServer::ObjectId* contId, 
64                     const char*               instanceName, 
65                     const char*               interfaceName );
66   // Destructor
67   ~SIERPINSKY_Gen_i();
68   
69   // Version information
70   virtual char* getVersion();
71
72   // Initializes engine with three reference points
73   void Init( CORBA::Double theX1, CORBA::Double theY1, 
74              CORBA::Double theX2, CORBA::Double theY2, 
75              CORBA::Double theX3, CORBA::Double theY3 );
76   
77   // Initializes engine with three default reference points: (0.5, 1), (0, 0), (1, 0)
78   void Reset();
79   
80   // Generates next iteration point
81   void NextPoint( CORBA::Double  theX,  CORBA::Double theY, 
82                   CORBA::Long    theIter, 
83                   CORBA::Double& theNextX, CORBA::Double& theNextY );
84   
85   // Exports data to the JPEG image
86   CORBA::Boolean ExportToJPEG( const char* theFileName, CORBA::Long theSize );
87   
88   // Exports data to the MED file
89   CORBA::Boolean ExportToMED( const char* theFileName, CORBA::Double theSize );
90
91 private:
92   std::list<MyPoint> myPoints;
93   MyPoint            myRefPoints[3];
94 };
95
96 #endif // __SIERPINSKY_GEN_I_HXX