WSF
usmtf::Message Class Reference

#include <Message.hpp>

Inheritance diagram for usmtf::Message:
Collaboration diagram for usmtf::Message:

Public Member Functions

 Message (const std::string &aMTF, std::vector< std::unique_ptr< Set > > aSets) noexcept
 Message (const Message &)=delete
Messageoperator= (const Message &)=delete
virtual ~Message ()=default
const std::string & GetType () const noexcept
 Get the Type of the Message.
const SetGetSet (Segment::SetPosition aSetIndex) const
 Retrieve a Set at a given index.
Segment::SetLocations GetSets (const std::string &aSTF) const noexcept
 Get all Sets that match the given set type.
Segment::SetLocations GetSets (const std::vector< std::string > &aSTF) const noexcept
 Get all Sets that match any of the given set type.
Segment GetSegment (const Segment::SetPosition &startPosition, const Segment::SetPosition &stopPosition) const
 Retrieve a grouping of sets by given start and end positions.
std::vector< SegmentGetSegments (const std::string &aSTF) const
size_t GetNumberOfSets () const noexcept
 Number of sets in the Message.
bool IsEmpty () const noexcept
 Tells you if the Message doesn't contain Sets.
Public Member Functions inherited from usmtf::Validatable
bool IsValid () const noexcept
Public Member Functions inherited from usmtf::ErrorManager
virtual ~ErrorManager ()=default
bool HasErrors () const noexcept
void LogErrors (std::ostream &aOut) const noexcept
const std::vector< ValidationError > & GetErrors () const

Protected Member Functions

bool IsSetPositionOutOfBounds (const Segment::SetPosition &aPos) const noexcept
Protected Member Functions inherited from usmtf::ErrorManager
void AddError (const ValidationError &aError) noexcept
void AddError (const std::string &aFailureReason, const std::string &aValueValidatied, const std::string &aOptionalSuggestion="") noexcept
void AddError (const std::string &aErrorMessage) noexcept
void AddErrors (const std::vector< ValidationError > &aErrors) noexcept
void ClearErrors () noexcept

Protected Attributes

const std::string mMessageTextFormat
std::vector< std::unique_ptr< Set > > mSets

Detailed Description

Message are the composition of predetermined sequence of sets. Its separated into three subdivisions:

  • Intro Text
  • Main Text
  • Closing Text

Only the Main and closing text are governed by USMTF rules. 4.2.1.c (2), because of this, the parser advanced itself to the main text.

Messages contain sets, that when presented in a certain order outline logical ideas and transfer those ideas via the ordering and data in its enclosed Sets.

Messages have Sets which are sometimes grouped together or repeated to convey meaning. For us, this class can either subscribe to that meaning or ignore it. This is done through registering Sets we're interested in by providing the factory with a constructor for that set type, else the Set type is only parsed and put into mSets as a generic set that has no guarantees of correctness. After Sets are register a message may choose to extract segments its interested and turn those into other entities in the system.

Its set up this way to enable class authors to use what they need and ignore what they don't very easily. This might sounds complex, but its not after some examples, see the accompanying test suite for some inspiration. Or, if you fancy, a concrete use is found in aco.<c,h>pp

Messages are the file/document/white paper of the USMTF if you will.

Constructor & Destructor Documentation

◆ Message() [1/2]

usmtf::Message::Message ( const std::string & aMTF,
std::vector< std::unique_ptr< Set > > aSets )
noexcept

◆ Message() [2/2]

usmtf::Message::Message ( const Message & )
delete

References Message().

◆ ~Message()

virtual usmtf::Message::~Message ( )
virtualdefault

Member Function Documentation

◆ GetNumberOfSets()

size_t usmtf::Message::GetNumberOfSets ( ) const
noexcept

Number of sets in the Message.

References mSets.

Referenced by GetSegments(), and ~Message().

◆ GetSegment()

Segment usmtf::Message::GetSegment ( const Segment::SetPosition & startPosition,
const Segment::SetPosition & stopPosition ) const

Retrieve a grouping of sets by given start and end positions.

References GetSet(), and IsSetPositionOutOfBounds().

Referenced by GetSegments(), and ~Message().

◆ GetSegments()

std::vector< Segment > usmtf::Message::GetSegments ( const std::string & aSTF) const

Returns vector of segments that start with set type and go until next position is found. If set type is not found at all, no segments are returned. If Set Type is found only once, Vector will contain a single segment of that set until the end of the message.

References GetNumberOfSets(), GetSegment(), and GetSets().

Referenced by ~Message().

◆ GetSet()

const Set & usmtf::Message::GetSet ( Segment::SetPosition aSetIndex) const

Retrieve a Set at a given index.

References mSets.

Referenced by GetSegment(), and ~Message().

◆ GetSets() [1/2]

Segment::SetLocations usmtf::Message::GetSets ( const std::string & aSTF) const
noexcept

Get all Sets that match the given set type.

References mSets.

Referenced by GetSegments(), and ~Message().

◆ GetSets() [2/2]

Segment::SetLocations usmtf::Message::GetSets ( const std::vector< std::string > & aSTF) const
noexcept

Get all Sets that match any of the given set type.

References usmtf::FFIRN_Validator::IsInSelection(), and mSets.

◆ GetType()

const std::string & usmtf::Message::GetType ( ) const
noexcept

Get the Type of the Message.

References mMessageTextFormat.

Referenced by ~Message().

◆ IsEmpty()

bool usmtf::Message::IsEmpty ( ) const
noexcept

Tells you if the Message doesn't contain Sets.

References mSets.

Referenced by ~Message().

◆ IsSetPositionOutOfBounds()

bool usmtf::Message::IsSetPositionOutOfBounds ( const Segment::SetPosition & aPos) const
protectednoexcept

References mSets.

Referenced by GetSegment(), and ~Message().

◆ operator=()

Message & usmtf::Message::operator= ( const Message & )
delete

References Message().

Member Data Documentation

◆ mMessageTextFormat

const std::string usmtf::Message::mMessageTextFormat
protected

Referenced by GetType(), and Message().

◆ mSets

std::vector<std::unique_ptr<Set> > usmtf::Message::mSets
protected

The documentation for this class was generated from the following files:
Copyrights Multiple, All Rights Reserved