/[ascend]/trunk/ascxx/name.cpp
ViewVC logotype

Contents of /trunk/ascxx/name.cpp

Parent Directory Parent Directory | Revision Log Revision Log


Revision 2327 - (show annotations) (download) (as text)
Wed Dec 22 07:17:24 2010 UTC (13 years, 8 months ago) by jpye
File MIME type: text/x-c++src
File size: 881 byte(s)
Merging in refactor of the C++ code, which is moved out of 'pygtk' and into 'ascxx'.
Adding support for IPOPT 3.9.1, the current latest version.
Support in dtar for parallel builds (possibly needs some testing still).
1 #include <iostream>
2 #include <stdexcept>
3 #include <sstream>
4 using namespace std;
5
6 #include "name.h"
7
8 extern "C"{
9 #include <ascend/general/dstring.h>
10 #include <ascend/general/platform.h>
11
12 #include <ascend/compiler/expr_types.h>
13 #include <ascend/compiler/symtab.h>
14 #include <ascend/compiler/nameio.h>
15 }
16
17 Nam::Nam(){
18 throw runtime_error("Can't create new Nam objects");
19 }
20
21 Nam::Nam(struct Name *name) : name(name){
22 // nothing else
23 }
24
25 Nam::Nam(const SymChar &sym){
26 //cerr << "CREATING NAME from SymChar '" << sym << "'" << endl;
27 name = CreateIdName(sym.getInternalType());
28 }
29
30 Nam::~Nam(){
31 // cerr << "DESTROY NAME" << endl;
32 DestroyName(name);
33 }
34
35 const string
36 Nam::getName() const{
37 /// @TODO Make this more efficient...
38 stringstream ss;
39 char *longname = WriteNameString(name);
40 ss << longname;
41 return ss.str();
42 }
43
44 struct Name *
45 Nam::getInternalType() const{
46 return name;
47 }
48

john.pye@anu.edu.au
ViewVC Help
Powered by ViewVC 1.1.22