Version: 8.3.0
Main Page
Related Pages
Modules
Namespaces
Classes
Files
File List
File Members
OptimizerAlg.hxx
Go to the documentation of this file.
1
// Copyright (C) 2006-2016 CEA/DEN, EDF R&D
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
#ifndef __OPTIMIZERALG_HXX__
21
#define __OPTIMIZERALG_HXX__
22
23
#include <string>
24
25
#include "
YACSlibEngineExport.hxx
"
26
#include "
RefCounter.hxx
"
27
#include "
Exception.hxx
"
28
#include "
AlternateThread.hxx
"
29
#include "
Pool.hxx
"
30
#include "
TypeCode.hxx
"
31
32
namespace
YACS
33
{
34
namespace
ENGINE
35
{
36
class
Proc;
37
41
class
YACSLIBENGINE_EXPORT
OptimizerAlgBase
:
public
RefCounter
42
{
43
protected
:
44
Pool
*
_pool
;
45
Proc
*
_proc
;
46
std::string
_errorMessage
;
47
int
_nbOfBranches
;
48
49
protected
:
50
OptimizerAlgBase
(
Pool
*pool);
51
virtual
~
OptimizerAlgBase
();
52
53
// Methods to implement in real algorithm classes. These methods shall be called
54
// only through proxy methods.
56
virtual
TypeCode
*getTCForIn()
const
= 0;
58
virtual
TypeCode
*getTCForOut()
const
= 0;
60
virtual
TypeCode
*getTCForAlgoInit()
const
;
62
virtual
TypeCode
*getTCForAlgoResult()
const
;
63
virtual
void
initialize(
const
Any
*input)
throw
(
Exception
);
64
virtual
void
start() = 0;
65
virtual
void
takeDecision() = 0;
66
67
68
virtual
void
finish();
69
virtual
Any
* getAlgoResult();
70
71
public
:
72
// Proxy methods to encapsulate the call to real methods
73
virtual
TypeCode
*getTCForInProxy()
const
;
74
virtual
TypeCode
*getTCForOutProxy()
const
;
75
virtual
TypeCode
*getTCForAlgoInitProxy()
const
;
76
virtual
TypeCode
*getTCForAlgoResultProxy()
const
;
77
virtual
void
initializeProxy(
const
Any
*input)
throw
(
Exception
);
78
virtual
void
startProxy();
79
virtual
void
takeDecisionProxy();
80
virtual
void
finishProxy();
81
virtual
Any
* getAlgoResultProxy();
82
83
// Utility methods
84
virtual
void
setPool(
Pool
*pool);
85
virtual
void
setProc(
Proc
* proc);
86
virtual
Proc
* getProc();
87
virtual
bool
hasError()
const
;
88
virtual
const
std::string & getError()
const
;
89
virtual
void
setError(
const
std::string & message);
90
void
setNbOfBranches(
int
nbOfBranches);
91
int
getNbOfBranches()
const
;
92
};
93
94
typedef
OptimizerAlgBase
OptimizerAlgSync
;
95
99
class
YACSLIBENGINE_EXPORT
OptimizerAlgASync
:
public
OptimizerAlgBase
,
100
public
YACS::BASES::AlternateThread
101
{
102
protected
:
103
OptimizerAlgASync
(
Pool
*pool);
104
public
:
105
virtual
~
OptimizerAlgASync
();
106
virtual
void
finishProxy();
107
108
protected
:
109
virtual
void
start();
110
virtual
void
takeDecision();
111
112
113
virtual
void
run
();
114
119
virtual
void
startToTakeDecision()=0;
120
};
121
122
typedef
OptimizerAlgBase
*(*OptimizerAlgBaseFactory)(
Pool
*pool);
123
}
124
}
125
126
#endif
src
engine
OptimizerAlg.hxx
Copyright © 2006-2017 CEA/DEN, EDF R&D