Beatmup
Beatmup::NNets::AbstractOperation::Deserializer Class Referenceabstract

Enables construction of an operation from its serialized representation. More...

#include <operation.h>

Public Member Functions

 Deserializer (const char *opType)
 Registers a new deserializer capable of building an operation from a listing block. More...
 
virtual AbstractOperationdeserialize (Context &context, const Listing::Block &block)=0
 Constructs an operation from a serialized representation (a listing block). More...
 

Static Public Member Functions

static std::map< std::string, Deserializer * > & getDeserializersMap ()
 

Detailed Description

Enables construction of an operation from its serialized representation.

Every new instance of this class is registered in a static map and used to build operations during the model deserialization.

Definition at line 248 of file operation.h.

Constructor & Destructor Documentation

◆ Deserializer()

AbstractOperation::Deserializer::Deserializer ( const char *  opType)

Registers a new deserializer capable of building an operation from a listing block.

Parameters
[in]opTypeOperation type

Definition at line 89 of file operation.cpp.

89  {
90  // add the instance to map
91 #ifdef BEATMUP_DEBUG
92  DebugAssertion::check(getDeserializersMap().count(opType) == 0, "A deserializer of a specific operation is already registered");
93 #endif
94  getDeserializersMap().emplace(opType, this);
95 }
static std::map< std::string, Deserializer * > & getDeserializersMap()
Definition: operation.cpp:83
JNIEnv jlong jint jint count

Member Function Documentation

◆ getDeserializersMap()

std::map< std::string, AbstractOperation::Deserializer * > & AbstractOperation::Deserializer::getDeserializersMap ( )
static

Definition at line 83 of file operation.cpp.

83  {
84  static std::map<std::string, Deserializer*> map;
85  return map;
86 }

◆ deserialize()

virtual AbstractOperation* Beatmup::NNets::AbstractOperation::Deserializer::deserialize ( Context context,
const Listing::Block block 
)
pure virtual

Constructs an operation from a serialized representation (a listing block).

Raises exceptions if the representation contains errors or has missing parameters.

Parameters
[in]contextA context instance passed to the operation constructor if needed
[in]blockThe block containing the operation description

The documentation for this class was generated from the following files: