1 /* $Id: UserInterface.java 203 2010-10-11 08:59:47Z dchokshi $ */
4 import java.util.ResourceBundle;
7 * Class to store commandline arguments and flags.
9 public class UserInterface {
12 * Get a single instance of the UserInterface object.
14 private final static UserInterface _instance = new UserInterface();
17 // the platform file name
18 private String _platformFileName = null;
20 // the process network file name
21 private String _networkFileName = null;
23 // the mapping file name
24 private String _mappingFileName = null;
26 // the scheduler file name
27 private String _schedulerFileName = null;
29 // the dotty file name
30 private String _dottyFileName = "dotty.dot";
32 // the systemc directory name
33 private String _codeDirectoryName = "nonamePackage";
35 // the pipeandfilter directory name
36 private String _pipeCodeDirectoryName = "nonamePipePackage";
38 // the hds directory name
39 private String _hdsCodeDirectoryName = "nonameHdsPackage";
41 // the RTEMS directory name
42 private String _rtemsCodeDirectoryName = "nonameHdsPackage";
44 // the RTEMS board support package for which code is generated
45 private String _rtemsBSP = "pc386";
47 // the Epiphany directory name
48 private String _epiphanyCodeDirectoryName = "nonameEpiphanyPackage";
50 // the protothread directory name
51 private String _protothreadCodeDirectoryName = "nonameHdsPackage";
53 // the CBE directory name
54 private String _cbeCodeDirectoryName = "nonameCbePackage";
56 // the Yapi directory name
57 private String _yapiCodeDirectoryName = "nonameYapiPackage";
61 private String _traceName = "";
63 // the xml generation flag
64 private boolean _xmlGen = false;
67 private boolean _profiling = false;
70 private boolean _verbose = false;
73 private boolean _vsplog = false;
75 // the name of the vsp log file
76 private String _vspLogFileName = "";
78 // the workload annotation flag
79 private boolean _workload = false;
81 // the name of the workload file produces by Matlab
82 private String _workloadFileName = "";
85 private boolean _systemC = false;
88 private boolean _epiphanyFlag = false;
90 // the PipeAndFilter flag
91 private boolean _pipeAndFilter = false;
94 private boolean _hds = false;
97 private boolean _rtems = false;
100 private boolean _cbe = false;
103 private boolean _yapi = false;
106 private boolean _protothread = false;
109 private boolean _debug = false;
112 private boolean _dotty = false;
115 private boolean _check = false;
117 // the path finder flag
118 private boolean _archiPaths = true;
121 private String _basePath = ".";
124 private String _outputFileName = "";
127 private ResourceBundle _rb;
128 private String _rbFileName = "dol";
131 public final String getMySystemCLib() {
133 return _rb.getString("DOL_path") + getDelimiter()
134 + "src" + getDelimiter() + "dol" + getDelimiter()
135 + "visitor" + getDelimiter() + "systemC" + getDelimiter()
139 return this.getClass().getResource(
140 "/dol/visitor/systemC/lib").getFile();
143 public final String getVisitorDir(){
144 return this.getClass().getResource("/dol/visitor/").getFile();
147 public final String getDOLPath() { return _rb.getString("DOL_path"); }
148 public final String getSystemCINC(){return _rb.getString("SYSTEMC_INC");}
149 public final String getSystemCLIB(){return _rb.getString("SYSTEMC_LIB");}
152 * returns the singleton instance of this class.
154 * @return The instance value
156 public final static UserInterface getInstance() {
161 * Get the name of the platform file.
163 * @return The platformFileName value
165 public final String getPlatformFileName() {
166 return _platformFileName;
170 * Set the name of the platform file.
172 * @param platformFileName
173 * The new platformFileName value
175 public final void setPlatformFileName(String platformFileName) {
176 _platformFileName = platformFileName;
180 * Get the name of the process network file.
182 * @return The networkFileName value
184 public final String getNetworkFileName() {
185 return _networkFileName;
189 * Set the name of the process network file.
191 * @param networkFileName
192 * The new networkFileName value
194 public final void setNetworkFileName(String networkFileName) {
195 _networkFileName = networkFileName;
199 * Get the name of the mapping file.
201 * @return The mappingFileName value
203 public final String getMappingFileName() {
204 return _mappingFileName;
208 * Set the name of the mapping file.
210 * @param mappingFileName
211 * The new mappingFileName value
213 public final void setMappingFileName(String mappingFileName) {
214 _mappingFileName = mappingFileName;
219 * Get the name of the scheduler file.
221 * @return The schedulerFileName value
223 public final String getSchedulerFileName() {
224 return _schedulerFileName;
228 * Set the name of the scheduler file.
230 * @param schedulerFileName
231 * The new schedulerFileName value
233 public final void setSchedulerFileName(String schedulerFileName) {
234 _schedulerFileName = schedulerFileName;
239 * Get the name of the dotty file..
241 * @return The dottyFileName value
243 public final String getDottyFileName() {
244 return _dottyFileName;
248 * Set the name of the directory where the SystemC code shall be generated.
250 * @param dottyFileName The dotty file name.
252 public final void setDottyFileName(String dottyFileName) {
253 _dottyFileName = dottyFileName;
259 * Get the name of the SystemC directory.
261 * @return The directory name of the SystemC directory
263 public final String getCodeDirectoryName() {
264 return _codeDirectoryName;
268 * Set the name of the directory where the SystemC code shall be generated.
270 * @param codeDirectoryName The code directory
272 public final void setCodeDirectoryName(String codeDirectoryName) {
273 _codeDirectoryName = codeDirectoryName;
277 * Get the name of the Epiphany directory.
279 * @return The directory name of the Epiphany directory
281 public final String getEpiphanyCodeDirectoryName() {
282 return _epiphanyCodeDirectoryName;
286 * Set the name of the Epiphany directory.
288 * @param codeDirectoryName Directory to generate Epiphany code in
290 public final void setEpiphanyCodeDirectoryName(String codeDirectoryName) {
291 _epiphanyCodeDirectoryName = codeDirectoryName;
295 * Get the name of the PipeAndFilter directory.
297 * @return The directory name of the PipeAndFilter directory
299 public final String getPipeAndFilterCodeDirectoryName() {
300 return _pipeCodeDirectoryName;
304 * Set the name of the directory where the Hds code shall be generated.
306 * @param codeDirectoryName The code directory
308 public final void setPipeAndFilterCodeDirectoryName(String codeDirectoryName) {
309 _pipeCodeDirectoryName = codeDirectoryName;
313 * Get the name of the Hds directory.
315 * @return The directory name of the Hds directory
317 public final String getHdsCodeDirectoryName() {
318 return _hdsCodeDirectoryName;
322 * Set the name of the directory where the Hds code shall be generated.
324 * @param codeDirectoryName The code directory
326 public final void setHdsCodeDirectoryName(String codeDirectoryName) {
327 _hdsCodeDirectoryName = codeDirectoryName;
331 * Get the name of the protothread directory.
333 * @return The directory name of the protohread directory
335 public final String getProtothreadCodeDirectoryName() {
336 return _protothreadCodeDirectoryName;
340 * Set the name of the directory where the protothread code shall be generated.
342 * @param codeDirectoryName The code directory
344 public final void setProtothreadCodeDirectoryName(String codeDirectoryName) {
345 _protothreadCodeDirectoryName = codeDirectoryName;
349 * Get the name of the CBE directory.
351 * @return The directory name of the CBE directory
353 public final String getCbeCodeDirectoryName() {
354 return _cbeCodeDirectoryName;
358 * Set the name of the directory where the CBE code shall be generated.
360 * @param codeDirectoryName The code directory
362 public final void setCbeCodeDirectoryName(String codeDirectoryName) {
363 _cbeCodeDirectoryName = codeDirectoryName;
367 * Get the name of the YAPI directory.
369 * @return The directory name of the CBE directory
371 public final String getYapiCodeDirectoryName() {
372 return _yapiCodeDirectoryName;
376 * Set the name of the directory where the YAPI code shall be generated.
378 * @param codeDirectoryName The code directory
380 public final void setYapiCodeDirectoryName(String codeDirectoryName) {
381 _yapiCodeDirectoryName = codeDirectoryName;
385 * Get the name of the RTEMS directory.
387 * @return The directory name of the RTEMS directory
389 public final String getRtemsCodeDirectoryName() {
390 return _rtemsCodeDirectoryName;
394 * Set the name of the directory where the RTEMS code shall be generated.
396 * @param codeDirectoryName The code directory
398 public final void setRtemsCodeDirectoryName(String codeDirectoryName) {
399 _rtemsCodeDirectoryName = codeDirectoryName;
403 * Get the name of the RTEMS board support package.
405 * @return The name of the board support package
407 public final String getRtemsBSP() {
412 * Set the name of the board support package for which RTEMS code shall
415 * @param bsp board support package for which code is generated
416 * currently supported: pc386, mparm
418 public final void setRtemsBSP(String bsp) {
423 * Get the status of the Verbose flag.
425 * @return verbose flag value
427 public final boolean getVerboseFlag() {
432 * Set the Verbose flag.
434 public final void setVerboseFlag() {
439 * Get the status of the Debug flag.
441 * @return debug flag value
443 public final boolean getDebugFlag() {
448 * Set the debug flag.
450 public final void setDebugFlag() {
455 * Get the status of the SystemC flag
457 * @return The systemC flag value
459 public final boolean getSystemCFlag() {
464 * Set the SystemC flag.
466 public final void setSystemCFlag() {
471 * Get the status of the Epiphany flag.
473 * @return Epiphany flag value
475 public final boolean getEpiphanyFlag() {
476 return _epiphanyFlag;
480 * Set the Epiphany flag.
482 public final void setEpiphanyFlag() {
483 _epiphanyFlag = true;
487 * Get the status of the PipeAndFilter flag.
489 * @return PipeAndFilter flag value
491 public final boolean getPipeAndFilterFlag() {
492 return _pipeAndFilter;
496 * Set the PipeAndFilter flag.
498 public final void setPipeAndFilterFlag() {
499 _pipeAndFilter = true;
503 * Get the status of the protothread flag.
505 * @return PipeAndFilter flag value
507 public final boolean getProtothreadFlag() {
512 * Set the protothread flag.
514 public final void setProtothreadFlag() {
519 * Get the status of the HdS flag.
521 * @return The HdS flag value
523 public final boolean getHdsFlag() {
530 public final void setHdsFlag() {
535 * Get the status of the RTEMS flag.
537 * @return The HdS flag value
539 public final boolean getRtemsFlag() {
544 * Set the RTEMS flag.
546 public final void setRtemsFlag() {
551 * Get the status of the CBE flag.
553 * @return The CBE flag value
555 public final boolean getCbeFlag() {
562 public final void setCbeFlag() {
569 public final void setYapiFlag() {
574 * Get the status of the YAPI flag.
576 * @return The YAPI flag value
578 public final boolean getYapiFlag() {
583 * Get the status of the dotty flag
585 * @return The dotty Flag value
587 public final boolean getDottyFlag() {
592 * Sets the dotty flag
594 public final void setDottyFlag() {
599 * Get the status of the profiling flag
601 * @return The profiling Flag value
603 public final boolean getProfilingFlag() {
608 * Sets the profiling flag
610 public final void setProfilingFlag() {
615 * Get the status of the vsp log flag.
617 * @return The vsp log value
619 public final boolean getVspLogFlag() {
624 * Sets the vsp log flag.
626 public final void setVspLogFlag() {
631 * Get the status of the workload annotation flag.
633 * @return workload flag
635 public final boolean getWorkloadFlag() {
640 * Sets the workload flag.
642 public final void setWorkloadFlag() {
647 * Get the status of the xml generation flag
649 * @return The xmlGen Flag value
651 public final boolean getXmlGenFlag() {
656 * Sets the xml generation flag
658 public final void setXmlGenFlag() {
663 * Get the status of the check flag
665 * @return The check Flag value
667 public final boolean getCheckFlag() {
672 * Sets the check flag
674 public final void setCheckFlag() {
679 * Get the status of the path finder flag
681 * @return The path finder Flag value
683 public final boolean getPathsFlag() {
688 * Sets the check flag
690 public final void setPathsFlag() {
695 * Print a message to screen if the verbose flag has been selected with an
698 * @param s description that needs to printed.
700 public void printVerbose(String s) {
701 if ( getVerboseFlag() ) {
707 * Print a message to screen if the verbose flag has been selected.
709 * @param s description that needs to printed.
711 public void printlnVerbose(String s) {
712 if( getVerboseFlag() ) {
713 System.out.println(s);
719 * get the name of the output file name.
721 * @return The outputFileName value
723 public final String getOutputFileName() {
724 return _outputFileName;
728 * set the name of the input file name.
730 * @param filename The new outputFileName value
732 public final void setOutputFileName(String filename) {
733 _outputFileName = filename;
737 * get the base path name.
739 * @return The basePath value
741 public final String getBasePath() { return _basePath; }
744 * sets the base path name.
747 * The new basePath value
749 public final void setBasePath(String name) { _basePath = name; }
752 * get the trace filename.
754 * @return The name value of trace file
756 public final String getTraceName() { return _traceName; }
759 * sets the trace Filename.
761 * @param name trace filename
763 public final void setTraceName(String name) {
769 * Get the vsp log filename.
771 * @return name of the vsp log file
773 public final String getVspLogFileName() {
774 return _vspLogFileName;
778 * Set the vsp log filename.
780 * @param name vsp log filename
782 public final void setVspLogFileName(String name) {
783 _vspLogFileName = name;
787 * Get the workload filename.
789 * @return name workload filename
791 public final String getWorkloadFileName() {
792 return _workloadFileName;
796 * Sets the workload filename.
798 * @param name workload filename
800 public final void setWorkloadFileName(String name) {
801 _workloadFileName = name;
805 * Constructor. Private since only a single version may exist.
807 private UserInterface() {
808 _rb = ResourceBundle.getBundle(_rbFileName);