summaryrefslogtreecommitdiff
path: root/cesar/maximus/sci/inc/SciServer.h
diff options
context:
space:
mode:
Diffstat (limited to 'cesar/maximus/sci/inc/SciServer.h')
-rw-r--r--cesar/maximus/sci/inc/SciServer.h248
1 files changed, 248 insertions, 0 deletions
diff --git a/cesar/maximus/sci/inc/SciServer.h b/cesar/maximus/sci/inc/SciServer.h
new file mode 100644
index 0000000000..1aa49b8964
--- /dev/null
+++ b/cesar/maximus/sci/inc/SciServer.h
@@ -0,0 +1,248 @@
+/************************************************************************
+ SciServer.h - 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.h
+
+-->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/sci/inc/SciServer.h
+**************************************************************************/
+
+#ifndef SCISERVER_H
+#define SCISERVER_H
+
+#include "ISci.h"
+#include "SystemManager.h" // for 'StationsList'
+
+#include "networkclock_types.h"
+#include "system_types.h"
+
+class Station;
+class SciMsg;
+
+
+/**
+ * class SciServer
+ */
+
+class SciServer : public ISci
+{
+
+public:
+
+ // public attributes
+ //
+
+private:
+
+ // private attributes
+ //
+
+ std::string mStationLog;
+ SciMsg ** mpSpecializedSciMsgArray;
+ unsigned int mArraySize;
+ StationsList * mpListOfStations;
+ Network_Clock_Tick mNetworkClockTick;
+
+protected:
+
+ // protected attributes
+ //
+
+public:
+
+ // Constructors/Destructors
+ //
+
+ /**
+ * Empty Constructor
+ */
+ SciServer ( );
+
+ /**
+ * Copy Constructor
+ */
+ SciServer ( const SciServer & );
+
+ /**
+ * Empty Destructor
+ */
+ virtual ~SciServer ( );
+
+ // public methods
+ //
+
+ /**
+ * @return bool
+ * @param station_log_file
+ */
+ bool init ( const std::string station_log );
+
+ /**
+ * @return bool
+ */
+ bool process ( );
+
+ /**
+ * @return bool
+ * @param sci_msg_to_send
+ */
+ bool fillSciMsg ( SciMsg & sci_msg_to_send ) const;
+
+ /**
+ * @return bool
+ * @param sci_msg_to_send
+ */
+ bool sendSciMsg ( const SciMsg & sci_msg_to_send ) const;
+
+ /**
+ * @return bool
+ * @param sci_msg_to_send
+ */
+ bool sendSciMsgToAllActiveStations ( SciMsg & sci_msg_to_send ) const;
+
+ /**
+ * @return bool
+ * @param sci_msg_to_send
+ * @param
+ */
+ bool sendSciMsgToDestStations ( SciMsg & sci_msg_to_send, DestStationsList & list_of_dest_stations ) const;
+
+ /**
+ * Set a value into mpSpecializedSciMsgArray
+ * @return bool
+ * @param sci_msg_type the array position to set
+ * @param sci_msg the new value of mpSpecializedSciMsgArray[sci_msg_type]
+ */
+ bool registerSpecializedSciMsg ( const Sci_Msg_Type sci_msg_type, SciMsg * sci_msg );
+
+ /**
+ * @return bool
+ * @param header
+ * @param data_length
+ * @param received_data
+ */
+ bool receiveMsg ( const Sci_Msg_Header * header,
+ const unsigned long data_length,
+ const unsigned char * received_data ) const;
+
+ void displaySpecializedSciMsgArray ( ) const;
+
+ // public attribute accessor methods
+ //
+
+ // private attribute accessor methods
+ //
+
+ /**
+ * @return StationsList *
+ */
+ StationsList * getStationsList ( ) const;
+
+ /**
+ * @return bool
+ * @param p_list_of_stations
+ */
+ bool setStationsList ( StationsList * p_list_of_stations );
+
+ /**
+ * Get the value of mArraySize
+ * @return the value of mArraySize
+ */
+ unsigned int getArraySize ( ) const;
+
+ /**
+ * Get the value of mpSpecializedSciMsgArray
+ * @return the value of mpSpecializedSciMsgArray
+ */
+ SciMsg ** getSpecializedSciMsgArray ( ) const;
+
+ /**
+ * @return bool
+ * @param current_tick_value
+ */
+ bool updateTickValue ( const Network_Clock_Tick current_tick_value );
+
+ /**
+ * @return Network_Clock_Tick
+ */
+ Network_Clock_Tick getNetworkClockTick ( ) const;
+
+ // protected attribute accessor methods
+ //
+
+private:
+
+ // private methods
+ //
+
+ bool log ( ) const;
+
+ /**
+ * @return bool
+ * @param type
+ * @param received_sci_msg
+ */
+ bool createSciMsg ( const Sci_Msg_Type type, SciMsg ** received_sci_msg ) const;
+
+ /**
+ * @return bool
+ * @param msg_header
+ * @param data_length
+ * @param remaining_data
+ * @param received_sci_msg
+ */
+ bool fillSciMsg ( const Sci_Msg_Header * msg_header,
+ const unsigned long data_length,
+ const unsigned char * received_data,
+ SciMsg ** created_sci_msg ) const;
+
+ /**
+ * @return bool
+ * @param received_sci_msg
+ */
+ bool processSciMsg ( SciMsg * received_sci_msg ) const;
+
+ std::string displaySciMsgType ( uint8_t sci_msg_type ) const;
+
+ void displayStatus ( ) const;
+
+ void initAttributes ( );
+
+ // private attribute accessor methods
+ //
+
+ /**
+ * @return std::string
+ */
+ std::string getStationLog ( ) const;
+
+protected:
+
+ // protected methods
+ //
+
+};
+
+
+#endif // SCISERVER_H