Identity map.
Some checks failed
CI / ubuntu-latest-html-tests (push) Has been cancelled
CI / alpine-mbedtls-3_6_0 (push) Has been cancelled
CI / ubuntu-latest-no-tls (push) Has been cancelled
CI / ubuntu-latest-mbedtls2 (push) Has been cancelled
CI / ubuntu-latest-openssl-3 (push) Has been cancelled
CI / ubuntu-latest-with-old-std (push) Has been cancelled
CI / ubuntu-20-04-openssl-1-1 (push) Has been cancelled
CI / macOS-13-openssl-1-1 (push) Has been cancelled
CI / macOS-13-openssl-3 (push) Has been cancelled
CI / freebsd-14-openssl-3 (push) Has been cancelled
CI / windows-mbedtls (push) Has been cancelled
Some checks failed
CI / ubuntu-latest-html-tests (push) Has been cancelled
CI / alpine-mbedtls-3_6_0 (push) Has been cancelled
CI / ubuntu-latest-no-tls (push) Has been cancelled
CI / ubuntu-latest-mbedtls2 (push) Has been cancelled
CI / ubuntu-latest-openssl-3 (push) Has been cancelled
CI / ubuntu-latest-with-old-std (push) Has been cancelled
CI / ubuntu-20-04-openssl-1-1 (push) Has been cancelled
CI / macOS-13-openssl-1-1 (push) Has been cancelled
CI / macOS-13-openssl-3 (push) Has been cancelled
CI / freebsd-14-openssl-3 (push) Has been cancelled
CI / windows-mbedtls (push) Has been cancelled
This commit is contained in:
@ -55,9 +55,7 @@ void IdentifiableObject::Class::intoStringBuffer(misc::StringBuffer *sb)
|
||||
sb->append (">");
|
||||
}
|
||||
|
||||
HashTable <ConstString, IdentifiableObject::Class>
|
||||
*IdentifiableObject::classesByName =
|
||||
new HashTable<ConstString, IdentifiableObject::Class> (true, true);
|
||||
std::map< std::string, std::unique_ptr< IdentifiableObject::Class > > IdentifiableObject::classesByName;
|
||||
|
||||
std::vector< IdentifiableObject::Class * > IdentifiableObject::classesById;
|
||||
|
||||
@ -83,13 +81,11 @@ void IdentifiableObject::intoStringBuffer(misc::StringBuffer *sb)
|
||||
*/
|
||||
void IdentifiableObject::registerName (const char *className, int *classId)
|
||||
{
|
||||
ConstString str (className);
|
||||
Class *klass = classesByName->get (&str);
|
||||
Class *klass = classesByName.at( className ).get();
|
||||
if (klass == NULL) {
|
||||
klass = new Class (currentlyConstructedClass, classesById.size (),
|
||||
className);
|
||||
ConstString *key = new ConstString (className);
|
||||
classesByName->put (key, klass);
|
||||
classesByName.emplace (className, klass);
|
||||
classesById.push_back (klass);
|
||||
*classId = klass->id;
|
||||
}
|
||||
|
@ -1,6 +1,10 @@
|
||||
#ifndef __LOUT_OBJECTX_HH__
|
||||
#define __LOUT_OBJECTX_HH__
|
||||
|
||||
#include <memory>
|
||||
#include <vector>
|
||||
#include <map>
|
||||
|
||||
#include "object.hh"
|
||||
#include "container.hh"
|
||||
#include "signal.hh"
|
||||
@ -110,8 +114,7 @@ private:
|
||||
void intoStringBuffer(misc::StringBuffer *sb);
|
||||
};
|
||||
|
||||
static container::typed::HashTable <object::ConstString,
|
||||
Class> *classesByName;
|
||||
static std::map< std::string, std::unique_ptr< Class > > classesByName;
|
||||
static std::vector< Class * > classesById;
|
||||
static Class *currentlyConstructedClass;
|
||||
|
||||
|
Reference in New Issue
Block a user