Belle II Software development
TRGCDCFrontEndImplementation.cc
1/**************************************************************************
2 * basf2 (Belle II Analysis Software Framework) *
3 * Author: The Belle II Collaboration *
4 * *
5 * See git log for contributors and copyright holders. *
6 * This file is licensed under LGPL-3.0, see LICENSE.md. *
7 **************************************************************************/
8
9//-----------------------------------------------------------------------------
10// Description : A program to generate VHDL code for the CDC trigger front-end.
11//-----------------------------------------------------------------------------
12
13#define TRG_SHORT_NAMES
14
15#include <iostream>
16#include <fstream>
17#include <string>
18#include "trg/trg/Utilities.h"
19#include "trg/cdc/FrontEnd.h"
20
21using namespace std;
22using namespace Belle2;
23
24#define DEBUG_LEVEL 0
25#define NAME "TRGCDCFrontEndImplementation"
26#define VERSION "version 0.00"
27#define NOT_CONNECTED 99999
28
29int
30main(int argc, const char* argv[])
31{
32
33 cout << NAME << " ... " << VERSION << endl;
34 const string tab = " ";
35
36 //...Check arguments...
37 if (argc < 2) {
38 cout << NAME << " !!! one argument necessary" << endl
39 << tab << " 1 : Version for new config file" << endl;
40 return -1;
41 }
42
43 //...Date...
44 string ts0 = TRGUtil::dateStringF();
45 string ts1 = TRGUtil::dateString();
46
47 //...2nd argument...
48 const string version = argv[1];
49
50 //...1st argument...
51 const string outname = "TRGCDCFrontEndImplementation_" + version + "_"
52 + ts0 + ".vhdl";
53
54 //...Open configuration data...
55 ofstream outfile(outname.c_str(), ios::out);
56 if (outfile.fail()) {
57 cout << NAME << " !!! can not open file" << endl
58 << " " << outname << endl;
59 return -2;
60 }
61
62 //...Inner...
63 outfile << "-- Generated by " << NAME << " " << VERSION << endl;
64 outfile << "-- " << TRGCDCFrontEnd::version() << endl;
65 outfile << "-- " << ts1 << endl;
66 outfile << "--" << endl;
67 TRGCDCFrontEnd::implementation(TRGCDCFrontEnd::innerInside, outfile);
68 outfile.close();
69
70 //...Termination...
71 cout << NAME << " ... terminated" << endl;
72}
static int implementation(const boardType &type, std::ofstream &)
make a VHDL component file.
Definition: FrontEnd.cc:65
static std::string version(void)
returns version.
Definition: FrontEnd.cc:53
Abstract base class for different kinds of events.
STL namespace.