15template <
typename Base>
116 return new T(stream);
129 static std::map<int, FactoryUnitBase *> &
GetUnits() {
130 static std::map<int, FactoryUnitBase *> units;
140 template <
typename T>
142 std::map<int, FactoryUnitBase *> &units =
GetUnits();
Stream of raw bytes, the base of the memory, file, and network streams.
Definition binstream.h:22
Builder of one class.
Definition factory.h:23
virtual ~FactoryUnitBase()
Release the builder.
Definition factory.h:31
virtual Base * Create(BinStream &stream)=0
Construct an object of the class from a stream.
Builder of the class T.
Definition factory.h:51
Base * Create(BinStream &stream) override
Construct a T from a stream.
Definition factory.h:115
~FactoryUnit() override=default
Release the builder.
Registry of the classes derived from a base that a stream can rebuild, by identifier.
Definition factory.h:16
static void Register(int nId)
Register a builder of the class T under an identifier.
Definition factory.h:141
static std::map< int, FactoryUnitBase * > & GetUnits()
Report the builders by identifier, constructing the registry on first use.
Definition factory.h:129