Update of /cvsroot/playerstage/code/player/client_libs/libplayerc++
In directory 
sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv28583/client_libs/libplayerc++

Modified Files:
        blackboardproxy.cc playerc++.h 
Log Message:
changed blackboard interface to use a string group id instead of an integer


Index: playerc++.h
===================================================================
RCS file: 
/cvsroot/playerstage/code/player/client_libs/libplayerc++/playerc++.h,v
retrieving revision 1.109
retrieving revision 1.110
diff -C2 -d -r1.109 -r1.110
*** playerc++.h 4 Feb 2008 19:54:27 -0000       1.109
--- playerc++.h 6 Feb 2008 19:38:36 -0000       1.110
***************
*** 343,349 ****
        ~BlackBoardProxy();
        /** Subscribe to a key. If the key does not exist the default value is 
returned. The user must free the entry. */
!       player_blackboard_entry_t *SubscribeToKey(const char *key, int32_t 
group_id = 0);
        /** Stop receiving updates about this key. */
!       void UnsubscribeFromKey(const char *key, int32_t group_id = 0);
        /** Set a key value */
        void SetEntry(const player_blackboard_entry_t &entry);
--- 343,349 ----
        ~BlackBoardProxy();
        /** Subscribe to a key. If the key does not exist the default value is 
returned. The user must free the entry. */
!       player_blackboard_entry_t *SubscribeToKey(const char *key, const char* 
group = "");
        /** Stop receiving updates about this key. */
!       void UnsubscribeFromKey(const char *key, const char* group = "");
        /** Set a key value */
        void SetEntry(const player_blackboard_entry_t &entry);

Index: blackboardproxy.cc
===================================================================
RCS file: 
/cvsroot/playerstage/code/player/client_libs/libplayerc++/blackboardproxy.cc,v
retrieving revision 1.5
retrieving revision 1.6
diff -C2 -d -r1.5 -r1.6
*** blackboardproxy.cc  30 Jan 2008 02:06:46 -0000      1.5
--- blackboardproxy.cc  6 Feb 2008 19:38:36 -0000       1.6
***************
*** 91,103 ****
  }
  
! player_blackboard_entry_t *BlackBoardProxy::SubscribeToKey(const char *key, 
int32_t group_id)
  {
    scoped_lock_t lock(mPc->mMutex);
    player_blackboard_entry_t *pointer;
!   if (0 != playerc_blackboard_subscribe_to_key(mDevice, key, group_id, 
&pointer))
    {
        throw PlayerError("BlackBoardProxy::SubscribeToKey(const string& key)", 
"could not subscribe to key");
    }
! 
    // We don't want a mix of malloc and new, so make a copy using only new
    player_blackboard_entry_t *result = new player_blackboard_entry_t;
--- 91,105 ----
  }
  
! player_blackboard_entry_t *BlackBoardProxy::SubscribeToKey(const char *key, 
const char* group)
  {
    scoped_lock_t lock(mPc->mMutex);
    player_blackboard_entry_t *pointer;
! 
!   if (0 != playerc_blackboard_subscribe_to_key(mDevice, key, group, &pointer))
    {
        throw PlayerError("BlackBoardProxy::SubscribeToKey(const string& key)", 
"could not subscribe to key");
    }
!   assert(pointer);
!   
    // We don't want a mix of malloc and new, so make a copy using only new
    player_blackboard_entry_t *result = new player_blackboard_entry_t;
***************
*** 105,113 ****
    result->type = pointer->type;
    result->subtype = pointer->subtype;
! 
    result->key_count = pointer->key_count;
    result->key = new char[result->key_count];
    memcpy(result->key, pointer->key, result->key_count);
    
    result->data_count = pointer->data_count;
    result->data = new uint8_t[result->data_count];
--- 107,119 ----
    result->type = pointer->type;
    result->subtype = pointer->subtype;
!   
    result->key_count = pointer->key_count;
    result->key = new char[result->key_count];
    memcpy(result->key, pointer->key, result->key_count);
    
+   result->group_count = pointer->group_count;
+   result->group = new char[result->group_count];
+   memcpy(result->group, pointer->group, result->group_count);
+   
    result->data_count = pointer->data_count;
    result->data = new uint8_t[result->data_count];
***************
*** 115,120 ****
  
    // Get rid of the original
!   free(pointer->key);
!   free(pointer->data);
    free(pointer);
    
--- 121,136 ----
  
    // Get rid of the original
!   if (pointer->key != NULL)
!   {
!       free(pointer->key);
!   }
!   if (pointer->group != NULL)
!   {
!       free(pointer->group);
!   }
!   if (pointer->data != NULL)
!   {
!       free(pointer->data);
!   }
    free(pointer);
    
***************
*** 122,129 ****
  }
  
! void BlackBoardProxy::UnsubscribeFromKey(const char *key, int32_t group_id)
  {
        scoped_lock_t lock(mPc->mMutex);
!       if (0 != playerc_blackboard_unsubscribe_from_key(mDevice, key, 
group_id))
        {
                throw PlayerError("BlackBoardProxy::UnsubscribeFromKey(const 
string& key)", "could not unsubscribe from key");
--- 138,145 ----
  }
  
! void BlackBoardProxy::UnsubscribeFromKey(const char *key, const char* group)
  {
        scoped_lock_t lock(mPc->mMutex);
!       if (0 != playerc_blackboard_unsubscribe_from_key(mDevice, key, group))
        {
                throw PlayerError("BlackBoardProxy::UnsubscribeFromKey(const 
string& key)", "could not unsubscribe from key");
***************
*** 143,146 ****
--- 159,163 ----
        }
  
+       // delete shallow copy
        delete copy;
  }


-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
Playerstage-commit mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/playerstage-commit

Reply via email to