All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
function_annotation.h
Go to the documentation of this file.
1 #ifndef FUNCTION_ANNOTATION_H_INCLUDED_
2 #define FUNCTION_ANNOTATION_H_INCLUDED_
3 
4 #include <iostream>
5 #include <string>
6 
8  NO_WAIT = 0,
13 };
14 
15 struct AnnotatedTime {
16 
18  units_(0),
19  magnitude_(0),
20  event_notification_(false),
21  sc_zero_time_(false)
22  { }
23 
27  int units_;
28 
32  long long magnitude_;
33 
38 
43 };
44 
45 bool operator==(const AnnotatedTime &lhs, const AnnotatedTime &rhs);
46 
48 
51 };
52 
54 
56  char *function_name,
57  bool is_conflict_free,
58  WAIT_CONSTRUCT wait_type,
59  AnnotatedTime *annotated_time):
60  function_name_(function_name),
61  is_conflict_free_(is_conflict_free),
62  wait_type_(wait_type),
63  annotated_time_(annotated_time)
64  { }
65 
66 
70  std::string function_name_;
71 
76 
81 
86 
87  friend std::ostream& operator<<(std::ostream& os, const FunctionAnnotation& fa)
88  {
89  os << "Function name: " << fa.function_name_ << std::endl
90  << "Is conflict free: " << fa.is_conflict_free_ << std::endl
91  << "Wait type: ";
92 
93  switch(fa.wait_type_) {
94 
95  case NO_WAIT:
96  os << "NO_WAIT" << std::endl;
97  break;
98  case UNCONDITIONAL_WAIT:
99  os << "UNCONDITIONAL_WAIT" << std::endl;
100  break;
101  case CONDITIONAL_WAIT:
102  os << "CONDITIONAL_WAIT" << std::endl;
103  break;
104  case LOOPED_WAIT:
105  os << "LOOPED_WAIT" << std::endl;
106  break;
107  case WORST_WAIT:
108  os << "WORST_WAIT" << std::endl;
109  break;
110  }
111 
113  os << "Time: event" << std::endl;
114 
115  } else if(fa.annotated_time_->sc_zero_time_) {
116  os << "Time: sc-zero_time" << std::endl;
117 
118  } else {
119  os << "Time: " << fa.annotated_time_->units_ << ", ";
120 
121  switch(fa.annotated_time_->magnitude_) {
122 
123  case 1:
124  os << "SC_FS" << std::endl;
125  break;
126  case 1000:
127  os << "SC_PS" << std::endl;
128  break;
129  case 1000000:
130  os << "SC_NS" << std::endl;
131  break;
132  case 1000000000:
133  os << "SC_US" << std::endl;
134  break;
135  case 1000000000000l:
136  os << "SC_MS" << std::endl;
137  break;
138  case 1000000000000000l:
139  os << "SC_SEC" << std::endl;
140  break;
141  }
142  }
143  return os;
144  }
145 };
146 
147 #endif /* FUNCTION_ANNOTATION_H_INCLUDED_ */
148 
149 /* ex: set softtabstop=2 tabstop=2 shiftwidth=2 expandtab: */
Definition: function_annotation.h:53
Definition: function_annotation.h:10
FunctionAnnotation(char *function_name, bool is_conflict_free, WAIT_CONSTRUCT wait_type, AnnotatedTime *annotated_time)
Definition: function_annotation.h:55
Definition: function_annotation.h:11
bool is_conflict_free_
Whether the function contains no conflict.
Definition: function_annotation.h:75
WAIT_CONSTRUCT wait_type_
Type of waiting inside.
Definition: function_annotation.h:80
bool operator==(const AnnotatedTime &lhs, const AnnotatedTime &rhs)
Definition: function_annotation.cpp:3
WAIT_CONSTRUCT wait_type_
Definition: function_annotation.h:49
WAIT_CONSTRUCT
Definition: function_annotation.h:7
Definition: function_annotation.h:9
std::string function_name_
The function name.
Definition: function_annotation.h:70
Definition: function_annotation.h:47
Definition: function_annotation.h:12
long long magnitude_
The time.
Definition: function_annotation.h:32
AnnotatedTime()
Definition: function_annotation.h:17
Definition: function_annotation.h:8
int units_
The time unit, NS, PS, so on.
Definition: function_annotation.h:27
bool sc_zero_time_
If the segment waits for zero time.
Definition: function_annotation.h:42
friend std::ostream & operator<<(std::ostream &os, const FunctionAnnotation &fa)
Definition: function_annotation.h:87
bool event_notification_
If contains notification.
Definition: function_annotation.h:37
AnnotatedTime * annotated_time_
Definition: function_annotation.h:50
Definition: function_annotation.h:15
AnnotatedTime * annotated_time_
If waiting for time, what the time is.
Definition: function_annotation.h:85