summaryrefslogtreecommitdiff
path: root/cesar/maximus/functioncall/src/FunctionCallParameter.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'cesar/maximus/functioncall/src/FunctionCallParameter.cpp')
-rw-r--r--cesar/maximus/functioncall/src/FunctionCallParameter.cpp277
1 files changed, 277 insertions, 0 deletions
diff --git a/cesar/maximus/functioncall/src/FunctionCallParameter.cpp b/cesar/maximus/functioncall/src/FunctionCallParameter.cpp
new file mode 100644
index 0000000000..640c6fd19b
--- /dev/null
+++ b/cesar/maximus/functioncall/src/FunctionCallParameter.cpp
@@ -0,0 +1,277 @@
+/************************************************************************
+ FunctionCallParameter.cpp - Copyright buret
+
+Here you can write a license for your code, some comments or any other
+information you want to have in your generated code. To to this simply
+configure the "headings" directory in uml to point to a directory
+where you have your heading files.
+
+or you can just replace the contents of this file with your own.
+If you want to do this, this file is located at
+
+/usr/share/apps/umbrello/headings/heading.cpp
+
+-->Code Generators searches for heading files based on the file extension
+ i.e. it will look for a file name ending in ".h" to include in C++ header
+ files, and for a file name ending in ".java" to include in all generated
+ java code.
+ If you name the file "heading.<extension>", Code Generator will always
+ choose this file even if there are other files with the same extension in the
+ directory. If you name the file something else, it must be the only one with that
+ extension in the directory to guarantee that Code Generator will choose it.
+
+you can use variables in your heading files which are replaced at generation
+time. possible variables are : author, date, time, filename and filepath.
+just write %variable_name%
+
+This file was generated on %date% at %time%
+The original location of this file is /home/buret/eclipse/maximus/functioncall/src/FunctionCallParameter.cpp
+**************************************************************************/
+
+#include "FunctionCallParameter.h"
+
+#include "Logger.h"
+
+#include <sstream> // for 'ostringstream'
+#include <iomanip> // for 'setfill()' and 'setw()'
+#include <iostream> // for 'cout', 'cerr' and 'clog'
+using namespace std;
+
+
+// Constructors/Destructors
+//
+
+
+FunctionCallParameter::FunctionCallParameter ( ):
+mName("none"),
+mValueLength(0),
+mpValue(NULL)
+{
+ logFunction();
+
+ initAttributes ();
+}
+
+
+FunctionCallParameter::FunctionCallParameter ( const FunctionCallParameter & parameter ):
+mName("none"),
+mValueLength(0),
+mpValue(NULL)
+{
+ logFunction();
+
+ setName (parameter.getName());
+ setValueLength (parameter.getValueLength());
+ setValue (parameter.getValue());
+
+ initAttributes ();
+}
+
+
+FunctionCallParameter::FunctionCallParameter ( string name,
+ unsigned long value_length,
+ unsigned char * p_value ):
+mName("none"),
+mValueLength(0),
+mpValue(NULL)
+{
+ logFunction();
+
+ setName (name);
+ setValueLength (value_length);
+ setValue (p_value);
+
+ initAttributes ();
+}
+
+
+void FunctionCallParameter::initAttributes ( )
+{
+ logFunction();
+}
+
+FunctionCallParameter::~FunctionCallParameter ( )
+{
+ logFunction();
+
+ mName.clear();
+ if (NULL != mpValue)
+ {
+ delete [] mpValue;
+ mpValue = NULL;
+ }
+}
+
+
+//
+// Methods
+//
+
+
+// Other methods
+//
+
+
+// public methods
+//
+
+
+bool FunctionCallParameter::operator== ( const FunctionCallParameter & parameter ) const
+{
+ logFunction();
+ bool bOperator = false;
+
+ if ( (0 == getName().compare(parameter.getName()))
+ && (getValueLength() == parameter.getValueLength())
+ && (0 == memcmp(getValue(), parameter.getValue(), parameter.getValueLength())) )
+ {
+ bOperator = true;
+ }
+
+ return bOperator;
+}
+
+
+FunctionCallParameter & FunctionCallParameter::operator= ( const FunctionCallParameter & parameter )
+{
+ logFunction();
+
+ setName (parameter.getName());
+ setValueLength (parameter.getValueLength());
+ setValue (parameter.getValue());
+
+ return *this;
+}
+
+
+void FunctionCallParameter::displayParameter ( ) const
+{
+ logFunction();
+
+ ostringstream oss;
+ oss << "\t[name = " << getName() << ", value length = " << dec << getValueLength() << ", value = ";
+ if (NULL != getValue())
+ {
+ oss << "0x";
+ for (unsigned int i=0; i<static_cast<unsigned int>(getValueLength()); i++)
+ {
+ if ('\0' != *(getValue()+i))
+ {
+ oss << setfill('0') << setw(2) << uppercase << hex << static_cast<unsigned short int>(*(getValue()+i));
+ }
+ else
+ {
+ oss << "00";
+ }
+ }
+ }
+ else
+ {
+ oss << "NULL!";
+ }
+ oss << "]" << dec << endl;
+ oss.flush();
+ clog << logger(LOG_COM) << oss.str();
+}
+
+
+// protected methods
+//
+
+
+// Accessor methods
+//
+
+
+// public attribute accessor methods
+//
+
+
+// private attribute accessor methods
+//
+
+
+string FunctionCallParameter::getName ( ) const
+{
+ return mName;
+}
+
+
+bool FunctionCallParameter::setName ( const string name )
+{
+ logFunction();
+
+ mName.clear();
+ mName.assign(name);
+
+ return true;
+}
+
+
+bool FunctionCallParameter::setName ( const char * p_name )
+{
+ logFunction();
+
+ if (NULL != p_name)
+ {
+ mName.clear();
+ mName.assign(p_name);
+ }
+
+ return true;
+}
+
+
+unsigned long FunctionCallParameter::getValueLength ( ) const
+{
+ return mValueLength;
+}
+
+
+bool FunctionCallParameter::setValueLength ( const unsigned long value_length )
+{
+ mValueLength = value_length;
+
+ return true;
+}
+
+
+unsigned char * FunctionCallParameter::getValue ( ) const
+{
+ return mpValue;
+}
+
+
+bool FunctionCallParameter::setValue ( const unsigned char * p_value )
+{
+ logFunction();
+ bool bSetValue = false;
+
+ // Free memory
+ //
+ if (NULL != mpValue)
+ {
+ delete [] mpValue;
+ mpValue = NULL;
+ }
+
+ if (NULL != p_value)
+ {
+ // Allocate memory
+ //
+ mpValue = new unsigned char [getValueLength()];
+
+ // Copy value
+ //
+ memcpy(mpValue, p_value, getValueLength());
+
+ bSetValue = true;
+ }
+
+ return bSetValue;
+}
+
+
+// protected attribute accessor methods
+//
+