QSapecNG
 All Classes Functions Enumerations Properties
crc_circuit.h
00001 /*
00002     SapecNG - Next Generation Symbolic Analysis Program for Electric Circuit
00003     Copyright (C) 2009, Michele Caini
00004 
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 3 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 General Public License
00016     along with this program.  If not, see <http://www.gnu.org/licenses/>.
00017 */
00018 
00019 
00020 #ifndef CRC_CIRCUIT_H
00021 #define CRC_CIRCUIT_H
00022 
00023 
00024 #include "parser/parser.h"
00025 #include "exception/sapecngexception.h"
00026 
00027 #include <iostream>
00028 
00029 
00030 namespace sapecng
00031 {
00032 
00033 
00034 class crc_builder: public abstract_builder
00035 {
00036 
00037 public:
00038   crc_builder(
00039       std::ostream& stream
00040     ): stream_(stream), out_(0) { }
00041 
00042   void add_circuit_properties(std::map<std::string,std::string> map) { }
00043   void add_circuit_property(std::string name, std::string value) { }
00044 
00045   void add_wire_component(
00046       std::map<std::string,std::string> props =
00047         std::map<std::string,std::string>()
00048     ) { }
00049 
00050   void add_out_component(
00051       unsigned int v,
00052       std::map<std::string,std::string> props =
00053         std::map<std::string,std::string>()
00054     );
00055 
00056   void add_dual_component(
00057       abstract_builder::dual_component_type c_type,
00058       std::string name,
00059       double value,
00060       bool symbolic,
00061       unsigned int va,
00062       unsigned int vb,
00063       std::map<std::string,std::string> props =
00064         std::map<std::string,std::string>()
00065     );
00066 
00067   void add_quad_component(
00068       abstract_builder::quad_component_type c_type,
00069       std::string name,
00070       double value,
00071       bool symbolic,
00072       unsigned int va,
00073       unsigned int vb,
00074       unsigned int vac,
00075       unsigned int vbc,
00076       std::map<std::string,std::string> props =
00077         std::map<std::string,std::string>()
00078     );
00079 
00080   void add_unknow_component(
00081       std::map<std::string,std::string> props =
00082         std::map<std::string,std::string>()
00083     ) { }
00084 
00085   void begin_userdef_component(
00086       std::string name,
00087       std::map<std::string,std::string> props =
00088         std::map<std::string,std::string>()
00089     ) { }
00090 
00091   void end_userdef_component(
00092       std::string name,
00093       std::map<std::string,std::string> props =
00094         std::map<std::string,std::string>()
00095     ) { }
00096 
00097   void flush();
00098 
00099 private:
00100   void add_item(
00101       std::string name,
00102       double value,
00103       bool symbolic,
00104       std::vector<unsigned int> nodes
00105     );
00106 
00107 private:
00108   std::ostream& stream_;
00109   unsigned int out_;
00110 
00111 };
00112 
00113 
00114 
00115 }
00116 
00117 
00118 #endif // CRC_CIRCUIT_H
 All Classes Functions Enumerations Properties