Version: 9.16.0
GEOM_BaseDriver.hxx
Go to the documentation of this file.
1// Copyright (C) 2007-2026 CEA, EDF, OPEN CASCADE
2//
3// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
4// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
5//
6// This library is free software; you can redistribute it and/or
7// modify it under the terms of the GNU Lesser General Public
8// License as published by the Free Software Foundation; either
9// version 2.1 of the License, or (at your option) any later version.
10//
11// This library is distributed in the hope that it will be useful,
12// but WITHOUT ANY WARRANTY; without even the implied warranty of
13// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14// Lesser General Public License for more details.
15//
16// You should have received a copy of the GNU Lesser General Public
17// License along with this library; if not, write to the Free Software
18// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19//
20// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
21//
22
23// File : GEOM_BaseDriver.hxx
24// Created : Thu Jun 6 15:27:50 2013
25// Author : Edward AGAPOV (eap)
26
27#ifndef __GEOM_BaseDriver_HXX__
28#define __GEOM_BaseDriver_HXX__
29
30#include "GEOM_Function.hxx"
31
32#include <TFunction_Driver.hxx>
33#include <TFunction_Logbook.hxx>
34#include <TopAbs_ShapeEnum.hxx>
35#include <TopAbs_State.hxx>
36#include <TColStd_HSequenceOfTransient.hxx>
37#include <TColStd_HArray1OfInteger.hxx>
38
39#include <string>
40#include <vector>
41#include <sstream>
42
44{
45 std::string name;
46 std::string value;
47
48 Standard_EXPORT void Set(const char* nm) { name = nm; }
49 template <class T>
50 Standard_EXPORT void Set(const char* nm, const T& value) { name = nm; (*this)<<value; }
51
52 template <class T> Standard_EXPORT GEOM_Param & operator<<( const T &anything )
53 {
54 std::ostringstream str;
55 str << anything;
56 value += str.str() ;
57 return *this ;
58 }
59 Standard_EXPORT GEOM_Param & operator<<( const Handle(GEOM_Function)& fun );
60 Standard_EXPORT GEOM_Param & operator<<( const Handle(Standard_Transient)& fun );
61 Standard_EXPORT GEOM_Param & operator<<( const Handle(TColStd_HSequenceOfTransient)& funs );
62 Standard_EXPORT GEOM_Param & operator<<( const Handle(TColStd_HArray1OfInteger)& vals );
63 Standard_EXPORT GEOM_Param & operator<<( TopAbs_ShapeEnum type );
64 Standard_EXPORT GEOM_Param & operator<<( TopAbs_State state );
65};
66
67
69{
70public:
71
72 // Returns a name of creation operation and names and values of creation parameters
73 // (Use AddParam() methods declared below to fill params vector while implementing
74 // this method in derived drivers)
75 Standard_EXPORT virtual
76 bool GetCreationInformation(std::string& theOperationName,
77 std::vector<GEOM_Param>& params) = 0;
78
79 // Adds GEOM_Param to params and sets its name
80 // This method is safer than resizing the params vector and accessing to its items
81 Standard_EXPORT GEOM_Param& AddParam(std::vector<GEOM_Param>& params,
82 const char* name);
83
84 // Adds GEOM_Param to params vector and sets its name and value
85 // This method is safer than resizing the params vector and accessing to its items
86 template <class T>
87 Standard_EXPORT GEOM_Param& AddParam(std::vector<GEOM_Param>& params,
88 const char* name,
89 const T& value,
90 const char* dfltValue = 0)
91 {
92 GEOM_Param p;
93 p.Set( name, value );
94 if ( dfltValue && p.value.empty() )
95 p << dfltValue;
96 params.push_back( p );
97 return params.back();
98 }
99
100 DEFINE_STANDARD_RTTIEXT(GEOM_BaseDriver,TFunction_Driver)
101};
102
104
105#endif
Handle(TColStd_HSequenceOfTransient) AdvancedEngine_IOperations
Create a T-shape object with specified caracteristics for the main and the incident pipes (radius,...
Definition: AdvancedEngine_IOperations.cxx:1907
DEFINE_STANDARD_HANDLE(GEOM_Field, GEOM_BaseObject) DEFINE_STANDARD_HANDLE(GEOM_FieldStep
Definition: GEOM_BaseDriver.hxx:69
virtual Standard_EXPORT bool GetCreationInformation(std::string &theOperationName, std::vector< GEOM_Param > &params)=0
Standard_EXPORT GEOM_Param & AddParam(std::vector< GEOM_Param > &params, const char *name, const T &value, const char *dfltValue=0)
Definition: GEOM_BaseDriver.hxx:87
Standard_EXPORT GEOM_Param & AddParam(std::vector< GEOM_Param > &params, const char *name)
Definition: GEOM_BaseDriver.hxx:44
Standard_EXPORT void Set(const char *nm)
Definition: GEOM_BaseDriver.hxx:48
std::string name
Definition: GEOM_BaseDriver.hxx:45
Standard_EXPORT void Set(const char *nm, const T &value)
Definition: GEOM_BaseDriver.hxx:50
Standard_EXPORT GEOM_Param & operator<<(const T &anything)
Definition: GEOM_BaseDriver.hxx:52
std::string value
Definition: GEOM_BaseDriver.hxx:46