00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017 #ifdef HAVE_CONFIG_H
00018 #include "config.h"
00019 #endif
00020
00021 #ifndef SOAP_STRUCTURES_H
00022 #define SOAP_STRUCTURES_H
00023
00024 #include <vector>
00025 #include <string>
00026
00027 #include <dalt_client/entity.h>
00028
00029 namespace DALT_Client {
00031 static const char * name_space = "http://dalt";
00032 }
00033
00034 namespace EasySoap {
00035
00037
00041 struct SOAPEntity
00042 {
00043 int entity_id;
00044 SOAPString entity_type;
00045 SOAPArray<int> coordinates;
00046
00047 SOAPEntity() {}
00048 SOAPEntity(const DALT_Client::Entity& e)
00049 {
00050 entity_id = e.id;
00051 entity_type = e.type.c_str();
00052 for(unsigned int i=0;i<e.coordinates.size();i++)
00053 coordinates.Add(e.coordinates[i]);
00054 }
00055
00056 DALT_Client::Entity* createEntity()
00057 {
00058 vector<int> vec_coord;
00059 for(unsigned int i=0;i<coordinates.size();i++)
00060 vec_coord.push_back(coordinates[i]);
00061 return new DALT_Client::Entity(entity_type.Str(), entity_id, vec_coord);
00062 }
00063
00064 bool operator==(const SOAPEntity& other) const
00065 {
00066 return entity_id == other.entity_id &&
00067 entity_type == other.entity_type &&
00068 coordinates == other.coordinates;
00069 }
00070
00071 bool operator!=(const SOAPEntity& other) const
00072 {
00073 return entity_id != other.entity_id ||
00074 entity_type != other.entity_type ||
00075 !(coordinates == other.coordinates);
00076 }
00077 };
00078
00080 class SOAPTypeTraits< SOAPArray<SOAPEntity> > : public SOAPArrayTypeTraits
00081 {};
00082
00084 class SOAPTypeTraits<SOAPEntity>
00085 {
00086 public:
00087 static void GetType(SOAPQName& qname)
00088 {
00089 qname.Set("Entity", DALT_Client::name_space);
00090 }
00091
00092 static SOAPParameter& Serialize(SOAPParameter& param, const SOAPEntity& val)
00093 {
00094 param.AddParameter("entity_id") << val.entity_id;
00095 param.AddParameter("entity_type") << val.entity_type;
00096 param.AddParameter("coordinates") << val.coordinates;
00097 return param;
00098 }
00099
00100 static const SOAPParameter& Deserialize(const SOAPParameter& param, SOAPEntity& val)
00101 {
00102 param.GetParameter("entity_id") >> val.entity_id;
00103 param.GetParameter("entity_type") >> val.entity_type;
00104 param.GetParameter("coordinates") >> val.coordinates;
00105 return param;
00106 }
00107 };
00108
00113 struct SOAPClientInfo
00114 {
00115 int last_cycle_time;
00116 int average_cycle_time;
00117
00118 SOAPClientInfo() {}
00119 SOAPClientInfo(const SOAPClientInfo& e)
00120 {
00121 last_cycle_time = e.last_cycle_time;
00122 average_cycle_time = e.average_cycle_time;
00123 }
00124
00125 bool operator==(const SOAPClientInfo& other) const
00126 {
00127 return last_cycle_time == other.last_cycle_time &&
00128 average_cycle_time == other.average_cycle_time;
00129 }
00130
00131 bool operator!=(const SOAPClientInfo& other) const
00132 {
00133 return last_cycle_time != other.last_cycle_time ||
00134 average_cycle_time != other.average_cycle_time;
00135 }
00136 };
00137
00139 class SOAPTypeTraits<SOAPClientInfo>
00140 {
00141 public:
00142 static void GetType(SOAPQName& qname)
00143 {
00144 qname.Set("ClientInformation", DALT_Client::name_space);
00145 }
00146
00147 static SOAPParameter& Serialize(SOAPParameter& param, const SOAPClientInfo& val)
00148 {
00149 param.AddParameter("last_cycle_time") << val.last_cycle_time;
00150 param.AddParameter("average_cycle_time") << val.average_cycle_time;
00151 return param;
00152 }
00153
00154 static const SOAPParameter& Deserialize(const SOAPParameter& param, SOAPClientInfo& val)
00155 {
00156 param.GetParameter("last_cycle_time") >> val.last_cycle_time;
00157 param.GetParameter("average_cycle_time") >> val.average_cycle_time;
00158 return param;
00159 }
00160 };
00161
00163 struct SOAPAgentInfo
00164 {
00165 int last_cycle_time;
00166 int average_cycle_time;
00167 SOAPString type;
00168
00169 SOAPAgentInfo()
00170 {
00171 last_cycle_time = average_cycle_time = 0;
00172 type = "";
00173 }
00174 SOAPAgentInfo(const SOAPAgentInfo& e)
00175 {
00176 last_cycle_time = e.last_cycle_time;
00177 average_cycle_time = e.average_cycle_time;
00178 type = e.type;
00179 }
00180
00181 bool operator==(const SOAPAgentInfo& other) const
00182 {
00183 return last_cycle_time == other.last_cycle_time &&
00184 average_cycle_time == other.average_cycle_time &&
00185 type == other.type;
00186 }
00187 };
00188
00190 class SOAPTypeTraits<SOAPAgentInfo>
00191 {
00192 public:
00193 static void GetType(SOAPQName& qname)
00194 {
00195 qname.Set("AgentInformation", DALT_Client::name_space);
00196 }
00197
00198 static SOAPParameter& Serialize(SOAPParameter& param, const SOAPAgentInfo& val)
00199 {
00200 param.AddParameter("last_cycle_time") << val.last_cycle_time;
00201 param.AddParameter("average_cycle_time") << val.average_cycle_time;
00202 param.AddParameter("type") << val.type;
00203 return param;
00204 }
00205
00206 static const SOAPParameter& Deserialize(const SOAPParameter& param, SOAPAgentInfo& val)
00207 {
00208 param.GetParameter("last_cycle_time") >> val.last_cycle_time;
00209 param.GetParameter("average_cycle_time") >> val.average_cycle_time;
00210 param.GetParameter("type") >> val.type;
00211 return param;
00212 }
00213 };
00214 class SOAPTypeTraits< SOAPArray<SOAPAgentInfo> > : public SOAPArrayTypeTraits
00215 {};
00216
00217 }
00218
00219 #endif