Panda3D
 All Classes Functions Variables Enumerations
dialNode.cxx
00001 // Filename: dialNode.cxx
00002 // Created by:  drose (12Mar02)
00003 //
00004 ////////////////////////////////////////////////////////////////////
00005 //
00006 // PANDA 3D SOFTWARE
00007 // Copyright (c) Carnegie Mellon University.  All rights reserved.
00008 //
00009 // All use of this software is subject to the terms of the revised BSD
00010 // license.  You should have received a copy of this license along
00011 // with this source code in a file named "LICENSE."
00012 //
00013 ////////////////////////////////////////////////////////////////////
00014 
00015 #include "dialNode.h"
00016 #include "config_device.h"
00017 #include "dataNodeTransmit.h"
00018 #include "dcast.h"
00019 
00020 TypeHandle DialNode::_type_handle;
00021 
00022 ////////////////////////////////////////////////////////////////////
00023 //     Function: DialNode::Constructor
00024 //       Access: Public
00025 //  Description:
00026 ////////////////////////////////////////////////////////////////////
00027 DialNode::
00028 DialNode(ClientBase *client, const string &device_name) :
00029   DataNode(device_name)
00030 {
00031   nassertv(client != (ClientBase *)NULL);
00032   PT(ClientDevice) device =
00033     client->get_device(ClientDialDevice::get_class_type(), device_name);
00034 
00035   if (device == (ClientDevice *)NULL) {
00036     device_cat.warning()
00037       << "Unable to open dial device " << device_name << "\n";
00038     return;
00039   }
00040 
00041   if (!device->is_of_type(ClientDialDevice::get_class_type())) {
00042     device_cat.error()
00043       << "Inappropriate device type " << device->get_type()
00044       << " created; expected a ClientDialDevice.\n";
00045     return;
00046   }
00047 
00048   _dial = DCAST(ClientDialDevice, device);
00049 }
00050 
00051 ////////////////////////////////////////////////////////////////////
00052 //     Function: DialNode::Destructor
00053 //       Access: Public, Virtual
00054 //  Description:
00055 ////////////////////////////////////////////////////////////////////
00056 DialNode::
00057 ~DialNode() {
00058   // When the _dial pointer destructs, the ClientDialDevice
00059   // disconnects itself from the ClientBase, and everything that needs
00060   // to get turned off does.  Magic.
00061 }
00062 
00063 ////////////////////////////////////////////////////////////////////
00064 //     Function: DialNode::do_transmit_data
00065 //       Access: Protected, Virtual
00066 //  Description: The virtual implementation of transmit_data().  This
00067 //               function receives an array of input parameters and
00068 //               should generate an array of output parameters.  The
00069 //               input parameters may be accessed with the index
00070 //               numbers returned by the define_input() calls that
00071 //               were made earlier (presumably in the constructor);
00072 //               likewise, the output parameters should be set with
00073 //               the index numbers returned by the define_output()
00074 //               calls.
00075 ////////////////////////////////////////////////////////////////////
00076 void DialNode::
00077 do_transmit_data(DataGraphTraverser *, const DataNodeTransmit &,
00078                  DataNodeTransmit &output) {
00079   if (is_valid()) {
00080     _dial->poll();
00081 
00082     // Not clear yet what we should be transmitting.
00083   }
00084 }
 All Classes Functions Variables Enumerations