MCPcopy Create free account
hub / github.com/catboost/catboost / AddParam

Method AddParam

library/cpp/par/par.h:78–92  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

76 // helper functions
77 template <class T>
78 inline int AddParam(T* param) {
79 CHROMIUM_TRACE_FUNCTION();
80 if (IBinSaver::HasNonTrivialSerializer<T>(0u)) {
81 TVector<char> tmp;
82 SerializeToMem(&tmp, *param);
83 return AddParamData(&tmp);
84 } else {
85 int res = ParamsPtr.ysize() - 1;
86 int dstPtr = ParamsData.ysize();
87 ParamsData.yresize(dstPtr + (int)sizeof(T));
88 *reinterpret_cast<T*>(&ParamsData[dstPtr]) = *param;
89 ParamsPtr.push_back(dstPtr + (int)sizeof(T));
90 return res;
91 }
92 }
93 void GetParam(int paramId, TVector<char>* res) {
94 int sz = ParamsPtr[paramId + 1] - ParamsPtr[paramId];
95 res->yresize(sz);

Callers 1

RemoteMapReduceImplFunction · 0.80

Calls 4

SerializeToMemFunction · 0.85
yresizeMethod · 0.80
ysizeMethod · 0.45
push_backMethod · 0.45

Tested by

no test coverage detected