Changeset 347 for XIOS/trunk/src/object_template_impl.hpp
- Timestamp:
- 05/21/12 17:57:22 (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
XIOS/trunk/src/object_template_impl.hpp
r346 r347 145 145 void CObjectTemplate<T>::ClearAllAttributes(void) 146 146 { 147 std::vector<boost::shared_ptr<T> > & avect = 148 CObjectTemplate<T>::GetAllVectobject(CContext::getCurrent()->getId()); 149 typename std::vector<boost::shared_ptr<T> >::iterator 147 vector<T*> avect = CObjectTemplate<T>::getAll() ; 148 typename vector<T*>::iterator 150 149 it = avect.begin(), end = avect.end(); 151 150 … … 165 164 } 166 165 167 168 169 170 shared_ptr<CContext>context=CContext::getCurrent() ;171 166 template <class T> 167 void CObjectTemplate<T>::sendAttributToServer(CAttribute& attr) 168 { 169 CContext* context=CContext::getCurrent() ; 170 172 171 if (!context->hasServer) 173 172 { … … 187 186 } 188 187 189 190 191 192 193 188 } 189 190 template <class T> 191 void CObjectTemplate<T>::recvAttributFromClient(CEventServer& event) 192 { 194 193 195 196 197 198 199 200 201 202 203 204 205 206 207 194 CBufferIn* buffer=event.subEvents.begin()->buffer; 195 string id,attrId; 196 *buffer>>id ; 197 CAttributeMap & attrMap = *get(id); 198 *buffer>>attrId ; 199 CAttribute* attr=attrMap[attrId] ; 200 info(50)<<"attribut recu "<<attrId<<" " ; 201 if (attr->isEmpty()) info(50)<<"--> empty"<<endl ; 202 else info(50) /*<attr->getValue()*/<<endl ; 203 *buffer>>*attr ; 204 info(50)<<"attribut recu "<<attrId<<" " ; 205 if (attr->isEmpty()) info(50)<<"--> empty"<<endl ; 206 else info(50) /*attr->getValue()*/<<endl ; 208 207 } 209 208 … … 238 237 239 238 template <typename T> 240 boost::shared_ptr<T> CObjectTemplate<T>::get(const string & id) 241 { 242 return CObjectFactory::GetObject<T>(id) ; 243 } 244 245 template <typename T> 246 boost::shared_ptr<T> CObjectTemplate<T>::get(const T* ptr) 239 T* CObjectTemplate<T>::get(const string & id) 240 { 241 return CObjectFactory::GetObject<T>(id).get() ; 242 } 243 244 template <typename T> 245 T* CObjectTemplate<T>::get(const T* ptr) 246 { 247 return CObjectFactory::GetObject<T>(ptr).get() ; 248 } 249 250 template <typename T> 251 shared_ptr<T> CObjectTemplate<T>::getShared(const T* ptr) 247 252 { 248 253 return CObjectFactory::GetObject<T>(ptr) ; 249 254 } 250 251 252 template <typename T> 253 const vector<boost::shared_ptr<T> >& CObjectTemplate<T>::getAll() 254 { 255 return CObjectFactory::GetObjectVector<T>() ; 256 } 257 258 template <typename T> 259 const vector<boost::shared_ptr<T> >& CObjectTemplate<T>::getAll(const string & id) 260 { 261 return CObjectFactory::GetObjectVector<T>(id) ; 262 } 263 264 template <typename T> 265 boost::shared_ptr<T> CObjectTemplate<T>::get(const string& contextId, const string & id) 266 { 267 return CObjectFactory::GetObject<T>(contextId,id) ; 268 } 269 270 template <typename T> 271 boost::shared_ptr<T> CObjectTemplate<T>::create(const string & id) 272 { 273 return CObjectFactory::CreateObject<T>(id) ; 255 256 template <typename T> 257 shared_ptr<T> CObjectTemplate<T>::getShared(void) 258 { 259 return CObjectFactory::GetObject<T>((T*)this) ; 260 } 261 262 template <typename T> 263 const vector<T*> CObjectTemplate<T>::getAll() 264 { 265 const vector< shared_ptr<T> >& shared_vect= CObjectFactory::GetObjectVector<T>(); 266 vector<T*> vect ; 267 268 typename vector<shared_ptr<T> >::const_iterator it; 269 for(it=shared_vect.begin();it!=shared_vect.end();++it) vect.push_back(it->get()) ; 270 return vect ; 271 } 272 273 template <typename T> 274 const vector<T*> CObjectTemplate<T>::getAll(const string & id) 275 { 276 const vector< shared_ptr<T> >& shared_vect= CObjectFactory::GetObjectVector<T>(id); 277 vector<T*> vect ; 278 279 typename vector<shared_ptr<T> >::const_iterator it; 280 for(it=shared_vect.begin();it!=shared_vect.end();++it) vect.push_back(it->get()) ; 281 return vect ; 282 } 283 284 template <typename T> 285 T* CObjectTemplate<T>::get(const string& contextId, const string & id) 286 { 287 return CObjectFactory::GetObject<T>(contextId,id).get() ; 288 } 289 290 template <typename T> 291 T* CObjectTemplate<T>::create(const string & id) 292 { 293 return CObjectFactory::CreateObject<T>(id).get() ; 274 294 } ///-------------------------------------------------------------- 275 295 276 296 template <typename T> 277 boost::shared_ptr<T>CObjectTemplate<T>::get(void)297 T* CObjectTemplate<T>::get(void) 278 298 { 279 return CObjectFactory::GetObject<T>((T*)this) ; 280 // return shared_ptr<T>((T*)this) ; 299 return CObjectFactory::GetObject<T>((T*)this).get() ; 281 300 } 282 301 … … 299 318 oss<<"#include \"group_template_impl.hpp\""<<iendl ; 300 319 oss<<"#include \"icutil.hpp\""<<iendl ; 320 oss<<"#include \"timer.hpp\""<<iendl ; 301 321 oss<<iendl ; 302 322 oss<<"extern \"C\""<<iendl ;
Note: See TracChangeset
for help on using the changeset viewer.