From 14810c9800c48888fd58d2a82fc68ef7ed41394b Mon Sep 17 00:00:00 2001 From: buret Date: Tue, 4 Dec 2007 13:58:25 +0000 Subject: Maximus V2: fixes #47. Modify the Boost Pyhton interface and C++ code to handle message callbacks and messages life time. git-svn-id: svn+ssh://pessac/svn/cesar/trunk@1083 017c9cb6-072f-447c-8318-d5b54f68fe89 --- maximus/functioncall/inc/FunctionSciMsg.h | 7 ++++++ maximus/functioncall/src/FunctionSciMsg.cpp | 34 +++++++++++++++++++++++------ 2 files changed, 34 insertions(+), 7 deletions(-) (limited to 'maximus/functioncall') diff --git a/maximus/functioncall/inc/FunctionSciMsg.h b/maximus/functioncall/inc/FunctionSciMsg.h index d9ca6da1ee..c97e9d1064 100644 --- a/maximus/functioncall/inc/FunctionSciMsg.h +++ b/maximus/functioncall/inc/FunctionSciMsg.h @@ -142,6 +142,13 @@ public: */ bool addParameter ( const FunctionCallParameter & function_argument_to_add ); + /** + * @return bool + * @param name + * Remove the parameter named name from the function SCI message. + */ + bool removeParameter ( const std::string & name ); + /** * @return bool * @param name_of_parameter_to_get diff --git a/maximus/functioncall/src/FunctionSciMsg.cpp b/maximus/functioncall/src/FunctionSciMsg.cpp index 098c802b68..519584cae8 100644 --- a/maximus/functioncall/src/FunctionSciMsg.cpp +++ b/maximus/functioncall/src/FunctionSciMsg.cpp @@ -57,7 +57,7 @@ mpSpecializedSciMsgHeader(NULL), mpFunctionCallManager(NULL) { logFunction(); - + initAttributes (); } @@ -78,7 +78,7 @@ mpFunctionCallManager(NULL) { throw Error(__PRETTY_FUNCTION__, "Function call manager pointer is NULL"); } - + initAttributes (); } @@ -86,7 +86,7 @@ mpFunctionCallManager(NULL) void FunctionSciMsg::initAttributes ( ) { logFunction(); - + mpSpecializedSciMsgHeader = new Function_Call_Header; if (NULL != mpSpecializedSciMsgHeader) { @@ -103,7 +103,7 @@ void FunctionSciMsg::initAttributes ( ) FunctionSciMsg::FunctionSciMsg ( const FunctionSciMsg & function_sci_msg ) : SciMsg ( ) { logFunction(); - + initAttributes (); setSpecializedSciMsgType (function_sci_msg.getSpecializedSciMsgType()); setSpecializedSciMsgParametersNumber (function_sci_msg.getSpecializedSciMsgParametersNumber()); @@ -117,7 +117,7 @@ FunctionSciMsg::FunctionSciMsg ( const FunctionSciMsg & function_sci_msg ) : Sci FunctionSciMsg::~FunctionSciMsg ( ) { logFunction(); - + if (NULL != mpSpecializedSciMsgHeader) { delete (mpSpecializedSciMsgHeader); @@ -262,6 +262,27 @@ bool FunctionSciMsg::addParameter ( const FunctionCallParameter & function_argum } +// Called by user to configure a message to send +// +bool FunctionSciMsg::removeParameter ( const std::string & name ) +{ + logFunction(); + bool bRemoveParameter = false; + + for (ParametersList::iterator it = mListOfParameters.begin(); it < mListOfParameters.end(); ++it) + { + if ( !it->getName().compare(name) ) + { + mListOfParameters.erase(it); + bRemoveParameter = true; + break; + } + } + + return bRemoveParameter; +} + + // Called by user when a message is received to retrieve function parameters // bool FunctionSciMsg::bindParameter ( const string name_of_parameter_to_get, unsigned long & data_length, unsigned char * p_data ) const @@ -542,8 +563,7 @@ bool FunctionSciMsg::fillSpecializedSciMsgToSend ( ) bFill &= setSpecializedSciMsgParametersNumber(numberOfParameters); bFill &= setSpecializedSciMsgDataLength(dataLength); bFill &= setSpecializedSciMsgData(pData); - bFill &= incrementSpecializedSciMsgId(); // to have an updated msg id - + // Free temporary allocated memory // free(pData); -- cgit v1.2.3