Ignore:
Timestamp:
Feb 15, 2017, 2:41:36 PM (5 years ago)
Author:
Sanahuja Guillaume
Message:

improved vprnobject added to vrpnclient

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/lib/FlairSensorActuator/src/VrpnClient_impl.cpp

    r139 r140  
    8282VrpnClient_impl::~VrpnClient_impl() {
    8383  if (!UseXbee()) {
    84     // on fait une copie car le delete touche a xbee_objects_copy via
     84    // on fait une copie car le delete touche a trackables_copy via
    8585    // RemoveTrackable
    86     vector<VrpnObject *> trackables_copy = trackables;
     86    vector<VrpnObject_impl *> trackables_copy = trackables;
    8787    for (unsigned int i = 0; i < trackables_copy.size(); i++)
    88       delete trackables_copy.at(i);
     88      delete trackables_copy.at(i)->self;
    8989    // trackables.clear();
    9090  } else {
     
    114114}
    115115
    116 void VrpnClient_impl::AddTrackable(VrpnObject *obj) {
     116void VrpnClient_impl::AddTrackable(VrpnObject_impl *obj) {
    117117  mutex->GetMutex();
    118118  trackables.push_back(obj);
     
    120120}
    121121
    122 void VrpnClient_impl::RemoveTrackable(VrpnObject *obj) {
     122void VrpnClient_impl::RemoveTrackable(VrpnObject_impl *obj) {
    123123  mutex->GetMutex();
    124   for (vector<VrpnObject *>::iterator it = trackables.begin();
     124  for (vector<VrpnObject_impl *>::iterator it = trackables.begin();
    125125       it < trackables.end(); it++) {
    126126    if (*it == obj) {
    127127      trackables.erase(it);
     128      break;
     129    }
     130  }
     131  for (vector<xbee_object>::iterator it = xbee_objects.begin();
     132       it < xbee_objects.end(); it++) {
     133    if ((*it).vrpnobject == obj) {
     134      xbee_objects.erase(it);
    128135      break;
    129136    }
     
    138145  mutex->GetMutex();
    139146  xbee_objects.push_back(tmp);
    140   mutex->ReleaseMutex();
    141 }
    142 
    143 void VrpnClient_impl::RemoveTrackable(VrpnObject_impl *obj) {
    144   mutex->GetMutex();
    145   for (vector<xbee_object>::iterator it = xbee_objects.begin();
    146        it < xbee_objects.end(); it++) {
    147     if ((*it).vrpnobject == obj) {
    148       xbee_objects.erase(it);
    149       break;
    150     }
    151   }
    152147  mutex->ReleaseMutex();
    153148}
     
    232227            mutex->GetMutex();
    233228            for (unsigned int i = 0; i < trackables.size(); i++)
    234                 trackables.at(i)->mainloop();
     229                trackables.at(i)->tracker->mainloop();
    235230            mutex->ReleaseMutex();
    236231        } else {
Note: See TracChangeset for help on using the changeset viewer.