1 // Copyright (C) 2006-2019 CEA/DEN, EDF R&D
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.
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.
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
17 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
24 #include "TestComponent.hxx"
27 extern "C" void * __init()
29 TestComponent * obj = new TestComponent();
31 obj->info.message = "";
35 extern "C" void __terminate(void **pObj)
37 TestComponent * obj = * (TestComponent **) pObj;
42 extern "C" void __ping()
44 std::cerr << "ping TestComponent" << std::endl;
47 extern "C" void __run(void *vObj, const char *service, int nIn, int nOut,
48 YACS::ENGINE::Any **In, YACS::ENGINE::Any **Out, returnInfo * r)
50 TestComponent * obj = (TestComponent *) vObj;
54 r->message = "TestComponent has not been initialized";
58 obj->info.message = "";
62 if (std::strncmp(service, "f", 1) == 0)
64 double _arg0 = In[0]->getDoubleValue();
65 double _res = obj->f(_arg0);
66 if (obj->info.code == 0)
67 Out[0] = YACS::ENGINE::AtomAny::New(_res);
72 obj->info.message = "service ";
73 obj->info.message += service;
74 obj->info.message += " doesn't exist in TestComponent";
79 double TestComponent::f(double x)
89 info.message = "TestComponent::f : argument must be positive or null";
95 double TestComponent::g(int n, double x)