C_ProtocolBinaryBodyNotInterpreted Class Reference

Inheritance diagram for C_ProtocolBinaryBodyNotInterpreted:

C_ProtocolBinary C_ProtocolBinaryFrame C_ProtocolFrame List of all members.

Public Types

typedef C_ProtocolBinaryBodyNotInterpreted::_struct_header_body_size_pos T_HeaderBodyPositionSize
typedef C_ProtocolBinaryBodyNotInterpreted::_struct_header_body_size_posT_pHeaderBodyPositionSize
typedef map_t< int, T_HeaderBodyPositionSizeT_HeaderBodyPositionSizeMap
typedef map_t< int, T_HeaderBodyPositionSize > * T_pHeaderBodyPositionSizeMap

Public Member Functions

 C_ProtocolBinaryBodyNotInterpreted ()
virtual ~C_ProtocolBinaryBodyNotInterpreted ()
virtual C_MessageFramecreate_new_message (void *P_xml, T_pInstanceDataList P_list, int *P_nb_value)
virtual C_MessageFramecreate_new_message (C_MessageFrame *P_msg)
virtual int decode_body (unsigned char *P_buf, size_t P_size, T_pBodyValue P_valDec, int *P_nbValDec, int *P_headerId)
virtual C_ProtocolFrame::T_MsgError encode_body (int P_nbVal, T_pBodyValue P_val, unsigned char *P_buf, size_t *P_size)
virtual T_ManagementSessionId * get_manage_session_elt (int P_id)
virtual int get_nb_management_session ()
virtual bool check_present_session (int P_msg_id, int P_id)
virtual bool find_present_session (int P_msg_id, int P_id)
virtual iostream_output & print_body (iostream_output &P_stream, int P_nb, T_pBodyValue P_val, int P_level=0)
void get_field_position (T_pHeaderBodyPositionSize P_pos, int P_id)

Protected Member Functions

virtual int xml_interpretor (C_XmlData *P_def)
virtual int analyze_body_from_xml (C_XmlData *P_def)
virtual int get_header_body_values_from_xml (C_XmlData *P_def)
virtual int get_header_values_from_xml (C_XmlData *P_def)
virtual int analyze_sessions_id_from_xml (C_XmlData *P_def)

Protected Attributes

bool ** m_field_present_table
T_pHeaderBodyPositionSizeMap m_header_body_position_size_map
T_pManagementSessionId m_value_sessions_table
int m_value_sessions_table_size

Classes

struct  _struct_header_body_size_pos

Detailed Description

Definition at line 27 of file C_ProtocolBinaryBodyNotInterpreted.hpp.


Member Function Documentation

C_MessageFrame * C_ProtocolBinaryBodyNotInterpreted::create_new_message C_MessageFrame P_msg  )  [virtual]
 

Create a new message

Reimplemented from C_ProtocolBinary.

Definition at line 768 of file C_ProtocolBinaryBodyNotInterpreted.cpp.

00768                                                                                             {
00769 
00770   C_MessageBinaryBodyNotInterpreted *L_msg ;
00771 
00772   GEN_DEBUG(1, "C_ProtocolBinaryBodyNotInterpreted::create_new_message() start: msg pt");
00773   NEW_VAR(L_msg, C_MessageBinaryBodyNotInterpreted(this));
00774   if (P_msg != NULL) {
00775     (*L_msg) = *((C_MessageBinaryBodyNotInterpreted*)P_msg) ;
00776   }
00777   GEN_DEBUG(1, "C_ProtocolBinaryBodyNotInterpreted::create_new_message() end: msg pt");
00778   return (L_msg);
00779 }

C_MessageFrame * C_ProtocolBinaryBodyNotInterpreted::create_new_message void *  P_xml,
T_pInstanceDataList  P_list,
int *  P_nb_value
[virtual]
 

Create a new message

Reimplemented from C_ProtocolBinary.

Definition at line 781 of file C_ProtocolBinaryBodyNotInterpreted.cpp.

