30#include <ipc_thread.h>
43class EXPCL_PANDA_DEVICE ClientBase :
public TypedReferenceCount {
60 const std::string &device_name);
63 virtual PT(ClientDevice) make_device(
TypeHandle device_type,
64 const std::string &device_name)=0;
66 virtual bool disconnect_device(
TypeHandle device_type,
67 const std::string &device_name,
68 ClientDevice *device);
70 virtual void do_poll();
73 typedef pmap<std::string, ClientDevice *> DevicesByName;
74 typedef pmap<TypeHandle, DevicesByName> Devices;
78 double _last_poll_time;
84 thread *_client_thread;
87 static void* st_callback(
void *arg);
96 static void init_type() {
97 TypedReferenceCount::init_type();
99 TypedReferenceCount::get_class_type());
102 return get_class_type();
104 virtual TypeHandle force_init_type() {init_type();
return get_class_type();}
109 friend class ClientDevice;
PointerTo< ClientDevice > get_device(TypeHandle device_type, const std::string &device_name)
Returns a ClientDevice pointer that corresponds to the named device of the indicated device type.
bool is_forked() const
Returns true if the ClientBase has been forked (and, therefore, poll() does not need to be called),...
void set_coordinate_system(CoordinateSystem cs)
Specifies the coordinate system that all devices associated with this client will operate in.
bool poll()
Initiates a poll of the client devices, if we are not forked and if we have not already polled this f...
CoordinateSystem get_coordinate_system() const
Returns the coordinate system that all devices associated with this client will operate in.
bool fork_asynchronous_thread(double poll_time)
Forks a separate thread to do all the polling of connected devices.
double get_last_poll_time() const
Returns the time (according to the global ClockObject's get_real_time() method) of the last device po...
TypeHandle is the identifier used to differentiate C++ class types.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
void register_type(TypeHandle &type_handle, const std::string &name)
This inline function is just a convenient way to call TypeRegistry::register_type(),...
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.