//FOR C Files
#include <datagram.h>
#include <datagramIterator.h>
#include <bamReader.h>
#include <bamWriter.h>


////////////////////////////////////////////////////////////////////
//     Function: Generic::write_datagram
//       Access: Public
//  Description: Function to write the important information in
//               the particular object to a Datagram
////////////////////////////////////////////////////////////////////
void Generic::
write_datagram(BamWriter *manager, Datagram &me)
{
  GenericParent::write_datagram(manager, me);
}

////////////////////////////////////////////////////////////////////
//     Function: Generic::fillin
//       Access: Protected
//  Description: Function that reads out of the datagram (or asks
//               manager to read) all of the data that is needed to
//               re-create this object and stores it in the appropiate
//               place
////////////////////////////////////////////////////////////////////
void Generic::
fillin(DatagramIterator& scan, BamReader* manager)
{
  GenericParent::fillin(scan, manager);
}

////////////////////////////////////////////////////////////////////
//     Function: Generic::complete_pointers
//       Access: Public
//  Description: Takes in a vector of pointes to TypedWriteable
//               objects that correspond to all the requests for 
//               pointers that this object made to BamReader.
////////////////////////////////////////////////////////////////////
int Generic::
complete_pointers(vector_typedWriteable &p_list, BamReader *manager)
{
  int start = GenericParent::complete_pointers(p_list, manager);
}

////////////////////////////////////////////////////////////////////
//     Function: Generic::finalize
//       Access: Public
//  Description: Method to ensure that any necessary clean up tasks
//               that have to be performed by this object are performed
////////////////////////////////////////////////////////////////////
void Generic::
finalize()
{
}

////////////////////////////////////////////////////////////////////
//     Function: Generic::make_Generic
//       Access: Protected
//  Description: Factory method to generate a Generic object
////////////////////////////////////////////////////////////////////
TypedWriteable* Generic::
make_Generic(const FactoryParams &params)
{
  Generic *me = new Generic;
  BamReader *manager;
  Datagram packet;

  parse_params(params, manager, packet);
  DatagramIterator scan(packet);

  me->fillin(scan, manager);
  return me;
}

////////////////////////////////////////////////////////////////////
//     Function: Generic::register_with_factory
//       Access: Public, Static
//  Description: Factory method to generate a Generic object
////////////////////////////////////////////////////////////////////
void Generic::
register_with_read_factory()
{
  BamReader::get_factory()->register_factory(get_class_type(), make_Generic);
}
