printable_object.hpp
Go to the documentation of this file.
00001 /*
00002  *    This file is part of CasADi.
00003  *
00004  *    CasADi -- A symbolic framework for dynamic optimization.
00005  *    Copyright (C) 2010 by Joel Andersson, Moritz Diehl, K.U.Leuven. All rights reserved.
00006  *
00007  *    CasADi is free software; you can redistribute it and/or
00008  *    modify it under the terms of the GNU Lesser General Public
00009  *    License as published by the Free Software Foundation; either
00010  *    version 3 of the License, or (at your option) any later version.
00011  *
00012  *    CasADi is distributed in the hope that it will be useful,
00013  *    but WITHOUT ANY WARRANTY; without even the implied warranty of
00014  *    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00015  *    Lesser General Public License for more details.
00016  *
00017  *    You should have received a copy of the GNU Lesser General Public
00018  *    License along with CasADi; if not, write to the Free Software
00019  *    Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
00020  *
00021  */
00022 
00023 #ifndef PRINTABLE_OBJECT_HPP
00024 #define PRINTABLE_OBJECT_HPP
00025 
00026 #include <iostream>
00027 #include <string>
00028 #include <sstream>
00029 #include <streambuf>
00030 #include <vector>
00031 
00032 namespace CasADi{
00033 
00038 class PrintableObject{
00039   public:
00040     
00041 #ifndef SWIG
00042 
00043     virtual void print(std::ostream &stream=std::cout) const;
00044 
00046     virtual void repr(std::ostream &stream=std::cout) const;
00047 
00049     friend std::ostream& operator<<(std::ostream &stream, const PrintableObject& obj);
00050 #endif // SWIG  
00051 
00053     std::string getRepresentation() const;
00054 
00056     std::string getDescription() const;
00057   
00058 };
00059 
00060 #ifdef SWIG
00061 %extend PrintableObject{
00062   std::string __str__()  { return $self->getDescription(); }
00063   std::string __repr__()  { return $self->getRepresentation(); }
00064 }
00065 #endif // SWIG    
00066 
00067 } // namespace CasADi
00068 
00069 
00070 #endif // PRINTABLE_OBJECT_HPP
00071 


acado
Author(s): Milan Vukov, Rien Quirynen
autogenerated on Thu Aug 27 2015 11:59:49