Merge branch 'master' into verilog-ams
[sverilog.git] / discipline.h
blob30932d49d6228ac3a21140dd37fcef4878fadebf
1 #ifndef __discipline_H
2 #define __discipline_H
3 /*
4 * Copyright (c) 2008 Stephen Williams (steve@icarus.com)
6 * This source code is free software; you can redistribute it
7 * and/or modify it in source code form under the terms of the GNU
8 * General Public License as published by the Free Software
9 * Foundation; either version 2 of the License, or (at your option)
10 * any later version.
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
17 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, write to the Free Software
19 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
23 * The discipline types include the discipline, nature and other
24 * related types for managing declared and used disciplines in a
25 * Verilog-AMS program.
28 # include "StringHeap.h"
29 # include <iostream>
30 # include <map>
31 # include "LineInfo.h"
33 typedef enum { DD_NONE, DD_DISCRETE, DD_CONTINUOUS } ddomain_t;
34 extern std::ostream& operator << (std::ostream&, ddomain_t);
36 class nature_t : public LineInfo {
37 public:
38 explicit nature_t(perm_string name, perm_string access);
39 ~nature_t();
41 perm_string name() const { return name_; }
42 // Identifier for the access function for this nature
43 perm_string access() const { return access_; }
45 private:
46 perm_string name_;
47 perm_string access_;
50 class discipline_t : public LineInfo {
51 public:
52 explicit discipline_t (perm_string name, ddomain_t dom,
53 nature_t*pot, nature_t*flow);
54 ~discipline_t();
56 perm_string name() const { return name_; }
57 ddomain_t domain() const { return domain_; }
58 const nature_t*potential() const { return potential_; }
59 const nature_t*flow() const { return flow_; }
61 private:
62 perm_string name_;
63 ddomain_t domain_;
64 nature_t*potential_;
65 nature_t*flow_;
67 private: // not implemented
68 discipline_t(const discipline_t&);
69 discipline_t& operator = (const discipline_t&);
72 extern map<perm_string,nature_t*> natures;
73 extern map<perm_string,discipline_t*> disciplines;
75 #endif