~ubuntu-branches/ubuntu/intrepid/tcm/intrepid

« back to all changes in this revision

Viewing changes to src/sd/bv/adsproperty.c

  • Committer: Bazaar Package Importer
  • Author(s): Otavio Salvador
  • Date: 2003-07-03 20:08:21 UTC
  • Revision ID: james.westby@ubuntu.com-20030703200821-se4xtqx25e5miczi
Tags: upstream-2.20
ImportĀ upstreamĀ versionĀ 2.20

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
//////////////////////////////////////////////////////////////////////////////////
 
2
// This file is part of Toolkit for Conceptual Modeling (TCM).
 
3
// (c) copyright 2001, Universiteit Twente.
 
4
// Author: Rik Eshuis (eshuis@cs.utwente.nl).
 
5
//
 
6
// TCM is free software; you can redistribute it and/or modify
 
7
// it under the terms of the GNU General Public License as published by
 
8
// the Free Software Foundation; either version 2 of the License, or
 
9
// (at your option) any later version.
 
10
//
 
11
// TCM is distributed in the hope that it will be useful,
 
12
// but WITHOUT ANY WARRANTY; without even the implied warranty of
 
13
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
14
// GNU General Public License for more details.
 
15
//
 
16
// You should have received a copy of the GNU General Public License
 
17
// along with TCM; if not, write to the Free Software
 
18
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
 
19
// 02111-1307, USA.
 
20
////////////////////////////////////////////////////////////////////////////////
 
21
#include "adsproperty.h"
 
22
#include "adsvariable.h"
 
23
#include "outputfile.h"
 
24
 
 
25
 
 
26
Prop::Prop(const char *str,PropType p){
 
27
  s=str;
 
28
  stype=p;
 
29
  v=0;
 
30
}
 
31
 
 
32
        
 
33
Prop::Prop(const Prop &copy){
 
34
  s=copy.s;
 
35
  stype =copy.stype;
 
36
}
 
37
 
 
38
 
 
39
 
 
40
Prop::~Prop(){}
 
41
 
 
42
 
 
43
int Prop::GetId(){
 
44
  return s.length();
 
45
}
 
46
 
 
47
 
 
48
bool Prop::operator==(const Prop &comp) const{
 
49
  if (comp.s==s) return True; else return False;
 
50
}
 
51
 
 
52
 
 
53
 
 
54
string  Prop::GetName(void){
 
55
  return s;
 
56
}
 
57
 
 
58
PropType Prop::GetType(void) const{
 
59
        return stype;
 
60
}
 
61
 
 
62
void Prop::SetType(PropType p){
 
63
  stype=p;
 
64
}
 
65
 
 
66
 
 
67
void Prop::SetVar(ADSVar *var){
 
68
  v=var;
 
69
}
 
70
 
 
71
ADSVar *Prop::GetVar(void) const {
 
72
  return v;
 
73
}
 
74
 
 
75
bool Prop::isInternal(){
 
76
  return ((stype==::INTERNAL_PROP)||(stype==::INTERNAL_INT)||(stype==::INTERNAL_STRING)||(stype==::SENDEVENT));
 
77
}
 
78
 
 
79
 
 
80
void Prop::Write(OutputFile *ofile){
 
81
  string d;
 
82
  switch (stype) {
 
83
  case ::PROP :    d="property" ;break;
 
84
  case ::INT :     d="integer" ;break;
 
85
  case ::STRING :  d="string" ;break;
 
86
  case ::EVENT :   d="event" ;break;
 
87
  case ::SENDEVENT :   d="SENDevent" ;break;
 
88
  case ::INTERNAL_PROP :    d="internal property" ;break;
 
89
  case ::INTERNAL_INT :     d="internal integer" ;break;
 
90
  case ::INTERNAL_STRING :  d="internal string" ;break; 
 
91
  default: d="ERROR";
 
92
  }
 
93
  (* ofile)<< "\t{ Basic proposition : " << s << ": " << d << " }\n";
 
94
  if (v==0){
 
95
   (*ofile) << "NO var referenced\n";
 
96
  }
 
97
  else{
 
98
    (*ofile) << "Var ";
 
99
    v->Write(ofile);
 
100
    (*ofile) << "is referenced \n";
 
101
  }
 
102
}
 
103
 
 
104
 
 
105
void Prop::Write(){
 
106
  string d;
 
107
  switch (stype) {
 
108
  case ::PROP :    d="property" ;break;
 
109
  case ::INT :     d="integer" ;break;
 
110
  case ::STRING :  d="string" ;break;
 
111
  case ::EVENT :   d="event" ;break;
 
112
  case ::SENDEVENT :   d="SENDevent" ;break;
 
113
  case ::INTERNAL_PROP :    d="internal property" ;break;
 
114
  case ::INTERNAL_INT :     d="internal integer" ;break;
 
115
  case ::INTERNAL_STRING :  d="internal string" ;break; 
 
116
  default: d="ERROR";
 
117
  }
 
118
  std::cout<< "\t{ Basic proposition : " << s << ": " << d << " }\n";
 
119
  if (v==0){
 
120
   std::cout << "NO var referenced\n";
 
121
  }
 
122
  else{
 
123
    std::cout << "Var ";
 
124
    v->WriteScreen();
 
125
    std::cout << "is referenced \n";
 
126
  }
 
127
}
 
128