Main Page   Namespace List   Class Hierarchy   Compound List   File List   Namespace Members   Compound Members   Related Pages  

Node.hh

Go to the documentation of this file.
00001 /*
00002     libpdf++: a C++ Free library to generate PDF file
00003     Copyright (C) 2002 Nestal Wan
00004 
00005     This library is free software; you can redistribute it and/or
00006     modify it under the terms of the GNU Lesser General Public
00007     License as published by the Free Software Foundation; either
00008     version 2.1 of the License, or (at your option) any later version.
00009 
00010     This library is distributed in the hope that it will be useful,
00011     but WITHOUT ANY WARRANTY; without even the implied warranty of
00012     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00013     Lesser General Public License for more details.
00014 
00015     You should have received a copy of the GNU Lesser General Public
00016     License along with this library; if not, write to the Free Software
00017     Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
00018 */
00026 #ifndef __PDF_GRAPH_NODE_HEADER_INCLUDED__
00027 #define __PDF_GRAPH_NODE_HEADER_INCLUDED__
00028 
00029 #include <iosfwd>
00030 #include <string>
00031 #include <vector>
00032 
00033 namespace pdf { namespace graph {
00034 
00042 class CNode
00043 {
00044 public :
00045     virtual ~CNode( ) ;
00046     virtual std::ostream& Print( std::ostream& os ) const = 0 ;
00047 } ;
00048 
00056 class CNode2 : public CNode
00057 {
00058 private :
00060 
00061     double      m_x, m_y ;
00063     
00065     std::string m_op_code ;
00066 
00067 public :
00068     CNode2( double x, double y, const std::string& op_code ) ;
00069     ~CNode2( ) ;
00070     
00071     std::ostream& Print( std::ostream& os ) const ;
00072 
00073 private :
00074 #ifdef _DEBUG
00075     bool IsValid( ) const ;
00076 #endif
00077 } ;
00078 
00083 class CNodes : public CNode
00084 {
00085 private :
00086     std::vector<double> m_values ;       
00087     std::string m_op_code ;              
00088 
00089 public :
00090     template <typename InputIt>
00091     CNodes( InputIt first, InputIt last, const std::string& op_code )
00092         : m_values( first, last ), m_op_code( op_code )
00093     {
00094     }
00095     
00096     ~CNodes( ) ;
00097     
00098     std::ostream& Print( std::ostream& os ) const ;
00099 
00100 private :
00101 #ifdef _DEBUG
00102     bool IsValid( ) const ;
00103 #endif
00104 } ;
00105 
00112 class COperator : public CNode
00113 {
00114 private :
00116     std::string m_operator ;
00117 
00118 public :
00119     COperator( const std::string& op ) ;
00120     ~COperator( ) ;
00121     
00122     std::ostream& Print( std::ostream& os ) const ;
00123 
00124 private :
00125 #ifdef _DEBUG
00126     bool IsValid( ) const ;
00127 #endif
00128 } ;
00129 
00130 inline std::ostream& operator<<( std::ostream& os, const CNode& node )
00131 {
00132     return node.Print( os ) ;
00133 }
00134 
00135 } } // end of namespace
00136 
00137 #endif

Generated on Sun Feb 2 09:16:05 2003 for libpdf++ by doxygen1.2.16