Please review any and all PUBLIC repositories, groups and associate files. These allow anyone on the Internet to access without authentication. Repository and group owners are responsible for their content and permission settings. Go to your project(s), click on Settings > General and expand the "Visibility, project features, permissions" to change this setting.

...
 
Commits (3)
.DS_Store
\ No newline at end of file
.DS_Store
build/
output/
\ No newline at end of file
//
// Interval.h
// for interval attributes
// Created by Mikhail Auguston on 5/24/18.
//
// last modified 01/02/2019
//=========================================
#include <iostream>
using namespace std;
float max(float a, float b){
return (a>=b)?a:b;
}
class Interval {
public:
float smallest, largest;
// constructors
Interval(){
smallest= largest= 0.0;
}
Interval(float s){
smallest= largest= s;
}
Interval(float s, float g){
smallest= (s <= g)?s:g;
largest= (s >= g)?s:g;
}
//-------------
float len(){
return (largest - smallest);
}
bool operator==(Interval &a){
return smallest == a.smallest && largest == a.largest;
}
bool operator!=(Interval &a){
return smallest != a.smallest || largest != a.largest;
}
bool operator>(Interval &a){
return smallest > a.largest;
}
bool operator>=(Interval &a){
return smallest >= a.largest;
}
bool operator<(Interval &a){
return largest < a.smallest;
}
bool operator<=(Interval &a){
return largest <= a.smallest;
}
Interval operator+(Interval &a){
Interval t;
t.smallest = smallest + a.smallest;
t.largest = largest + a.largest;
return t;
}
Interval operator-(Interval &a){
Interval t;
t.smallest = smallest - a.largest;
t.largest = largest - a.smallest;
return t;
}
Interval operator*(Interval &a){
Interval t;
t.smallest = smallest * a.smallest;
t.largest = largest * a.largest;
return t;
}
Interval operator/(Interval &a){
Interval t;
t.smallest = smallest / a.largest;
t.largest = largest / a.smallest;
return t;
}
// compound assignment operations
//-------------------------------
Interval &operator+=(const Interval &a){
smallest += a.smallest;
largest += a.largest;
return *this;
}
Interval &operator-=(const Interval &a){
smallest -= a.smallest;
largest -= a.largest;
return *this;
}
Interval &operator*=(const Interval &a){
smallest *= a.smallest;
largest *= a.largest;
return *this;
}
Interval &operator/=(const Interval &a){
smallest /= a.smallest;
largest /= a.largest;
return *this;
}
// for Interval and number mix
// Interval op float
bool operator==(float a){
return smallest == a && largest == a;
}
bool operator!=(float a){
return smallest != a || largest != a;
}
bool operator>(float a){
return smallest > a;
}
bool operator>=(float a){
return smallest >= a;
}
bool operator<(float a){
return largest < a;
}
bool operator<=(float a){
return largest <= a;
}
Interval &operator=(const float a){
smallest = a;
largest = a;
return *this;
}
Interval operator+(float a){
Interval t;
t.smallest = smallest + a;
t.largest = largest + a;
return t;
}
Interval operator-(float a){
Interval t;
t.smallest = smallest - a;
t.largest = largest - a;
return t;
}
Interval operator*(float a){
Interval t;
t.smallest = smallest * a;
t.largest = largest * a;
return t;
}
Interval operator/(float a){
Interval t;
t.smallest = smallest / a;
t.largest = largest / a;
return t;
}
Interval &operator+=(const float a){
smallest += a;
largest += a;
return *this;
}
Interval &operator-=(const float a){
smallest -= a;
largest -= a;
return *this;
}
Interval &operator*=(const float a){
smallest *= a;
largest *= a;
return *this;
}
Interval &operator/=(const float a){
smallest /= a;
largest /= a;
return *this;
}
}; // end class Interval
// independent functions on intervals
//-----------------------------------
// float op Interval
inline Interval operator+(float x, Interval y){
Interval temp(x + y.smallest, x + y.largest);
return temp;
}
inline Interval operator-(float x, Interval y){
Interval temp( x - y.largest, x - y.smallest);
return temp;
}
inline Interval operator*(float x, Interval y){
Interval temp(x * y.smallest, x * y.largest);
return temp;
}
inline Interval operator/(float x, Interval y){
Interval temp(x / y.largest, x / y.smallest);
return temp;
}
inline bool operator==(float x, Interval y){
return ( x == y.smallest && x == y.largest);
}
inline bool operator!=(float x, Interval y){
return ( x != y.smallest || x != y.largest);
}
inline bool operator>(float x, Interval y){
return ( x > y.largest);
}
inline bool operator<(float x, Interval y){
return ( x < y.smallest);
}
inline bool operator>=(float x, Interval y){
return ( x >= y.largest);
}
inline bool operator<=(float x, Interval y){
return ( x <= y.smallest);
}
// overloaded << operator
std::ostream &operator<<(std::ostream &stream, Interval a){
stream<<'['<< a.smallest << ".." << a.largest<< ']';
return stream;
}
// global_objects.h
//
// Created by Mikhail Auguston on 2/8/19.
//
//***** VIEW object infrastructure for trace list ******
using namespace std;
//-------------------------------------------------
class report_object{
public:
string title;
vector<string> report_contents;
// constructor
report_object(){ title = " "; }
void clean(){
report_contents.clear();
}
//--- print json for Report objects
void print_report_json(){
JSON<< endl<< "{\"REPORT\":["<< "\""<< title<< "\"";
vector<string>::iterator p;
for(p = report_contents.begin(); p != report_contents.end(); p++){
JSON<<",\"" << *p<< "\"";
}
JSON<<"]}"<< endl;
}
};
//--------------------------------------------------
class graph_object{
public:
string title;
// unique_node_id -> node_label
vector<string> nodes;
// from_node_id -> <to_node_id, arrow_label>
// no repetitions of <to_node_id, arrow_label> for same from_node_id
multimap<int, pair<int, string> > arrows; // edges with arrowheads
multimap<int, pair<int, string> > lines; // edges without arrowheads
//=============================================
// constructor
graph_object(){ title = " "; }
void clean(){
nodes.clear();
arrows.clear();
lines.clear();
}
// NEW NODE()
int create_new_node(string label){
nodes.push_back(label);
return nodes.size() - 1;
}
// find the last appearance of a node with a given label
int find_node(string label){
int result = -1;
for(int i = 0; i < nodes.size(); i++){
if(nodes[i] == label) result = i;
}
return result;
}
// LAST NODE()
int find_or_create_new_node(string label){
int x = find_node(label);
if(x >= 0) return x;
else return create_new_node(label);
}
void add_arrow(int n1, int n2, string arrow_label){
// if n1 or n2 does not exist - do nothing
if(n1 < 0 || n2 < 0 || n1 >= nodes.size() || n2 >= nodes.size()) return;
multimap<int, pair<int, string> >:: iterator p;
pair<int, string> p3;
for(p = arrows.begin(); p != arrows.end(); p++){
p3 = p->second;
// if arrow with that label already exists - do nothing
if(p->first == n1 && p3.first == n2 && p3.second == arrow_label) return;
}
// arrow n1 -> n2, arrow_label has not been found
arrows.insert(pair<int, pair<int, string> >(n1, pair<int, string>(n2, arrow_label)));
}
void add_line(int n1, int n2, string arrow_label){
// if n1 or n2 does not exist - do nothing
if(n1 < 0 || n2 < 0 || n1 >= nodes.size() || n2 >= nodes.size()) return;
// ensure that n1 <= n2
int temp = n1;
if(n1 > n2) {
n1 = n2;
n2 = temp;
};
multimap<int, pair<int, string> >:: iterator p;
pair<int, string> p3;
for(p = lines.begin(); p != lines.end(); p++){
p3 = p->second;
// if line with that label already exists - do nothing
if(p->first == n1 && p3.first == n2 && p3.second == arrow_label) return;
}
// line n1 -> n2, arrow_label has not been found
lines.insert(pair<int, pair<int, string> >(n1, pair<int, string>(n2, arrow_label)));
}
//--- print json for Graph objects
void print_graph_json(){
JSON<< endl<< "{\"GRAPH\":["<< "\""<< title<< "\",";
char comma = ' ';
// print node list
JSON<< "\n [";
for(int i = 0; i < nodes.size(); i++){
JSON<< comma<< "["<< i <<", \""<< nodes[i] <<"\"] ";
comma = ',';
}
JSON<< "],";
// print arrow list
comma = ' ';
JSON<< "\n [";
multimap<int, pair<int, string> >::iterator p2;
for(p2 = arrows.begin(); p2 != arrows.end(); p2++){
JSON<< comma<< "["<< p2->first << ','<<(p2->second).first << ",\""<<
(p2->second).second << "\"]";
comma = ',';
}
JSON<< "],";
// print line list
comma = ' ';
JSON<< "\n [";
for(p2 = lines.begin(); p2 != lines.end(); p2++){
JSON<< comma<< "["<< p2->first << ','<<(p2->second).first << ",\""<<
(p2->second).second << "\"]";
comma = ',';
}
JSON<< "] ]}";
}
};// end graph_object class
//====================================================================
template <class tuple_class> class table_object {
public:
string title;
vector <tuple_class> table_contents;
// constructor
table_object(){ title = " "; }
void clean(){
table_contents.clear();
}
//--- print json for Table objects
void print_table_json(){
/*
JSON<< endl<< "{\"REPORT\":["<< "\""<< title<< "\"";
vector<string>::iterator p;
for(p = report_contents.begin(); p != report_contents.end(); p++){
JSON<<",\"" << *p<< "\"";
}
JSON<<"]}"<< endl;
*/
}
}; // end table_object class
This diff is collapsed.
This diff is collapsed.
File mode changed from 100755 to 100644
#!/bin/bash
# $1 - schema name, $2 - scope
if [[ "$1" == "-h" ]] || [[ -z "$*" ]]; then
echo "Usage: `basename $0 $1` [mp_filepath] [scope]"
exit 0
fi
if [ ! -d "build" ]; then
mkdir build
fi
if [ ! -d "output" ]; then
mkdir output
fi
if [ ! -f build/Include.h ]; then
cp Code/includes/* build/
cp Code/*.rig build/
fi
cp $1 build/
cd build
mp_filename=$(basename $1)
mp_basename="${mp_filename%.*}"
rig='../RIGAL/rigsc.446/bin'
$rig/rc MP2-parser
$rig/ic MP2-parser $mp_basename tree $2 > temp.txt
$rig/rc MP2-generator
$rig/ic MP2-generator tree > temp2.txt
rm tree *.rsc
echo "C++ compiler: g++ $mp_basename.cpp -o $mp_basename -fast"
#time /Developer/usr/bin/g++ "$mp_basename.cpp" -o $mp_basename -fast
time g++ "${mp_basename}.cpp" -o $mp_basename -Ofast
echo "$mp_basename run: $mp_basename>$mp_basename.txt"
time ./$mp_basename>"${mp_basename}.txt"
echo "Completed $mp_basename for scope $2"
mv $mp_basename.json ../output/
rm $mp_basename xd RIGCOMP.TMP
# Monterey Phoenix - Trace Generator
## Setup/Requirements
* C++ compiler
## Running Event Generator
The event generator can be run using the rall.sh script in the build folder:
```bash
./Code/rall.sh [mp_filepath] [scope]
```
- mp_filepath should be the location of the MP file that you want to process
- scope is the number of repetitions, use higher values with caution
There are example MP files in the Firebird_Pre_loaded_examples folder. To build those files, run the following command:
```bash
./Code/rall.sh ./Firebird_Pre_loaded_examples/Example01_simple_message_flow.mp 1
```
The output will be saved to Example01_simple_message_flow.json
\ No newline at end of file