Update of /cvsroot/playerstage/code/player/examples/libplayerc++
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv9485/examples/libplayerc++
Modified Files:
Tag: release-2-0-patches
example3.cc
Log Message:
merged many changes from HEAD
Index: example3.cc
===================================================================
RCS file: /cvsroot/playerstage/code/player/examples/libplayerc++/example3.cc,v
retrieving revision 1.7
retrieving revision 1.7.2.1
diff -C2 -d -r1.7 -r1.7.2.1
*** example3.cc 25 Feb 2006 22:29:13 -0000 1.7
--- example3.cc 22 Sep 2006 23:58:34 -0000 1.7.2.1
***************
*** 1,26 ****
- // For anyone who looks at this file:
- //
- // I'm using this as a playground for *contemplating* new functionality of the
- // libplayerc++ library, so it may not make any sense.
- //
- // You've been warned...
-
#include <libplayerc++/playerc++.h>
#include <iostream>
! #include <unistd.h>
!
! #include "args.h"
!
! template<typename T>
! void Print(T t)
! {
! std::cout << t << std::endl;
! }
!
! template<typename T>
! void Print_Ref(T t)
! {
! std::cout << *t << std::endl;
! }
int main(int argc, char** argv)
--- 1,5 ----
#include <libplayerc++/playerc++.h>
#include <iostream>
! #include <list>
int main(int argc, char** argv)
***************
*** 29,72 ****
{
using namespace PlayerCc;
! parse_args(argc, argv);
!
! PlayerClient client(gHostname, gPort);
!
! client.SetDataMode(gDataMode);
!
! client.RequestDeviceList();
! std::list<playerc_device_info_t> dlist(client.GetDeviceList());
!
! for_each(dlist.begin(), dlist.end(), Print<playerc_device_info_t>);
!
! std::list<ClientProxy*> mProxyList;
!
! CameraProxy cp(&client, gIndex);
! PtzProxy pp(&client, gIndex);
!
! mProxyList.push_back(&cp);
! mProxyList.push_back(&pp);
!
! for_each(mProxyList.begin(),
! mProxyList.end(),
! Print_Ref<ClientProxy*>);
!
! // testing PlayerMultiClient
!
! PlayerClient client1("localhost");
! PlayerClient client2("feyd");
std::list<PlayerClient*> m_client;
-
m_client.push_back(&client1);
m_client.push_back(&client2);
! CameraProxy cp1(&client1);
! PtzProxy pp1(&client1);
! std::for_each(m_client.begin(),
! m_client.end(),
! std::mem_fun(&PlayerClient::ReadIfWaiting));
}
--- 8,37 ----
{
using namespace PlayerCc;
+ // Let's subscribe to a couple of different clients, and
+ // set up a proxy or two.
+ PlayerClient client1("feyd");
+ CameraProxy cp1(&client1);
! PlayerClient client2("rabban");
! CameraProxy cp2(&client2);
+ // We can now create a list of pointers to PlayerClient,
+ // and add two elements
std::list<PlayerClient*> m_client;
m_client.push_back(&client1);
m_client.push_back(&client2);
! while (1)
! {
! // this will now iterate through the list of clients and read from
! // all of them that have data waiting
! std::for_each(m_client.begin(),
! m_client.end(),
! std::mem_fun(&PlayerClient::ReadIfWaiting));
! // output the proxies just for fun
! std::cout << cp1 << std::endl;
! std::cout << cp2 << std::endl;
! }
}
-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys -- and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Playerstage-commit mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/playerstage-commit