WSF
Message.hpp
Go to the documentation of this file.
1// ****************************************************************************
2// CUI
3//
4// The Advanced Framework for Simulation, Integration, and Modeling (AFSIM)
5//
6// Copyright 2019 Infoscitex, a DCS Company. All rights reserved.
7//
8// The use, dissemination or disclosure of data in this file is subject to
9// limitation or restriction. See accompanying README and LICENSE for details.
10// ****************************************************************************
11
12#ifndef MESSAGE_HPP
13#define MESSAGE_HPP
14
15#include "usmtf_export.h"
16
17#include <memory>
18#include <utility>
19#include <vector>
20
21#include "Segment.hpp"
22#include "Set.hpp"
23#include "Validatable.hpp"
24
50
51
79namespace usmtf
80{
81
106class USMTF_EXPORT Message : public Validatable
107{
108public:
109 Message(const std::string& aMTF, std::vector<std::unique_ptr<Set>> aSets) noexcept;
110 Message(const Message&) = delete;
111 Message& operator=(const Message&) = delete;
112 virtual ~Message() = default;
114 const std::string& GetType() const noexcept;
116 const Set& GetSet(Segment::SetPosition aSetIndex) const;
118 Segment::SetLocations GetSets(const std::string& aSTF) const noexcept;
120 Segment::SetLocations GetSets(const std::vector<std::string>& aSTF) const noexcept;
122 Segment GetSegment(const Segment::SetPosition& startPosition, const Segment::SetPosition& stopPosition) const;
126 std::vector<Segment> GetSegments(const std::string& aSTF) const;
128 size_t GetNumberOfSets() const noexcept;
130 bool IsEmpty() const noexcept;
131
132protected:
133 bool IsSetPositionOutOfBounds(const Segment::SetPosition& aPos) const noexcept;
134 const std::string mMessageTextFormat;
135 std::vector<std::unique_ptr<Set>> mSets;
136}; // The message abstraction is necessary, as it prescribes ordered arrangement of sets. And sets, prescribe ordered
137 // arrangement of fields.
138} // namespace usmtf
139#endif
Message(const Message &)=delete
bool IsEmpty() const noexcept
Tells you if the Message doesn't contain Sets.
Definition Message.cpp:115
std::vector< Segment > GetSegments(const std::string &aSTF) const
Definition Message.cpp:94
Message(const std::string &aMTF, std::vector< std::unique_ptr< Set > > aSets) noexcept
Definition Message.cpp:22
Segment::SetLocations GetSets(const std::string &aSTF) const noexcept
Get all Sets that match the given set type.
Definition Message.cpp:44
const Set & GetSet(Segment::SetPosition aSetIndex) const
Retrieve a Set at a given index.
Definition Message.cpp:33
virtual ~Message()=default
const std::string & GetType() const noexcept
Get the Type of the Message.
Definition Message.cpp:28
bool IsSetPositionOutOfBounds(const Segment::SetPosition &aPos) const noexcept
Definition Message.cpp:120
Message & operator=(const Message &)=delete
size_t GetNumberOfSets() const noexcept
Number of sets in the Message.
Definition Message.cpp:110
const std::string mMessageTextFormat
Definition Message.hpp:134
Segment GetSegment(const Segment::SetPosition &startPosition, const Segment::SetPosition &stopPosition) const
Retrieve a grouping of sets by given start and end positions.
Definition Message.cpp:76
std::vector< std::unique_ptr< Set > > mSets
Definition Message.hpp:135
Definition Segment.hpp:30
Definition Set.hpp:54
Definition Validatable.hpp:24
Template specialization for wsf::comm::Address. Allows usage of Address in std::unordered_map/set.
Definition WsfCommAddress.hpp:185
Definition Acmid.cpp:17
Copyrights Multiple, All Rights Reserved