-
Notifications
You must be signed in to change notification settings - Fork 58
refactor: make json_helper decoupled from dsn_runtime #527
base: master
Are you sure you want to change the base?
Conversation
@@ -214,11 +214,11 @@ | |||
} | |||
|
|||
#define NON_MEMBER_JSON_SERIALIZATION(type, ...) \ | |||
inline void json_encode(dsn::json::JsonWriter &output, const type &t) \ | |||
void json_encode(dsn::json::JsonWriter &output, const type &t) \ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why remove inline?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In cpp, inline function must be defined in .h
, but not .cpp
. And we should move json_code
function of gpid
to gpid.cpp
.
void json_encode(JsonWriter &out, const dsn::gpid &pid); | ||
bool json_decode(const dsn::json::JsonObject &in, dsn::gpid &pid); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Move the declaration to gpid.h
.
void json_encode(JsonWriter &out, const dsn::gpid &pid); | |
bool json_decode(const dsn::json::JsonObject &in, dsn::gpid &pid); | |
namespace json { | |
class JsonWriter; | |
class JsonObject; | |
} // namespace json | |
void json_encode(JsonWriter &out, const gpid &pid); | |
bool json_decode(const JsonObject &in, gpid &pid); |
Do the same to other types.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why move the declaration to gpid.h
? I think placed them centrally in one file is ok.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The module itself should be responsible for its related code. There's no modularity if everything is in a central file.
No description provided.