contrib/rpl/rgrl/rgrl_trans_reader.h
Go to the documentation of this file.
00001 #ifndef rgrl_trans_reader_h_
00002 #define rgrl_trans_reader_h_
00003 
00004 //:
00005 // \file
00006 // \author Gehua Yang, Chia-ling Tsai, Brad King
00007 // Smart reader to read in any transformation class
00008 // \date Nov 2004
00009 // \verbatim
00010 // Modifications
00011 //   Dec. 2006 - Gehua Yang - move the function into a class and make it a static function. 
00012 //                            This is to allow user to add other local-defined transformations types.
00013 // \endverbatim
00014 
00015 #include <rgrl/rgrl_transformation_sptr.h>
00016 #include <vcl_iosfwd.h>
00017 #include <vcl_vector.h>
00018 
00019 //: Reader class for smartly detecting various transformation classes
00020 //  Users can also add user-defined classes, which takes priority before others
00021 class rgrl_trans_reader{
00022 
00023 public:
00024   //: Read a transformation from input stream
00025   //  IMPORTANCE:
00026   //   - Open transformation file in BINARY mode!
00027   //   - Stream Pos does not work in Windows when a UNIX ascii file is opened in text mode.
00028   //
00029   //  The type of transformation depends on the content of the input stream.
00030   //  NULL smart ptr is returned if reading operation fails.
00031   //  Please check the validity of the returned smart ptr.
00032   static
00033   rgrl_transformation_sptr read( vcl_istream& is );
00034 
00035   //: Read a transformation from input file for convenience
00036   //
00037   static
00038   rgrl_transformation_sptr read( char const* fn );
00039 
00040   //: add a transformation candidate
00041   static
00042   void add_xform( rgrl_transformation_sptr );
00043 
00044 protected:
00045   static vcl_vector< rgrl_transformation_sptr >   xform_candidates_;
00046 };
00047 
00048 //: stream input operator for reading a transformation
00049 vcl_istream& operator>>( vcl_istream& is, rgrl_transformation_sptr& sptr );
00050 
00051 #endif // rgrl_trans_reader_h_