@@ -20,7 +20,7 @@ or include this files:
2020
2121## How use this
2222
23- For init you must call ` WSJCppEmployees ::init({})`
23+ For init you must call ` WsjcppEmployees ::init({})`
2424
2525Example main func:
2626```
@@ -31,15 +31,15 @@ int main(int argc, const char* argv[]) {
3131 std::string TAG = "MAIN";
3232 std::string appName = std::string(WSJCPP_NAME);
3333 std::string appVersion = std::string(WSJCPP_VERSION);
34- if (!WSJCppCore ::dirExists(".logs")) {
35- WSJCppCore ::makeDir(".logs");
34+ if (!WsjcppCore ::dirExists(".logs")) {
35+ WsjcppCore ::makeDir(".logs");
3636 }
37- WSJCppLog ::setPrefixLogFile("wsjcpp-employees");
38- WSJCppLog ::setLogDirectory(".logs");
37+ WsjcppLog ::setPrefixLogFile("wsjcpp-employees");
38+ WsjcppLog ::setLogDirectory(".logs");
3939
4040 // init employees
41- if (!WSJCppEmployees ::init({})) {
42- WSJCppLog ::err(TAG, "Could not init employees");
41+ if (!WsjcppEmployees ::init({})) {
42+ WsjcppLog ::err(TAG, "Could not init employees");
4343 return -1;
4444 }
4545 return 0;
@@ -58,23 +58,29 @@ Now you can call from any place:
5858#inluce <wsjcpp_employees.h>
5959
6060void someFunc() {
61- WJSCppEmployRuntimeGlobalCache *pCache = findWSJCppEmploy <WJSCppEmployRuntimeGlobalCache>();
61+ WJSCppEmployRuntimeGlobalCache *pCache = findWsjcppEmploy <WJSCppEmployRuntimeGlobalCache>();
6262 pCache->set("name", "value");
6363}
6464```
6565
66+ ### Example of define you employ use a wsjcpp
67+
68+ ```
69+ wsjcpp generate WsjcppEmploy MyImpl
70+ ```
71+
6672### Example of define you employ (simple)
6773
6874(don't foget add to build)
6975
7076Example Header ` your_employ.h ` :
7177```
72- #ifndef WSJCPP_EMPLOYEES_H
73- #define WSJCPP_EMPLOYEES_H
78+ #ifndef YOUR_EMPLOY_H
79+ #define YOUR_EMPLOY_H
7480
7581#include <wsjcpp_employees.h>
7682
77- class YourEmploy : public WSJCppEmployBase {
83+ class YourEmploy : public WsjcppEmployBase {
7884 public:
7985 YourEmploy();
8086 static std::string name() { return "YourEmploy"; }
@@ -85,7 +91,7 @@ class YourEmploy : public WSJCppEmployBase {
8591 std::string TAG;
8692};
8793
88- #endif // WSJCPP_EMPLOYEES_H
94+ #endif // YOUR_EMPLOY_H
8995```
9096
9197Example source-code ` your_employ.cpp ` :
@@ -95,39 +101,39 @@ Example source-code `your_employ.cpp`:
95101REGISTRY_WJSCPP_EMPLOY(YourEmploy)
96102
97103YourEmploy::YourEmploy()
98- : WSJCppEmployBase (YourEmploy::name(), {}) {
104+ : WsjcppEmployBase (YourEmploy::name(), {}) {
99105 TAG = YourEmploy::name();
100106}
101107
102108bool YourEmploy::init() {
103- WSJCppLog ::info(TAG, "init called");
109+ WsjcppLog ::info(TAG, "init called");
104110 return true;
105111}
106112
107113bool YourEmploy::deinit() {
108- WSJCppLog ::info(TAG, "deinit called");
114+ WsjcppLog ::info(TAG, "deinit called");
109115 return true;
110116}
111117
112118void YourEmploy::doSomething() {
113- WSJCppLog ::info(TAG, "doSomething called");
119+ WsjcppLog ::info(TAG, "doSomething called");
114120}
115121```
116122
117- 1 . For call ::init you must call ` WSJCppEmployees ::init({})` in main function
123+ 1 . For call ::init you must call ` WsjcppEmployees ::init({})` in main function
1181242 . find employ and call you method from any place
119125
120126```
121127#inluce <your_employ.h>
122128
123129void someFunc() {
124- YourEmploy *pYourEmploy = findWSJCppEmploy <YourEmploy>();
130+ YourEmploy *pYourEmploy = findWsjcppEmploy <YourEmploy>();
125131 pYourEmploy->doSomething();
126132}
127133
128134void main() {
129135 ...
130- WSJCppEmployees ::init({});
136+ WsjcppEmployees ::init({});
131137 someFunc();
132138}
133139```
@@ -140,7 +146,7 @@ void main() {
140146
141147// second - will be init after
142148SecondEmploy::SecondEmploy()
143- : WSJCppEmployBase (SecondEmploy::name(), {"FirstEmploy"}) {
149+ : WsjcppEmployBase (SecondEmploy::name(), {"FirstEmploy"}) {
144150 TAG = SecondEmploy::name();
145151}
146152
@@ -150,7 +156,7 @@ bool SecondEmploy::init() {
150156
151157// first employ - will be init every time
152158FirstEmploy::FirstEmploy()
153- : WSJCppEmployBase (FirstEmploy::name(), {}) {
159+ : WsjcppEmployBase (FirstEmploy::name(), {}) {
154160 TAG = FirstEmploy::name();
155161}
156162
@@ -171,7 +177,7 @@ UsersEmploy
171177
172178Also you can define on init:
173179```
174- WSJCppEmployees ::init({"server-start"})
180+ WsjcppEmployees ::init({"server-start"})
175181```
176182So it will be call "::init" employees only there which has this requirements.
177183
0 commit comments