contrib/brl/bbas/bgrl/bgrl_edge.cxx
Go to the documentation of this file.
00001 // This is brl/bbas/bgrl/bgrl_edge.cxx
00002 #include "bgrl_edge.h"
00003 //:
00004 // \file
00005 
00006 #include <vsl/vsl_binary_loader.h>
00007 
00008 
00009 //: Return a platform independent string identifying the class
00010 vcl_string 
00011 bgrl_edge::is_a() const 
00012 { 
00013   return "bgrl_edge"; 
00014 }
00015 
00016 
00017 //: Create a copy of the object on the heap.
00018 // The caller is responsible for deletion
00019 bgrl_edge* 
00020 bgrl_edge::clone() const
00021 {
00022   return new bgrl_edge(*this);
00023 }
00024 
00025 
00026 //: Binary save bgrl_edge to stream.
00027 void
00028 bgrl_edge::b_write( vsl_b_ostream& ) const
00029 {
00030   // Nothing to write
00031   // The smart pointer to the edge is written because the smart
00032   // pointer serialization is needed to serialize the graph
00033 }
00034 
00035 
00036 //: Binary load bgrl_edge from stream.
00037 void
00038 bgrl_edge::b_read( vsl_b_istream& )
00039 {
00040   // Nothing to read
00041   // The smart pointer to the edge is read because the smart
00042   // pointer serialization is needed to serialize the graph
00043 }
00044 
00045 
00046 //: Print an ascii summary to the stream
00047 void
00048 bgrl_edge::print_summary( vcl_ostream& os ) const
00049 {
00050   os << "2 vertices";
00051 }
00052 
00053 
00054 //-----------------------------------------------------------------------------------------
00055 // External functions
00056 //-----------------------------------------------------------------------------------------
00057 
00058 
00059 
00060 //: Allows derived class to be loaded by base-class pointer.
00061 //  A loader object exists which is invoked by calls
00062 //  of the form "vsl_b_read(os,base_ptr);".  This loads derived class
00063 //  objects from the stream, places them on the heap and
00064 //  returns a base class pointer.
00065 //  In order to work the loader object requires
00066 //  an instance of each derived class that might be
00067 //  found.  This function gives the model class to
00068 //  the appropriate loader.
00069 void vsl_add_to_binary_loader(const bgrl_edge& e)
00070 {
00071   vsl_binary_loader<bgrl_edge>::instance().add(e);
00072 }
00073 
00074 
00075 //: Print an ASCII summary of a bgrl_edge to the stream
00076 void
00077 vsl_print_summary(vcl_ostream &os, const bgrl_edge* e)
00078 {
00079   os << "bgrl_edge{ ";
00080   e->print_summary(os);
00081   os << " }";
00082 }
00083