Panda3D

dialNode.cxx
Go to the documentation of this file.
1 /**
2 * PANDA 3D SOFTWARE
3 * Copyright (c) Carnegie Mellon University. All rights reserved.
4 *
5 * All use of this software is subject to the terms of the revised BSD
6 * license. You should have received a copy of this license along
7 * with this source code in a file named "LICENSE."
8 *
9 * @file dialNode.cxx
10 * @author drose
11 * @date 2002-03-12
12 */
13
14 #include "dialNode.h"
15 #include "config_device.h"
16 #include "dataNodeTransmit.h"
17 #include "dcast.h"
18
19 TypeHandle DialNode::_type_handle;
20
21 /**
22 *
23 */
24 DialNode::
25 DialNode(ClientBase *client, const std::string &device_name) :
26 DataNode(device_name)
27 {
28 nassertv(client != nullptr);
29 PT(ClientDevice) device =
30 client->get_device(ClientDialDevice::get_class_type(), device_name);
31
32 if (device == nullptr) {
33 device_cat.warning()
34 << "Unable to open dial device " << device_name << "\n";
35 return;
36 }
37
38 if (!device->is_of_type(ClientDialDevice::get_class_type())) {
39 device_cat.error()
40 << "Inappropriate device type " << device->get_type()
41 << " created; expected a ClientDialDevice.\n";
42 return;
43 }
44
45 _dial = DCAST(ClientDialDevice, device);
46 }
47
48 /**
49 *
50 */
51 DialNode::
52 ~DialNode() {
53 // When the _dial pointer destructs, the ClientDialDevice disconnects itself
54 // from the ClientBase, and everything that needs to get turned off does.
55 // Magic.
56 }
57
58 /**
59 * The virtual implementation of transmit_data(). This function receives an
60 * array of input parameters and should generate an array of output
61 * parameters. The input parameters may be accessed with the index numbers
62 * returned by the define_input() calls that were made earlier (presumably in
63 * the constructor); likewise, the output parameters should be set with the
64 * index numbers returned by the define_output() calls.
65 */
66 void DialNode::
67 do_transmit_data(DataGraphTraverser *, const DataNodeTransmit &,
68 DataNodeTransmit &output) {
69 if (is_valid()) {
70 _dial->poll();
71
72 // Not clear yet what we should be transmitting.
73 }
74 }
ClientBase
An abstract base class for a family of client device interfaces–including trackers,...
Definition: clientBase.h:43
ClientDevice
Any of a number of different devices that might be attached to a ClientBase, including trackers,...
Definition: clientDevice.h:27
ClientDialDevice
A device, attached to the ClientBase by a DialNode, that records the data from a single named dial de...
Definition: clientDialDevice.h:30
DataGraphTraverser
This object supervises the traversal of the data graph and the moving of data from one DataNode to it...
Definition: dataGraphTraverser.h:32
DataNodeTransmit
Encapsulates the data generated from (or sent into) any particular DataNode.
Definition: dataNodeTransmit.h:32
DataNode
The fundamental type of node for the data graph.
Definition: dataNode.h:52
DialNode::is_valid
bool is_valid() const
Returns true if the DialNode is valid and connected to a server, false otherwise.
Definition: dialNode.I:19
TypeHandle
TypeHandle is the identifier used to differentiate C++ class types.
Definition: typeHandle.h:81
config_device.h
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
dataNodeTransmit.h
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
dcast.h
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
dialNode.h
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.