/** * This class is an implementation of the C++ bindings for Calcium. * Calcium capabilities with iteration synchronization are available for a program written in C++ * by using methods belonging to the Communication class. * * The Communication class uses predefined declarations for some datatypes: * *   *   *   *   *
#define IntPtr:boost::shared_array
#define FloatPtr:boost::shared_array
#define DoublePtr:boost::shared_array
#define BoolPtr:boost::shared_array
*

* Moreover, send methods are constructing shared arrays that cannot be modified in the calling C++ * code. To prevent this, they are declared const using the following predefined declarations: * *   *   *   *   *
#define IntPtrConst:boost::shared_array
#define FloatPtrConst:boost::shared_array
#define DoublePtrConst:boost::shared_array
#define BoolPtrConst:boost::shared_array
*

* * @author Hadrien Leroyer, EDF and Alain Hebert, Ecole Polytechnique * de Montreal (2013) */ #if ! defined( __Communication_hxx__ ) #define __Communication_hxx__ #include #include "CalciumException.hxx" extern "C" { #include #include "calcium.h" } #include "Cle2000.hxx" class Communication { private: void* compo_; public: /** use this constructor to create a new empty Communication object */ Communication(); /** use this constructor to create a new Communication object with an embedded component * @param compo embedded component */ Communication(const Communication& compo); virtual ~Communication(); /** initialize the Communication object and set the embedded component * @param compo embedded Calcium component */ int initialize(void* compo); /** close the Communication object */ int terminate(); /** send a single integer value * @param iteration iteration index * @param portName name of the datastream * @param val integer value */ int send(const int iteration, const std::string portName, const int& val ); /** send an integer array * @param iteration iteration index * @param portName name of the datastream * @param size size of the integer array * @param tab integer array */ int send(const int iteration, const std::string portName, const int size, IntPtrConst& tab ); /** send a single real value * @param iteration iteration index * @param portName name of the datastream * @param val real value */ int send(const int iteration, const std::string portName, const float& val ); /** send an real array * @param iteration iteration index * @param portName name of the datastream * @param size size of the real array * @param tab real array */ int send(const int iteration, const std::string portName, const int size, FloatPtrConst& tab ); /** send a single double precision real value * @param iteration iteration index * @param portName name of the datastream * @param val double precision real value */ int send(const int iteration, const std::string portName, const double& val ); /** send an double precision real array * @param iteration iteration index * @param portName name of the datastream * @param size size of the double precision real array * @param tab double precision real array */ int send(const int iteration, const std::string portName, const int size, DoublePtrConst& tab ); /** send a single boolean value * @param iteration iteration index * @param portName name of the datastream * @param val boolean value */ int send(const int iteration, const std::string portName, const bool& val ); /** send an boolean array * @param iteration iteration index * @param portName name of the datastream * @param size size of the boolean array * @param tab boolean array */ int send(const int iteration, const std::string portName, const int size, BoolPtrConst& tab ); /** receive a single integer value * @param iteration iteration index * @param portName name of the datastream * @param val integer value */ int recv(int& iteration, const std::string portName, int& val ); /** receive an integer array * @param iteration iteration index * @param portName name of the datastream * @param size size of the integer array * @param tab integer array */ int recv(int& iteration, const std::string portName, const int size, IntPtr& tab ); /** receive a single real value * @param iteration iteration index * @param portName name of the datastream * @param val real value */ int recv(int& iteration, const std::string portName, float& val ); /** receive an real array * @param iteration iteration index * @param portName name of the datastream * @param size size of the real array * @param tab real array */ int recv(int& iteration, const std::string portName, const int size, FloatPtr& tab ); /** receive a single double precision real value * @param iteration iteration index * @param portName name of the datastream * @param val double precision real value */ int recv(int& iteration, const std::string portName, double& val ); /** receive an double precision real array * @param iteration iteration index * @param portName name of the datastream * @param size size of the double precision real array * @param tab double precision real array */ int recv(int& iteration, const std::string portName, const int size, DoublePtr& tab ); /** receive a single boolean value * @param iteration iteration index * @param portName name of the datastream * @param val boolean value */ int recv(int& iteration, const std::string portName, bool& val ); /** receive a boolean array * @param iteration iteration index * @param portName name of the datastream * @param size size of the oolean array * @param tab boolean array */ int recv(int& iteration, const std::string portName, const int size, BoolPtr& tab ); }; #endif //#if ! defined( __Communication_hxx__ )