~ubuntu-branches/ubuntu/utopic/tcm/utopic

« back to all changes in this revision

Viewing changes to src/sd/bv/adsclockconstraint.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 "adsclockconstraint.h"
 
22
#include "adsclock.h"
 
23
#include "stdio.h"
 
24
#include "outputfile.h"
 
25
#include "node.h"
 
26
#include "error.h"
 
27
 
 
28
ClockConstraint::ClockConstraint(Clock *c, PropType p,int n): Prop("",p){
 
29
  limit=n;
 
30
  SetVar(c);
 
31
}
 
32
 
 
33
ClockConstraint::ClockConstraint(){}
 
34
 
 
35
 
 
36
ClockConstraint::~ClockConstraint(){
 
37
}
 
38
 
 
39
bool ClockConstraint::operator==(const ClockConstraint &comp) const {
 
40
  if ((Prop::GetVar()==comp.Prop::GetVar()) &&(Prop::GetType()==comp.Prop::GetType()) && (comp.limit==limit)) return True; else return False;
 
41
}
 
42
 
 
43
 
 
44
ClockConstraint::ClockConstraint(const ClockConstraint &copy): Prop(copy){
 
45
  limit=copy.limit;
 
46
}  
 
47
 
 
48
Clock *ClockConstraint::GetClock(){
 
49
  Clock *ctemp=(Clock*)GetVar();
 
50
  if (ctemp==0) error ("There is clock constraint with a lost clock!\n");
 
51
  return ctemp;
 
52
}       
 
53
 
 
54
void ClockConstraint::Write(OutputFile *o){
 
55
  (*o) << "Clock constraint:\t" << GetId() << "\n" ;
 
56
  if (GetType()==AFTER) (*o) << "AFTER\t";
 
57
  else
 
58
    if (GetType()==WHEN) (*o) << "WHEN\t";
 
59
    else (*o) << "ERROR!\t";
 
60
  (*o) << "\tlimit:\t" << limit << "\n";
 
61
}
 
62
 
 
63
void ClockConstraint::Write(){
 
64
  std::cout << "Clock constraint:";
 
65
  if (GetType()==AFTER) std::cout << "AFTER\t";
 
66
  else
 
67
    if (GetType()==WHEN) std::cout << "WHEN\t";
 
68
    else std::cout << "ERROR!\t";
 
69
  std::cout << "\tlimit:\t" << limit << "\n";
 
70
}
 
71
 
 
72
 
 
73
int ClockConstraint::GetLimit(){
 
74
  return limit;
 
75
}