WSF
ScenarioAnalyzerMessage.hpp
Go to the documentation of this file.
1// ****************************************************************************
2// CUI
3//
4// The Advanced Framework for Simulation, Integration, and Modeling (AFSIM)
5//
6// The use, dissemination or disclosure of data in this file is subject to
7// limitation or restriction. See accompanying README and LICENSE for details.
8// ****************************************************************************
9/*******************************************************************************
10*
11* File: ScenarioAnalyzerMessage.hpp
12*
13* Classification: UNCLASSIFIED
14*
15* Details:
16*
17* Contract Number:
18* Contractor Name: Radiance Technologies
19* Address: 350 Wynn Drive
20* Huntsville, AL 35805
21*
22* Abstract:
23*
24*******************************************************************************/
25#ifndef SCENARIOANALYZERMESSAGE_HPP
26#define SCENARIOANALYZERMESSAGE_HPP
27
28#include <iostream>
29#include <vector>
30
31#include "wsf_scenario_analyzer_lib_export.h"
32
34#include "UtScriptAccessible.hpp"
35#include "UtScriptClass.hpp"
36#include "UtScriptClassDefine.hpp"
37
39class WSF_SCENARIO_ANALYZER_LIB_EXPORT ScenarioAnalyzerMessage : public UtScriptAccessible
40{
41 public:
42 static const int cNUM_SEVERITIES;
49
52 ScenarioAnalyzerMessage(const std::string& aSuiteName,
53 const std::string& aCheckName,
54 const std::string& aDetails,
55 SeverityLevel aSeverityLevel,
56 const std::vector<ScenarioFileLocation>& aLocations);
57
58 ScenarioAnalyzerMessage(const std::string& aSuiteName,
59 const std::string& aCheckName,
60 const std::string& aDetails,
61 SeverityLevel aSeverityLevel);
62
63 ScenarioAnalyzerMessage(const std::string& aCategory,
64 const std::string& aDetails);
65
66 void Clear();
67 void ClearDetails();
68
69 static const char* cSCRIPT_CLASS_NAME;
70 const char* GetScriptClassName() const override { return cSCRIPT_CLASS_NAME; }
71
72 bool IsSuccessfulResult() const { return mSuccessful; }
73 std::string GetSuiteName() const { return mSuiteName; }
74 std::string GetCheckName() const { return mCheckName; }
75 std::string GetDetails() const { return mDetails; }
77 const std::vector<ScenarioFileLocation>& GetScenarioFileLocations() const { return mLocations; }
78
79 void SetSuiteName(const std::string& aSuiteName) { mSuiteName = aSuiteName; }
80 void SetCheckName(const std::string& aCheckName) { mCheckName = aCheckName; }
81 void SetDetails(const std::string& aDetails) { mDetails = aDetails; }
82 void AddDetails(const std::string& aDetails) { mDetails += aDetails; }
83 void SetSeverity(SeverityLevel aSeverityLevel) { mSeverity = aSeverityLevel; }
84 void AddScenarioFileLocation(const ScenarioFileLocation& aLocation) { mLocations.push_back(aLocation); }
85
86 void SetSuccessful();
87
88 static std::vector<ScenarioAnalyzerMessage> ParseFromIStream(std::istream& aInputStream);
89
90 static std::string SeverityString(SeverityLevel aSeverityLevel);
91 static SeverityLevel SeverityLevelFromString(std::string aString);
92
93 void Write(std::ostream& aOut = std::cout) const;
94
95 protected:
97 std::string mSuiteName;
98 std::string mCheckName;
99 std::string mDetails;
101 std::vector<ScenarioFileLocation> mLocations;
102};
103
105class ScriptScenarioAnalyzerMessageClass : public UtScriptClass
106{
107 public:
108 ScriptScenarioAnalyzerMessageClass(UtScriptTypes* aTypesPtr);
110
116 UT_DECLARE_SCRIPT_METHOD(GetRelatedFiles);
117};
118
119#endif
Class for Scenario Analyzer messages that provides simple message building and writing.
Definition ScenarioAnalyzerMessage.hpp:40
void SetCheckName(const std::string &aCheckName)
Definition ScenarioAnalyzerMessage.hpp:80
ScenarioAnalyzerMessage()
Construct a default ScenarioAnalyzerMessage as a note.
Definition ScenarioAnalyzerMessage.cpp:47
std::string mDetails
Details of the message.
Definition ScenarioAnalyzerMessage.hpp:99
std::vector< ScenarioFileLocation > mLocations
Location of input blocks related to the message being generated.
Definition ScenarioAnalyzerMessage.hpp:101
const std::vector< ScenarioFileLocation > & GetScenarioFileLocations() const
Definition ScenarioAnalyzerMessage.hpp:77
bool IsSuccessfulResult() const
Definition ScenarioAnalyzerMessage.hpp:72
void AddDetails(const std::string &aDetails)
Definition ScenarioAnalyzerMessage.hpp:82
static const int cNUM_SEVERITIES
The number of severity levels.
Definition ScenarioAnalyzerMessage.hpp:42
void SetDetails(const std::string &aDetails)
Definition ScenarioAnalyzerMessage.hpp:81
std::string GetCheckName() const
Definition ScenarioAnalyzerMessage.hpp:74
std::string GetDetails() const
Definition ScenarioAnalyzerMessage.hpp:75
const char * GetScriptClassName() const override
Definition ScenarioAnalyzerMessage.hpp:70
static const char * cSCRIPT_CLASS_NAME
Definition ScenarioAnalyzerMessage.hpp:69
SeverityLevel
Definition ScenarioAnalyzerMessage.hpp:44
@ cWARNING
Message is a warning (may or may not be problematic).
Definition ScenarioAnalyzerMessage.hpp:46
@ cERROR
Message is a critical error.
Definition ScenarioAnalyzerMessage.hpp:47
@ cNOTE
Message provides information.
Definition ScenarioAnalyzerMessage.hpp:45
SeverityLevel mSeverity
Severity level of the message.
Definition ScenarioAnalyzerMessage.hpp:100
std::string mCheckName
Name of the check.
Definition ScenarioAnalyzerMessage.hpp:98
std::string mSuiteName
Name of the suite.
Definition ScenarioAnalyzerMessage.hpp:97
void SetSuiteName(const std::string &aSuiteName)
Definition ScenarioAnalyzerMessage.hpp:79
void SetSeverity(SeverityLevel aSeverityLevel)
Definition ScenarioAnalyzerMessage.hpp:83
void AddScenarioFileLocation(const ScenarioFileLocation &aLocation)
Definition ScenarioAnalyzerMessage.hpp:84
bool mSuccessful
The message represents a successful result.
Definition ScenarioAnalyzerMessage.hpp:96
SeverityLevel GetSeverity() const
Definition ScenarioAnalyzerMessage.hpp:76
std::string GetSuiteName() const
Definition ScenarioAnalyzerMessage.hpp:73
~ScriptScenarioAnalyzerMessageClass() override=default
UT_DECLARE_SCRIPT_METHOD(GetRelatedFiles)
ScriptScenarioAnalyzerMessageClass(UtScriptTypes *aTypesPtr)
Definition ScenarioAnalyzerMessage.cpp:263
Definition ScenarioFileLocation.hpp:45
Copyrights Multiple, All Rights Reserved