register_types.h

Go to the documentation of this file.
00001 /***************************************************************************
00002  *   Copyright (C) 2009 by Touati Sid                                      *
00003  *   Sid-nospam.Touati-nospam@univ-cotedazur.fr                                      *
00004  *   Copyright  INRIA and the University of Versailles                     *
00005  *   This program is free software; you can redistribute it and/or modify  *
00006  *   it under the terms of the GNU General Public License as published by  *
00007  *   the Free Software Foundation; either version 2 of the License, or     *
00008  *   (at your option) any later version.                                   *
00009  *                                                                         *
00010  *   This program 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         *
00013  *   GNU General Public License for more details.                          *
00014  *                                                                         *
00015  *   You should have received a copy of the GNU Library General Public     *
00016  *   License along with this program (LGPL); if not, write to the          *
00017  *   Free Software Foundation, Inc.,                                       *
00018  *   59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.             *
00019  *   Exception : this software requires a licence  of the LEDA libary.     *
00020  *   If you are from academia, you can get a free leda binary licence 
00021  *   allowing you to use freely our DDG library.                           *
00022  *   Otherwise, you can buy a LEDA licence from algorithmic-solutions      *
00023  *   http://www.algorithmic-solutions.com                                  *
00024  *   LEDA binaries and source codes are excluded from this LGPL.           *
00025  *   Obtaining a LEDA licence is not mandatory to use our GPL software     *
00026  *   If the user wants, he can  create a free source-compatible replacement*
00027  *   for LEDA, and he is allowed to use our software under LGPL.           *
00028  ***************************************************************************/
00029 
00030 #ifndef __register_types_H
00031 #define __register_types_H
00032 
00039 #endif
00040 #ifndef DDGREGISTER_TYPES_H
00041 #define DDGREGISTER_TYPES_H
00042 
00043 #include <LEDA/core/list.h>
00044 #include <iostream>
00045 
00046 namespace DDG {
00047 
00051 class REGISTER_TYPES{
00052 private:
00053     int nb_registers;
00054     int register_type_id;
00055     LEDA::list<std::string> list_registers;
00056     std::string register_typename;
00057 public:
00058         REGISTER_TYPES();
00059     REGISTER_TYPES(int nbreg);
00060     REGISTER_TYPES(std::string regtypename);
00061     REGISTER_TYPES(std::string regtypename, int nbreg);
00062         ~REGISTER_TYPES();
00063     
00064     void set_nb_registers ( int theValue )
00065     {
00066         nb_registers = theValue;
00067     }
00068     
00069 
00070     int get_nb_registers() const
00071     {
00072         return nb_registers;
00073     }
00074     
00075   LEDA::list<std::string> get_list_registers(){
00076     return list_registers;
00077   }
00078     
00079     void set_register_typename( std::string theValue )
00080     {
00081         register_typename = theValue;
00082     }
00083     
00084 
00085     std::string get_register_typename() const
00086     {
00087         return register_typename;
00088     }
00089     const char * get_str_register_typename() const{  return (register_typename.c_str());}
00090     void clear() ;
00091     bool check() const;
00092     void remove_register_name(std::string reg_name);
00093 
00094    
00095     void add_register_name(std::string reg_name);
00096 
00097     void set_register_type_id ( int theValue )
00098     {
00099         register_type_id = theValue;
00100     }
00101     
00102 
00103     int get_register_type_id() const
00104     {
00105         return register_type_id;
00106     }
00107     
00108         friend std::ostream& operator<<(std::ostream &os,  REGISTER_TYPES x);
00109     friend std::istream& operator>>(std::istream &is, REGISTER_TYPES & x);  
00110 
00111 };
00112 bool operator==(const REGISTER_TYPES t1, const REGISTER_TYPES t2);
00113 }
00114 
00115 #endif

January 2009, by Sid Touati (Copyright INRIA and University of Versailles)