aboutsummaryrefslogtreecommitdiffstats
path: root/library/cpp/binsaver/class_factory.h
diff options
context:
space:
mode:
authormonster <monster@yandex-team.ru>2022-02-10 16:47:19 +0300
committerDaniil Cherednik <dcherednik@yandex-team.ru>2022-02-10 16:47:19 +0300
commitdd76ae1f6213d065375ab296699f764faafbe5bd (patch)
tree075a4553d0011d8f92752c0891794febb15912cf /library/cpp/binsaver/class_factory.h
parentf02a874a7290593efbe4b3aeae69a04b46c1cc86 (diff)
downloadydb-dd76ae1f6213d065375ab296699f764faafbe5bd.tar.gz
Restoring authorship annotation for <monster@yandex-team.ru>. Commit 1 of 2.
Diffstat (limited to 'library/cpp/binsaver/class_factory.h')
-rw-r--r--library/cpp/binsaver/class_factory.h24
1 files changed, 12 insertions, 12 deletions
diff --git a/library/cpp/binsaver/class_factory.h b/library/cpp/binsaver/class_factory.h
index e83512331b..4bfb225b28 100644
--- a/library/cpp/binsaver/class_factory.h
+++ b/library/cpp/binsaver/class_factory.h
@@ -15,12 +15,12 @@ public:
typedef const std::type_info* VFT;
private:
- typedef T* (*newFunc)();
+ typedef T* (*newFunc)();
typedef THashMap<int, newFunc> CTypeNewHash; // typeID->newFunc()
typedef THashMap<VFT, int> CTypeIndexHash; // vftable->typeID
- CTypeIndexHash typeIndex;
- CTypeNewHash typeInfo;
+ CTypeIndexHash typeIndex;
+ CTypeNewHash typeInfo;
void RegisterTypeBase(int nTypeID, newFunc func, VFT vft);
static VFT GetObjectType(T* pObject) {
@@ -29,15 +29,15 @@ private:
int VFT2TypeID(VFT t) {
CTypeIndexHash::iterator i = typeIndex.find(t);
if (i != typeIndex.end())
- return i->second;
+ return i->second;
for (i = typeIndex.begin(); i != typeIndex.end(); ++i) {
if (*i->first == *t) {
- typeIndex[t] = i->second;
- return i->second;
- }
- }
- return -1;
- }
+ typeIndex[t] = i->second;
+ return i->second;
+ }
+ }
+ return -1;
+ }
public:
template <class TT>
@@ -45,10 +45,10 @@ public:
RegisterTypeBase(nTypeID, func, &typeid(TT));
}
void RegisterTypeSafe(int nTypeID, newFunc func) {
- TPtr<T> pObj = func();
+ TPtr<T> pObj = func();
VFT vft = GetObjectType(pObj);
RegisterTypeBase(nTypeID, func, vft);
- }
+ }
T* CreateObject(int nTypeID) {
newFunc f = typeInfo[nTypeID];
if (f)