Changeset 12060 for source/ariba/communication/EndpointDescriptor.h
- Timestamp:
- Jun 19, 2013, 11:05:49 AM (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
source/ariba/communication/EndpointDescriptor.h
r7744 r12060 42 42 #include <string> 43 43 #include <set> 44 #include "ariba/utility/serialization.h"44 //#include "ariba/utility/serialization.h" 45 45 #include "ariba/utility/types/PeerID.h" 46 #include "ariba/utility/addressing/endpoint_set.hpp" 46 47 #include "ariba/utility/addressing2/endpoint_set.hpp" 48 49 // reboost messages 50 #include "ariba/utility/transport/messages/message.hpp" 51 47 52 48 53 namespace ariba { … … 51 56 using_serialization; 52 57 using namespace std; 53 using namespace ariba::addressing;54 58 using ariba::utility::PeerID; 55 59 56 class EndpointDescriptor: public VSerializeable { VSERIALIZEABLE 57 friend class BaseCommunication; 60 61 /** 62 * This class is used a transitions helper between the old addressing and 63 * serialization to the new addressing2 and the new message classes 64 * 65 * Maybe it will be replaced, or at least modified in the future. 66 */ 67 //class EndpointDescriptor: public VSerializeable { VSERIALIZEABLE 68 // friend class BaseCommunication; 69 class EndpointDescriptor 70 { 71 friend class BaseCommunication; 58 72 59 73 public: … … 68 82 69 83 /// construct end-points from an endpoint set 70 EndpointDescriptor(const endpoint_set&endpoints );84 EndpointDescriptor(const PeerID& peer_id, addressing2::EndpointSetPtr endpoints ); 71 85 86 // FIXME NOT WORKING !! 72 87 /// construct end-points from a string 73 88 EndpointDescriptor(const string& str); … … 75 90 /// convert end-points to string 76 91 string toString() const { 77 return endpoints .to_string();92 return endpoints->to_string(); 78 93 } 79 94 … … 90 105 } 91 106 92 /// create endpoint93 static EndpointDescriptor* fromString(string str) {94 return new EndpointDescriptor(str);95 }107 // /// create endpoint 108 // static EndpointDescriptor* fromString(string str) { 109 // return new EndpointDescriptor(str); 110 // } 96 111 97 112 bool operator==(const EndpointDescriptor& rh) const { … … 113 128 114 129 /// returns the end-points of this descriptor 115 endpoint_set& getEndpoints(){130 addressing2::const_EndpointSetPtr getEndpoints() const { 116 131 return endpoints; 117 132 } 118 119 /// returns the end-points of this descriptor120 const endpoint_set& getEndpoints() const{121 returnendpoints;133 134 void replace_endpoint_set(addressing2::EndpointSetPtr new_endpoints) 135 { 136 endpoints = new_endpoints; 122 137 } 123 138 124 139 /// returns a reference to the peer id 125 140 PeerID& getPeerId() { … … 132 147 return peerId; 133 148 } 149 150 /// returns a message with peerId and endpoints in it 151 reboost::message_t serialize() const; 152 153 /// deserialite peerId and endpoints 154 reboost::shared_buffer_t deserialize(reboost::shared_buffer_t buff); 155 134 156 private: 135 endpoint_setendpoints;157 addressing2::EndpointSetPtr endpoints; 136 158 PeerID peerId; 137 159 }; … … 139 161 }} // namespace ariba, communication 140 162 141 sznBeginDefault( ariba::communication::EndpointDescriptor, X ){ 142 143 // serialize peer id 144 X && &peerId; 145 146 // serialize end-points 147 uint16_t len = endpoints.to_bytes_size(); 148 X && len; 149 uint8_t* buffer = X.bytes( len ); 150 if (buffer!=NULL) { 151 if (X.isDeserializer()) endpoints.assign(buffer,len); 152 else endpoints.to_bytes(buffer); 153 } 154 }sznEnd(); 163 //sznBeginDefault( ariba::communication::EndpointDescriptor, X ){ 164 // 165 // // TODO 166 // assert(false); 167 // 168 // // serialize peer id 169 // X && &peerId; 170 // 171 // // serialize end-points 172 // uint16_t len = endpoints.to_bytes_size(); 173 // X && len; 174 // uint8_t* buffer = X.bytes( len ); 175 // if (buffer!=NULL) { 176 // if (X.isDeserializer()) endpoints.assign(buffer,len); 177 // else endpoints.to_bytes(buffer); 178 // } 179 //}sznEnd(); 155 180 156 181 #endif /*ENDPOINTDESCRIPTOR_H_*/
Note:
See TracChangeset
for help on using the changeset viewer.