Update of /cvsroot/playerstage/code/player/examples/libplayerc++
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv10615/libplayerc++
Modified Files:
example3.cc
Log Message:
Updated docs on MultiClient
Index: example3.cc
===================================================================
RCS file: /cvsroot/playerstage/code/player/examples/libplayerc++/example3.cc,v
retrieving revision 1.7
retrieving revision 1.8
diff -C2 -d -r1.7 -r1.8
*** example3.cc 25 Feb 2006 22:29:13 -0000 1.7
--- example3.cc 4 Jul 2006 16:04:27 -0000 1.8
***************
*** 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;
! }
}
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
Playerstage-commit mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/playerstage-commit