References C_ProtocolBinary::analyze_setfield(), C_ProtocolBinary::delete_body_value(), C_XmlData::find_value(), C_ProtocolBinary::get_body_value_type(), C_ProtocolBinary::get_header_body_name(), C_ProtocolBinary::get_header_body_value_id(), C_ProtocolBinary::get_header_name(), C_ProtocolBinary::get_header_value_id(), C_XmlData::get_name(), C_ProtocolBinary::_struct_body_value::m_sub_val, C_ProtocolBinary::process_grouped_type(), C_ProtocolBinary::reset_grouped_body_value(), C_ProtocolBinary::set_body_value(), and C_MessageBinary::set_header_id_value().

00783                                                                                                         {
00784 
00785   C_XmlData                            *L_Xml = (C_XmlData*) P_xml ;
00786   bool                                  L_msgOk = true             ;
00787   C_MessageBinaryBodyNotInterpreted    *L_msg                      ;
00788   char                                 *L_currentName              ;
00789   int                                   L_header_val_id            ;
00790   int                                   L_body_val_id              ;
00791   
00792   GEN_DEBUG(1, "C_ProtocolBinaryBodyNotInterpreted::create_new_message() start: xml");
00793   
00794   // Allocate a new message
00795   NEW_VAR(L_msg, C_MessageBinaryBodyNotInterpreted(this));
00796 
00797   // Get the message name from XML definition
00798   L_currentName = L_Xml -> get_name () ;
00799 
00800   if (strcmp(L_currentName, get_header_name()) == 0) {
00801     // message decoding
00802     L_currentName = L_Xml -> find_value ((char*) "name") ;
00803     if (L_currentName == NULL) {
00804       GEN_ERROR(E_GEN_FATAL_ERROR, 
00805                 "name value is mandatory for ["
00806                 << get_header_name()
00807                 << "]");
00808       L_msgOk = false ;
00809     } else {
00810       GEN_DEBUG(1, "C_ProtocolBinaryBodyNotInterpreted::create_new_message() " 
00811                 << "the name of this message is " << L_currentName );
00812 
00813       L_header_val_id = get_header_value_id(L_currentName) ;
00814 
00815       GEN_DEBUG(1, "C_ProtocolBinaryBodyNotInterpreted::create_new_message() " 
00816                 << "L_header_val_id = " << L_header_val_id );
00817 
00818       if (L_header_val_id == -1) {
00819         GEN_ERROR(E_GEN_FATAL_ERROR,
00820                   "unknown name ["
00821                   << L_currentName << "] for [" << get_header_name() << "]");
00822         L_msgOk = false ;
00823       } else { 
00824         // now search for body values
00825         T_pXmlData_List           L_listBodyVal ;
00826         T_XmlData_List::iterator  L_bodyValIt ;
00827         C_XmlData                *L_bodyData ;
00828         // int                       L_nbBodyVal ;
00829         char                     *L_bodyName, *L_bodyValue ;
00830         C_ProtocolBinary::T_BodyValue   L_bodyVal ;
00831 
00832         L_msg->set_header_id_value(L_header_val_id);
00833         
00834         L_listBodyVal = L_Xml -> get_sub_data() ;
00835         
00836         if (L_listBodyVal != NULL) {
00837           // L_nbBodyVal = L_listBodyVal->size() ;
00838           for (L_bodyValIt  = L_listBodyVal->begin() ;
00839                L_bodyValIt != L_listBodyVal->end() ;
00840                L_bodyValIt++) {
00841             L_bodyData = *L_bodyValIt ;
00842             
00843             if (strcmp(L_bodyData->get_name(), 
00844                        get_header_body_name())==0) {
00845               L_bodyName = L_bodyData->find_value((char*)"name");
00846               if (L_bodyName == NULL) {
00847                 GEN_ERROR(E_GEN_FATAL_ERROR,
00848                           "name value is mandatory for ["
00849                           << get_header_body_name()
00850                           << "] definition");
00851                 L_msgOk = false ;
00852               }
00853                 
00854               GEN_DEBUG(1, "C_ProtocolBinary::create_new_message() "
00855                         << "L_bodyName is    [" << L_bodyName << "]");
00856 
00857               L_body_val_id = get_header_body_value_id(L_bodyName) ;
00858 
00859               if (L_body_val_id == -1) {
00860                 GEN_ERROR(E_GEN_FATAL_ERROR,
00861                           "No definition found for ["
00862                           << L_bodyName << "]");
00863                 L_msgOk = false ;
00864                 break ;
00865               } 
00866                 
00867               GEN_DEBUG(1, "C_ProtocolBinary::create_new_message() " 
00868                         << "L_body_val_id is " 
00869                         << L_body_val_id );
00870               
00871               if (get_body_value_type (L_body_val_id) 
00872                   == E_TYPE_GROUPED) {
00873 
00874                 GEN_DEBUG(1, "C_ProtocolBinary::create_new_message() " 
00875                              << L_bodyName << " is  grouped element" );
00876 
00877                 if (process_grouped_type(L_bodyData, L_body_val_id, 
00878                                          &L_bodyVal) != 0) {
00879                   GEN_ERROR(E_GEN_FATAL_ERROR,
00880                             "Grouped Type processing Error for "
00881                             << L_bodyName);
00882                   L_msgOk = false ;
00883                   break ;
00884                 }
00885 
00886                 // Add the grouped value in message
00887                 L_msg->C_MessageBinary::set_body_value(&L_bodyVal);
00888 
00889                 // Now do not forget to clean L_bodyVal
00890                 reset_grouped_body_value(&L_bodyVal);
00891                 FREE_TABLE(L_bodyVal.m_sub_val);
00892               } else { 
00893                 bool L_toBeDelete = false;
00894 
00895                 // not grouped value
00896                 L_bodyValue = L_bodyData->find_value((char*)"value");
00897                 if (L_bodyValue == NULL) {
00898                   GEN_ERROR(E_GEN_FATAL_ERROR,
00899                             "value is mandatory for ["
00900                             << get_header_body_name()
00901                             << "] definition");
00902                   L_msgOk = false ;
00903                   break ;
00904                 }
00905                 
00906                 GEN_DEBUG(1, "C_ProtocolBinary::create_new_message() " 
00907                           << "L_bodyValue is \"" << L_bodyValue << "\"" );
00908                 
00909                 if (C_ProtocolBinary::set_body_value(L_body_val_id, 
00910                                    L_bodyValue,
00911                                    1,
00912                                    &L_bodyVal,
00913                                    &L_toBeDelete) == 0) {
00914                   L_msg->C_MessageBinary::set_body_value(&L_bodyVal);
00915 
00916                   if (L_toBeDelete) {
00917                     // Now do not forget to clean L_bodyVal
00918                    delete_body_value(&L_bodyVal);
00919                   }
00920 
00921                 } else {
00922                   GEN_ERROR(E_GEN_FATAL_ERROR,
00923                             "Bad format for ["
00924                             << L_bodyValue << "]");
00925                   L_msgOk = false ;
00926                   break ;
00927                 }
00928                 
00929               } 
00930 
00931             } else if (strcmp(L_bodyData->get_name(),
00932                               (char*)"setfield")==0) {
00933               unsigned long   L_val_setfield = 0 ;
00934               int             L_id_setfield   = 0 ;
00935               L_msgOk = (analyze_setfield(L_bodyData, &L_id_setfield ,&L_val_setfield) == -1) 
00936                 ? false : true  ;
00937               if (L_msgOk) {
00938                 L_msg->C_MessageBinary::set_header_value(L_id_setfield, L_val_setfield);
00939               }
00940             } else {
00941               GEN_ERROR(E_GEN_FATAL_ERROR, 
00942                         "Unkown section ["
00943                         << L_bodyData->get_name()
00944                         << "]");
00945               L_msgOk = false;
00946               break ;
00947             }
00948             if (L_msgOk == false) break ;
00949           }
00950         } // BodyVal = NULL
00951       }
00952     }
00953   }
00954 
00955   // TO-REMOVE
00956   if (L_msgOk == false) {
00957     DELETE_VAR(L_msg);
00958   } else {
00959     // Store the description message in list
00960     m_messageList->push_back(L_msg);
00961   }
00962 
00963   GEN_DEBUG(1, "C_ProtocolBinaryBodyNotInterpreted::create_new_message() end: xml");
00964 
00965   //  L_msg->dump(std::cerr);
00966 
00967   return (L_msg);
00968 }


The documentation for this class was generated from the following files:
Generated on Wed Mar 7 14:57:55 2007 for Seagull by  doxygen 1.4.6