/usr/include/openturns/swig/Graph.i is in libopenturns-dev 0.15-2.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 | // SWIG file Graph.i
// Author : $LastChangedBy: schueller $
// Date : $LastChangedDate: 2011-05-24 19:30:41 +0200 (Tue, 24 May 2011) $
// Id : $Id: Graph.i 1910 2011-05-24 17:30:41Z schueller $
%{
#include "Graph.hxx"
namespace OpenTURNS {
template <>
struct traitsPythonType<OpenTURNS::Base::Graph::Graph>
{
typedef _PySequence_ Type;
};
template <>
inline
OpenTURNS::Base::Graph::Graph
convert<_PySequence_,OpenTURNS::Base::Graph::Graph>(PyObject * pyObj)
{
String title;
String xTitle;
String yTitle;
Bool showAxes;
String legendPosition = Base::Graph::GraphImplementation::NoSpecifiedLabel;
NumericalScalar legendFontSize = Base::Graph::GraphImplementation::DefaultLegendFontSize;
check<_PySequence_>( pyObj );
PyObject * newPyObj = PySequence_Fast( pyObj, "" );
switch (PySequence_Fast_GET_SIZE( newPyObj )) {
case 6: { PyObject * item_5 = PySequence_Fast_GET_ITEM( newPyObj, 5 );
check<_PyFloat_>( item_5 );
legendFontSize = convert<_PyFloat_,NumericalScalar>( item_5 ); }
case 5: { PyObject * item_4 = PySequence_Fast_GET_ITEM( newPyObj, 4 );
check<_PyString_>( item_4 );
legendPosition = convert<_PyString_,String>( item_4 ); }
case 4: { PyObject * item_0 = PySequence_Fast_GET_ITEM( newPyObj, 0 );
check<_PyString_>( item_0 );
title = convert<_PyString_,String>( item_0 );
PyObject * item_1 = PySequence_Fast_GET_ITEM( newPyObj, 1 );
check<_PyString_>( item_1 );
xTitle = convert<_PyString_,String>( item_1 );
PyObject * item_2 = PySequence_Fast_GET_ITEM( newPyObj, 2 );
check<_PyString_>( item_2 );
yTitle = convert<_PyString_,String>( item_2 );
PyObject * item_3 = PySequence_Fast_GET_ITEM( newPyObj, 3 );
check<_PyBool_>( item_3 );
showAxes = convert<_PyBool_,Bool>( item_3 ); }
break;
default:
Py_XDECREF( newPyObj );
throw Base::Common::InvalidArgumentException(HERE) << "Sequence passed as argument is not convertible to a Graph. Expected sequence (String, String, String, Bool, String, NumericalScalar)";
}
Py_XDECREF( newPyObj );
return OpenTURNS::Base::Graph::Graph( title, xTitle, yTitle, showAxes, legendPosition, legendFontSize);
}
} /* namespace OpenTURNS */
%}
%template(GraphImplementationTypedInterfaceObject) OpenTURNS::Base::Common::TypedInterfaceObject<OpenTURNS::Base::Graph::GraphImplementation>;
%template(GraphCollection) OpenTURNS::Base::Type::Collection<OpenTURNS::Base::Graph::Graph>;
%include Graph.hxx
namespace OpenTURNS{ namespace Base { namespace Graph {
%extend Graph {
Graph(const Graph & other) { return new OpenTURNS::Base::Graph::Graph(*other.getImplementation()); }
Graph(PyObject * pyObj)
{
return new OpenTURNS::Base::Graph::Graph( OpenTURNS::convert<OpenTURNS::_PySequence_,OpenTURNS::Base::Graph::Graph>(pyObj) );
}
}
}}}
|