|
WSF
|
Uses of this is highly documented in pretty much every tests Suite. More...
#include <USMTF_Factory.hpp>
Public Types | |
| using | ConstructorCb = std::function<std::unique_ptr<T>(const std::string& aType, U aContents)> |
| Constructor Callback specifies the expected format of the function needed to instantiate objects. | |
Public Member Functions | |
| template<class V> | |
| const V * | CastIfRegistered (const T &aEntity) noexcept |
| void | RegisterEntity (const std::string &aType, ConstructorCb aCb) noexcept |
| void | UnregisterEntity (const std::string &aType) noexcept |
| Unregister a previously registers derived type. | |
| std::unique_ptr< T > | CreateInstance (const std::string &aType, U aContents) |
| Instantiate an instance of the Set or Message. Used Only by parser. | |
Static Public Member Functions | |
| static USMTF_Factory< T, U > * | GetFactory () |
| Return the singleton instance of the factory. | |
| template<class V> | |
| static std::unique_ptr< V > | Construct (const std::string &aType, U &&aContents) |
Uses of this is highly documented in pretty much every tests Suite.
Parser uses the factory to construct Sets and Messages uniformly. If Set/Message Types have a constructor registered (ie, opting in to caring about it) then the parser will use it, otherwise it will make the base class for it and move on. This ensures that parsing always succeeds if the file is valid USMTF, but the interpretation of a generic set/message is always left to the custom types to validate, interpret, transform or otherwise use. Its an opt in system, register things you care to validate and use, ignore validating the rest. This allows an immense flexibility where class authors can always use the Abstractions provided by the lib, yet isolate the things they actually care about. This flexibility is important because there may be discrepancies between what the USMTF defines as correct and what an AFSIM idea can use. We don't want to follow the USMTF standard letter by letter if we can only use some of the sets/segments/message/fields defined to create AFSIM entities.
| using usmtf::USMTF_Factory< T, U >::ConstructorCb = std::function<std::unique_ptr<T>(const std::string& aType, U aContents)> |
Constructor Callback specifies the expected format of the function needed to instantiate objects.
|
noexcept |
Cast base pointer to derived. Intended for use by Set and Message Authors. It will verify both at run time with dynamic_cast that the relationship is valid. It also verifies at runtime when used that the derived class is registered.
Referenced by usmtf::USMTF_Transformer::ExtractSet().
|
static |
| std::unique_ptr< T > usmtf::USMTF_Factory< T, U >::CreateInstance | ( | const std::string & | aType, |
| U | aContents ) |
|
static |
Return the singleton instance of the factory.
Export across DLL boundary, ensures singleton functionality.
|
noexcept |
|
noexcept |
Unregister a previously registers derived type.