{"id":199496,"date":"2013-10-29T12:49:02","date_gmt":"2013-10-29T08:49:02","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=199496"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=199496","title":{"rendered":"<span class=\"post_title\">RMI \u0441\u0440\u0435\u0434\u0441\u0442\u0432\u0430\u043c\u0438 \u0421++ \u0438 boost.preprocessor<\/span>"},"content":{"rendered":"<div class=\"content html_format\"> \t\t\t<i>\u042d\u0442\u043e \u043c\u043e\u044f \u043f\u0435\u0440\u0432\u0430\u044f \u043f\u0443\u0431\u043b\u0438\u043a\u0430\u0446\u0438\u044f \u043d\u0430 \u0441\u0435\u043c \u0440\u0435\u0441\u0443\u0440\u0441\u0435, \u043f\u043e\u0441\u0435\u043c\u0443, \u043f\u0440\u043e\u0448\u0443 \u043e\u0442\u043d\u0435\u0441\u0442\u0438\u0441\u044c \u0441 \u043f\u043e\u043d\u0438\u043c\u0430\u043d\u0438\u0435\u043c \u043a \u0434\u043e\u043f\u0443\u0449\u0435\u043d\u043d\u044b\u043c \u043c\u043d\u043e\u044e \u043e\u0448\u0438\u0431\u043a\u0430\u043c.<\/i><\/p>\n<p>  <a href=\"https:\/\/en.wikipedia.org\/wiki\/Java_remote_method_invocation\">RMI<\/a> \u2014 \u0432\u0435\u0441\u044c\u043c\u0430 \u0431\u0430\u043d\u0430\u043b\u044c\u043d\u0430\u044f \u0437\u0430\u0434\u0430\u0447\u0430 \u0434\u043b\u044f \u042f\u041f, \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u044e\u0449\u0438\u0445 <a href=\"https:\/\/en.wikipedia.org\/wiki\/Type_introspection\">\u0438\u043d\u0442\u0440\u043e\u0441\u043f\u0435\u043a\u0446\u0438\u044e<\/a>. \u041d\u043e, \u0421++, \u043a \u0441\u043e\u0436\u0430\u043b\u0435\u043d\u0438\u044e, \u043a \u043d\u0438\u043c \u043d\u0435 \u043e\u0442\u043d\u043e\u0441\u0438\u0442\u0441\u044f.<\/p>\n<p>  \u0412 \u0434\u0430\u043d\u043d\u043e\u0439 \u043f\u0443\u0431\u043b\u0438\u043a\u0430\u0446\u0438\u0438 \u044f \u0445\u043e\u0447\u0443 \u043f\u0440\u043e\u0434\u0435\u043c\u043e\u043d\u0441\u0442\u0440\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044c \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 \u0432\u0435\u0441\u044c\u043c\u0430 \u044e\u0437\u0430\u0431\u0438\u043b\u044c\u043d\u043e\u0439 RMI \u0441\u0440\u0435\u0434\u0441\u0442\u0432\u0430\u043c\u0438 \u0421++ \u043f\u0440\u0435\u043f\u0440\u043e\u0446\u0435\u0441\u0441\u043e\u0440\u0430.<\/p>\n<h4>\u041f\u043e\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0430 \u0437\u0430\u0434\u0430\u0447\u0438<\/h4>\n<p>  1. \u041f\u0440\u0435\u0434\u043e\u0441\u0442\u0430\u0432\u0438\u0442\u044c \u043c\u0430\u043a\u0441\u0438\u043c\u0430\u043b\u044c\u043d\u043e \u043f\u0440\u043e\u0441\u0442\u043e\u0439 \u0441\u0438\u043d\u0442\u0430\u043a\u0441\u0438\u0441, \u0447\u0442\u043e\u0431 \u043d\u0435\u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e \u0431\u044b\u043b\u043e \u0434\u043e\u043f\u0443\u0441\u0442\u0438\u0442\u044c \u043e\u0448\u0438\u0431\u043a\u0443.<br \/>  2. \u0418\u0434\u0435\u043d\u0442\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u044f(\u0441\u0432\u044f\u0437\u044b\u0432\u0430\u043d\u0438\u0435) \u043f\u0440\u043e\u0446\u0435\u0434\u0443\u0440 \u0434\u043e\u043b\u0436\u043d\u0430 \u0431\u044b\u0442\u044c \u0441\u043a\u0440\u044b\u0442\u0430 \u043e\u0442 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f \u0434\u043b\u044f \u0442\u043e\u0433\u043e, \u0447\u0442\u043e\u0431 \u043d\u0435\u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e \u0431\u044b\u043b\u043e \u0434\u043e\u043f\u0443\u0441\u0442\u0438\u0442\u044c \u043e\u0448\u0438\u0431\u043a\u0443.<br \/>  3. \u0421\u0438\u043d\u0442\u0430\u043a\u0441\u0438\u0441 \u043d\u0435 \u0434\u043e\u043b\u0436\u0435\u043d \u043d\u0430\u043a\u043b\u0430\u0434\u044b\u0432\u0430\u0442\u044c \u043e\u0433\u0440\u0430\u043d\u0438\u0447\u0435\u043d\u0438\u044f \u043d\u0430 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c\u044b\u0435 \u0421++ \u0442\u0438\u043f\u044b.<br \/>  4. \u0414\u043e\u043b\u0436\u043d\u0430 \u043f\u0440\u0438\u0441\u0443\u0442\u0441\u0442\u0432\u043e\u0432\u0430\u0442\u044c \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044c \u0432\u0435\u0440\u0441\u0438\u043e\u043d\u043d\u043e\u0441\u0442\u0438 \u043f\u0440\u043e\u0446\u0435\u0434\u0443\u0440, \u043d\u043e, \u0442\u0430\u043a, \u0447\u0442\u043e\u0431 \u043d\u0435 \u043b\u043e\u043c\u0430\u043b\u0430\u0441\u044c \u0441\u043e\u0432\u043c\u0435\u0441\u0442\u0438\u043c\u043e\u0441\u0442\u044c \u0441 \u0443\u0436\u0435 \u0440\u0430\u0431\u043e\u0442\u0430\u044e\u0449\u0438\u043c\u0438 \u043a\u043b\u0438\u0435\u043d\u0442\u0430\u043c\u0438.<br \/>  <a name=\"habracut\"><\/a><br \/>  \u041a\u0430\u0441\u0430\u0442\u0435\u043b\u044c\u043d\u043e \u0447\u0435\u0442\u0432\u0435\u0440\u0442\u043e\u0433\u043e \u043f\u0443\u043d\u043a\u0442\u0430:<br \/>  \u041a \u043f\u0440\u0438\u043c\u0435\u0440\u0443, \u0443 \u043d\u0430\u0441 \u0443\u0436\u0435 \u0435\u0441\u0442\u044c \u0434\u0432\u0435 \u043f\u0440\u043e\u0446\u0435\u0434\u0443\u0440\u044b add\/div \u043f\u043e \u043e\u0434\u043d\u043e\u0439 \u0432\u0435\u0440\u0441\u0438\u0438 \u043a\u0430\u0436\u0434\u043e\u0439. \u041c\u044b \u0445\u043e\u0442\u0438\u043c \u0434\u043b\u044f add \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u043d\u043e\u0432\u0443\u044e \u0432\u0435\u0440\u0441\u0438\u044e. \u0415\u0441\u043b\u0438 \u043f\u0440\u043e\u0441\u0442\u043e \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u0435\u0449\u0435 \u043e\u0434\u043d\u0443 \u0432\u0435\u0440\u0441\u0438\u044e \u2014 \u0443 \u043d\u0430\u0441 \u043f\u043e\u043f\u043b\u044b\u0432\u0443\u0442 ID`\u044b \u043f\u0440\u043e\u0446\u0435\u0434\u0443\u0440, \u043e \u043a\u043e\u0442\u043e\u0440\u044b\u0445 \u0437\u043d\u0430\u044e\u0442 \u043a\u043b\u0438\u0435\u043d\u0442\u0441\u043a\u0438\u0435 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u044b, \u0441\u043e\u0431\u0440\u0430\u043d\u043d\u044b\u0435 \u0434\u043e \u0432\u043d\u0435\u0441\u0435\u043d\u0438\u044f \u044d\u0442\u043e\u0433\u043e \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u044f.<\/p>\n<h4>\u0412\u044b\u0431\u043e\u0440 \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442\u0430<\/h4>\n<p>  \u0422.\u043a. \u043a\u043e\u043d\u0435\u0447\u043d\u044b\u0439 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442 \u043f\u0440\u0435\u0434\u043f\u043e\u043b\u0430\u0433\u0430\u0435\u0442\u0441\u044f \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0441\u043e\u0432\u043c\u0435\u0441\u0442\u043d\u043e \u0441 \u0421++ \u043a\u043e\u0434\u043e\u043c, \u0432\u0430\u0440\u0438\u0430\u043d\u0442\u043e\u0432 \u044f \u0432\u0438\u0436\u0443 \u0442\u0440\u0438:  <\/p>\n<ul>\n<li>\u0418\u0437\u043e\u0431\u0440\u0435\u0442\u0430\u0435\u043c \u0441\u0438\u043d\u0442\u0430\u043a\u0441\u0438\u0441 \u0438 \u043f\u0438\u0448\u0435\u043c \u0441\u0432\u043e\u0439 \u043a\u043e\u0434\u043e\u0433\u0435\u043d\u0435\u0440\u0430\u0442\u043e\u0440.<\/li>\n<li>\u0418\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c \u0421++ \u043f\u0440\u0435\u043f\u0440\u043e\u0446\u0435\u0441\u0441\u043e\u0440.<\/li>\n<li>\u0418\u0449\u0435\u043c \u043d\u0435\u0447\u0442\u043e \u0433\u043e\u0442\u043e\u0432\u043e\u0435 \u0438 \u0434\u043e\u043f\u0438\u043b\u0438\u0432\u0430\u0435\u043c \u043f\u043e\u0434 \u0441\u0435\u0431\u044f(\u0435\u0441\u043b\u0438 \u043d\u0443\u0436\u043d\u043e).<\/li>\n<\/ul>\n<p>  \u0412\u044b\u0441\u043a\u0430\u0436\u0443\u0441\u044c \u043e \u043a\u0430\u0436\u0434\u043e\u043c \u0438\u0437 \u0432\u0430\u0440\u0438\u0430\u043d\u0442\u043e\u0432 \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0435\u043d\u043d\u043e:  <\/p>\n<ul>\n<li>\u0417\u0430\u0447\u0435\u043c \u0434\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u0430\u044f \u0441\u0442\u0430\u0434\u0438\u044f \u043a\u043e\u0434\u043e\u0433\u0435\u043d\u0435\u0440\u0430\u0446\u0438\u0438?<\/li>\n<li>\u041f\u0440\u0435\u043f\u0440\u043e\u0446\u0435\u0441\u0441\u043e\u0440 \u044f \u043b\u044e\u0431\u043b\u044e, \u0438 \u0447\u0430\u0441\u0442\u043e \u0435\u0433\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044e.<\/li>\n<li>\u0422\u0440\u0430\u0442\u0430 \u0432\u0440\u0435\u043c\u0435\u043d\u0438 \u0438 \u0441\u0438\u043b. \u0418, \u043d\u0435 \u043f\u043e\u043d\u044f\u0442\u043d\u043e, \u0431\u0443\u0434\u0435\u0442 \u043b\u0438 \u0432 \u044d\u0442\u043e\u043c \u0441\u043c\u044b\u0441\u043b.<\/li>\n<\/ul>\n<p>  \u041a\u0430\u0441\u0430\u0442\u0435\u043b\u044c\u043d\u043e \u043f\u0435\u0440\u0432\u043e\u0433\u043e, \u0432\u0442\u043e\u0440\u043e\u0433\u043e \u0438 \u0442\u0440\u0435\u0442\u044c\u0435\u0433\u043e \u043f\u0443\u043d\u043a\u0442\u043e\u0432 \u0442\u0440\u0435\u0431\u043e\u0432\u0430\u043d\u0438\u0439 \u2014 \u043f\u0440\u0435\u043f\u0440\u043e\u0446\u0435\u0441\u0441\u043e\u0440\u043d\u044b\u0439 \u0432\u0430\u0440\u0438\u0430\u043d\u0442 \u043f\u043e\u0434\u0445\u043e\u0434\u0438\u0442.<\/p>\n<p>  \u0418\u0442\u0430\u043a, \u0432\u044b\u0431\u043e\u0440 \u0441\u0434\u0435\u043b\u0430\u043d \u2014 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c \u043f\u0440\u0435\u043f\u0440\u043e\u0446\u0435\u0441\u0441\u043e\u0440. \u0418 \u0434\u0430, \u0440\u0430\u0437\u0443\u043c\u0435\u0435\u0442\u0441\u044f <a href=\"http:\/\/www.boost.org\/doc\/libs\/1_54_0\/libs\/preprocessor\/doc\/index.html\">boost.preprocessor<\/a>.<\/p>\n<h4>\u041d\u0435\u043c\u043d\u043e\u0433\u043e \u043e \u043f\u0440\u0435\u043f\u0440\u043e\u0446\u0435\u0441\u0441\u043e\u0440\u0435<\/h4>\n<p>  \u0422\u0438\u043f\u044b \u0434\u0430\u043d\u043d\u044b\u0445 \u0421++ \u043f\u0440\u0435\u043f\u0440\u043e\u0446\u0435\u0441\u0441\u043e\u0440\u0430:  <\/p>\n<ul>\n<li><a href=\"http:\/\/www.boost.org\/doc\/libs\/1_54_0\/libs\/preprocessor\/doc\/data\/arrays.html\">arrays<\/a>: <code>(size, (elems, ....))<\/code><\/li>\n<li><a href=\"http:\/\/www.boost.org\/doc\/libs\/1_54_0\/libs\/preprocessor\/doc\/data\/lists.html\">lists<\/a>: <code>(a, (b, (c, BOOST_PP_NIL)))<\/code><\/li>\n<li><a href=\"http:\/\/www.boost.org\/doc\/libs\/1_54_0\/libs\/preprocessor\/doc\/data\/sequences.html\">sequences<\/a>: <code>(a)(b)(c)<\/code><\/li>\n<li><a href=\"http:\/\/www.boost.org\/doc\/libs\/1_54_0\/libs\/preprocessor\/doc\/data\/tuples.html\">tuples<\/a>: <code>(a, b, c)<\/code><\/li>\n<\/ul>\n<p>  \u0422\u0438\u043f\u043e\u0432, \u043a\u0430\u043a \u0432\u0438\u0434\u043d\u043e, \u0431\u043e\u043b\u0435\u0435 \u0447\u0435\u043c \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e.<br \/>  \u041d\u0435\u043c\u043d\u043e\u0433\u043e \u043f\u043e\u0434\u0443\u043c\u0430\u0432, \u043f\u043e\u0447\u0438\u0442\u0430\u0432 \u043f\u0440\u043e \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u0438 \u0438 \u043e\u0433\u0440\u0430\u043d\u0438\u0447\u0435\u043d\u0438\u044f \u043a\u0430\u0436\u0434\u043e\u0433\u043e \u0438\u0445 \u043d\u0438\u0445, \u0430 \u0442\u0430\u043a\u0436\u0435 \u0443\u0447\u0442\u044f \u0436\u0435\u043b\u0430\u0435\u043c\u0443\u044e \u043f\u0440\u043e\u0441\u0442\u043e\u0442\u0443 \u0441\u0438\u043d\u0442\u0430\u043a\u0441\u0438\u0441\u0430 \u0438 \u043d\u0435\u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044c \u0434\u043e\u043f\u0443\u0441\u0442\u0438\u0442\u044c \u043e\u0448\u0438\u0431\u043a\u0443 \u2014 \u0432\u044b\u0431\u043e\u0440 \u0431\u044b\u043b \u0441\u0434\u0435\u043b\u0430\u043d \u0432 \u043f\u043e\u043b\u044c\u0437\u0443 sequences \u0438 tuples.<\/p>\n<p>  \u041d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u043f\u043e\u044f\u0441\u043d\u044f\u044e\u0449\u0438\u0445 \u043f\u0440\u0438\u043c\u0435\u0440\u043e\u0432.<br \/>  <code>(a)(b)(c)<\/code> \u2014 sequence. \u0422\u0443\u0442, \u043c\u044b \u043e\u043f\u0438\u0441\u0430\u043b\u0438 sequence, \u0441\u043e\u0441\u0442\u043e\u044f\u0449\u0438\u0439 \u0438\u0437 \u0442\u0440\u0435\u0445 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u043e\u0432.<br \/>  <code>(a)<\/code> \u2014 \u0442\u0430\u043a\u0436\u0435 sequence, \u043d\u043e \u0441\u043e\u0441\u0442\u043e\u044f\u0449\u0438\u0439 \u0438\u0437 \u043e\u0434\u043d\u043e\u0433\u043e \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u0430. (\u0432\u043d\u0438\u043c\u0430\u043d\u0438\u0435!)<br \/>  <code>(a)(b, c)(d, e, f)<\/code> \u2014 \u0441\u043d\u043e\u0432\u0430 sequence, \u043d\u043e \u0441\u043e\u0441\u0442\u043e\u044f\u0449\u0438\u0439 \u0438\u0437 \u0442\u0440\u0435\u0445 tuples. (\u043e\u0431\u0440\u0430\u0442\u0438\u0442\u0435 \u0432\u043d\u0438\u043c\u0430\u043d\u0438\u0435 \u043d\u0430 \u043f\u0435\u0440\u0432\u044b\u0439 \u044d\u043b\u0435\u043c\u0435\u043d\u0442 \u2014 \u0443\u043b\u043e\u0432\u043e\u0447\u043a\u0430, \u043e\u0434\u043d\u0430\u043a\u043e, \u043d\u043e \u044d\u0442\u043e \u0438 \u043f\u0440\u0430\u0432\u0434\u0430 tuple)<br \/>  <code>(a)(b, c)(d, (e, f))<\/code> \u2014 \u043e\u043f\u044f\u0442\u044c \u0436\u0435 sequence, \u0438 \u0442\u0430\u043a \u0436\u0435 \u0441\u043e\u0441\u0442\u043e\u044f\u0449\u0438\u0439 \u0438\u0437 \u0442\u0440\u0435\u0445 tuples. \u041d\u043e! \u041f\u043e\u0441\u043b\u0435\u0434\u043d\u0438\u0439 tuple \u0441\u043e\u0441\u0442\u043e\u0438\u0442 \u0438\u0445 \u0434\u0432\u0443\u0445 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u043e\u0432: 1) \u043b\u044e\u0431\u043e\u0433\u043e \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u0430, 2) tuple.<br \/>  \u0418, \u043d\u0430\u043f\u043e\u0441\u043b\u0435\u0434\u043e\u043a, \u0442\u0430\u043a\u043e\u0439 \u043f\u0440\u0438\u043c\u0435\u0440: <code>(a)(b, c)(d, (e, (f)(g)))<\/code> \u2014 \u0442\u0443\u0442 \u0443\u0436 \u0440\u0430\u0437\u0431\u0435\u0440\u0438\u0442\u0435\u0441\u044c \u0441\u0430\u043c\u0438 \ud83d\ude09<br \/>  \u041a\u0430\u043a \u0432\u0438\u0434\u043d\u043e, \u0432\u0441\u0435 \u0438 \u0432\u043f\u0440\u0430\u0432\u0434\u0443 \u043d\u0435\u0440\u0435\u0430\u043b\u044c\u043d\u043e \u043f\u0440\u043e\u0441\u0442\u043e.<\/p>\n<h4>\u041f\u0440\u043e\u0442\u043e\u0442\u0438\u043f\u0438\u0440\u0443\u0435\u043c \u0441\u0438\u043d\u0442\u0430\u043a\u0441\u0438\u0441<\/h4>\n<p>  \u041f\u043e\u0441\u043b\u0435 \u043d\u0435\u0434\u043e\u043b\u0433\u043e\u0433\u043e \u0440\u0430\u0437\u0434\u0443\u043c\u044c\u044f, \u0432\u044b\u0440\u0438\u0441\u043e\u0432\u044b\u0432\u0430\u0435\u0442\u0441\u044f \u0442\u0430\u043a\u043e\u0439 \u0441\u0438\u043d\u0442\u0430\u043a\u0441\u0438\u0441:  <\/p>\n<pre><code class=\"cpp\">(proc_name0, \/\/ \u0438\u043c\u044f \u043f\u0440\u043e\u0446\u0435\u0434\u0443\u0440\u044b    (signature_arg0, signature_arg1, signature_argN) \/\/ \u043f\u0435\u0440\u0432\u0430\u044f \u0432\u0435\u0440\u0441\u0438\u044f \u043f\u0440\u043e\u0446\u0435\u0434\u0443\u0440\u044b    (signature_arg0) \/\/ \u0432\u0442\u043e\u0440\u0430\u044f \u0432\u0435\u0440\u0441\u0438\u044f \u043f\u0440\u043e\u0446\u0435\u0434\u0443\u0440\u044b ) (proc_name1, \/\/ \u0438\u043c\u044f \u043f\u0440\u043e\u0446\u0435\u0434\u0443\u0440\u044b    (signature_arg0, signature_arg1) \/\/ \u0435\u0434\u0438\u043d\u0441\u0442\u0432\u0435\u043d\u043d\u0430\u044f \u0432\u0435\u0440\u0441\u0438\u044f \u044d\u0442\u043e\u0439 \u043f\u0440\u043e\u0446\u0435\u0434\u0443\u0440\u044b ) (proc_name2, \/\/ \u0438\u043c\u044f \u043f\u0440\u043e\u0446\u0435\u0434\u0443\u0440\u044b    () \/\/ \u0435\u0434\u0438\u043d\u0441\u0442\u0432\u0435\u043d\u043d\u0430\u044f \u0432\u0435\u0440\u0441\u0438\u044f \u044d\u0442\u043e\u0439 \u043f\u0440\u043e\u0446\u0435\u0434\u0443\u0440\u044b (\u0431\u0435\u0437 \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442\u043e\u0432) ) <\/code><\/pre>\n<p>  \u041d\u0443\u2026 \u0432\u0435\u0441\u044c\u043c\u0430 \u0443\u043f\u043e\u0442\u0440\u0438\u0431\u0438\u0442\u0435\u043b\u044c\u043d\u043e, \u043e\u0434\u043d\u0430\u043a\u043e.<\/p>\n<h4>\u041d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0434\u0435\u0442\u0430\u043b\u0438 \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438<\/h4>\n<p>  \u0422.\u043a. \u043e\u0434\u043d\u043e \u0438\u0437 \u0442\u0440\u0435\u0431\u043e\u0432\u0430\u043d\u0438\u0439 \u2014 \u0432\u0435\u0440\u0441\u0438\u043e\u043d\u043d\u043e\u0441\u0442\u044c \u043f\u0440\u043e\u0446\u0435\u0434\u0443\u0440, \u0434\u0430 \u0435\u0449\u0435 \u0438 \u0442\u0430\u043a\u0430\u044f, \u0447\u0442\u043e\u0431 \u043d\u0435 \u043b\u043e\u043c\u0430\u043b\u0430\u0441\u044c \u0441\u043e\u0432\u043c\u0435\u0441\u0442\u0438\u043c\u043e\u0441\u0442\u044c \u0441 \u0443\u0436\u0435 \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u044e\u0449\u0438\u043c\u0438 \u043a\u043b\u0438\u0435\u043d\u0442\u0430\u043c\u0438 \u2014 \u043d\u0430\u043c, \u0434\u043b\u044f \u0438\u0434\u0435\u043d\u0442\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u0438 \u043f\u0440\u043e\u0446\u0435\u0434\u0443\u0440, \u043f\u043e\u043d\u0430\u0434\u043e\u0431\u044f\u0442\u0441\u044f \u0434\u0432\u0430 ID`\u0430. \u041f\u0435\u0440\u0432\u044b\u0439 \u2014 ID \u043f\u0440\u043e\u0446\u0435\u0434\u0443\u0440\u044b, \u0432\u0442\u043e\u0440\u043e\u0439 \u2014 ID \u0432\u0435\u0440\u0441\u0438\u0438.<\/p>\n<p>  \u041f\u043e\u044f\u0441\u043d\u044e \u043d\u0430 \u043f\u0440\u0438\u043c\u0435\u0440\u0435.<br \/>  \u0414\u043e\u043f\u0443\u0441\u0442\u0438\u043c, \u044d\u0442\u043e \u043e\u043f\u0438\u0441\u0430\u043d\u0438\u0435 API \u043d\u0430\u0448\u0435\u0433\u043e \u0441\u0435\u0440\u0432\u0438\u0441\u0430. \u0414\u043e\u043f\u0443\u0441\u0442\u0438\u043c, \u0443 \u043d\u0430\u0441 \u0443\u0436\u0435 \u0435\u0441\u0442\u044c \u043a\u043b\u0438\u0435\u043d\u0442\u0441\u043a\u0438\u0435 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u044b, \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044e\u0449\u0438\u0435 \u044d\u0442\u043e\u0442 API.  <\/p>\n<pre><code class=\"cpp\">(proc_name0, \/\/ procID=0    (signature_arg0, signature_arg1) \/\/ sigID=0 ) (proc_name1, \/\/ procID=1    (signature_arg0, signature_arg1) \/\/ sigID=0 ) (proc_name2, \/\/ procID=2    () \/\/ sigID=0 ) <\/code><\/pre>\n<p>  \u0422\u0435\u043f\u0435\u0440\u044c, \u0434\u043b\u044f <code>proc_name0()<\/code> \u043d\u0430\u043c \u043d\u0443\u0436\u043d\u043e \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u0435\u0449\u0435 \u043e\u0434\u043d\u0443 \u0432\u0435\u0440\u0441\u0438\u044e \u0441 \u0434\u0440\u0443\u0433\u043e\u0439 \u0441\u0438\u0433\u043d\u0430\u0442\u0443\u0440\u043e\u0439.  <\/p>\n<pre><code class=\"cpp\">(proc_name0, \/\/ procID=0    (signature_arg0, signature_arg1) \/\/ sigID=0    (signature_arg0, signature_arg1, signature_arg2) \/\/ sigID=1 ) (proc_name1, \/\/ procID=1    (signature_arg0, signature_arg1) \/\/ sigID=0 ) (proc_name2, \/\/ procID=2    () \/\/ sigID=0 ) <\/code><\/pre>\n<p>  \u0422\u0430\u043a\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c, \u0443 \u043d\u0430\u0441 \u043f\u043e\u044f\u0432\u0438\u043b\u0441\u044f \u043d\u043e\u0432\u044b\u0439 ID \u0432\u0435\u0440\u0441\u0438\u0438 \u043f\u0440\u043e\u0446\u0435\u0434\u0443\u0440\u044b, \u0432 \u0442\u043e \u0432\u0440\u0435\u043c\u044f \u043a\u0430\u043a \u043f\u0440\u0435\u0436\u043d\u0438\u0439 \u043e\u0441\u0442\u0430\u043b\u0441\u044f \u0431\u0435\u0437 \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u0439.<br \/>  \u0411\u044b\u043b\u043e: (0:0), \u0441\u0442\u0430\u043b\u043e: (0:0)(0:1)<br \/>  \u0422.\u0435. \u0438\u043c\u0435\u043d\u043d\u043e \u044d\u0442\u043e\u0433\u043e \u043c\u044b \u0438 \u043f\u044b\u0442\u0430\u043b\u0438\u0441\u044c \u0434\u043e\u0431\u0438\u0442\u044c\u0441\u044f. \u041f\u0440\u0435\u0436\u043d\u0438\u0435 \u043a\u043b\u0438\u0435\u043d\u0442\u044b \u043a\u0430\u043a \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043b\u0438 (0:0), \u0442\u0430\u043a \u0438 \u0434\u0430\u043b\u0435\u0435 \u0431\u0443\u0434\u0443\u0442 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u044d\u0442\u0438 \u0438\u0434\u0435\u043d\u0442\u0438\u0444\u0438\u043a\u0430\u0442\u043e\u0440\u044b, \u043d\u0435 \u043f\u0435\u0440\u0435\u0436\u0438\u0432\u0430\u044f \u043e \u0442\u043e\u043c, \u0447\u0442\u043e \u043f\u043e\u044f\u0432\u0438\u043b\u0438\u0441\u044c \u043d\u043e\u0432\u044b\u0435 \u0432\u0435\u0440\u0441\u0438\u0438 \u044d\u0442\u0438\u0445 \u043f\u0440\u043e\u0446\u0435\u0434\u0443\u0440.<br \/>  \u0422\u0430\u043a\u0436\u0435 \u0443\u0441\u043b\u043e\u0432\u0438\u043c\u0441\u044f \u0432 \u0442\u043e\u043c, \u0447\u0442\u043e \u0432\u0441\u0435 \u043d\u043e\u0432\u044b\u0435 \u043f\u0440\u043e\u0446\u0435\u0434\u0443\u0440\u044b \u043d\u0443\u0436\u043d\u043e \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u0442\u044c \u0432 \u043a\u043e\u043d\u0435\u0446.<\/p>\n<p>  \u0414\u0430\u043b\u0435\u0435, \u043d\u0430\u043c \u043d\u0443\u0436\u043d\u043e \u043f\u043e\u0437\u0430\u0431\u043e\u0442\u0438\u0442\u044c\u0441\u044f \u043e \u0442\u043e\u043c, \u0447\u0442\u043e\u0431 ID`\u044b \u0430\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438 \u043f\u0440\u043e\u0441\u0442\u0430\u0432\u043b\u044f\u043b\u0438\u0441\u044c \u043d\u0430 \u043e\u0431\u043e\u0438\u0445 \u0441\u0442\u043e\u0440\u043e\u043d\u0430\u0445 \u0441\u0435\u0440\u0432\u0438\u0441\u0430. \u0417\u0430\u043f\u0440\u043e\u0441\u0442\u043e! \u2014 \u043f\u0440\u043e\u0441\u0442\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c \u043e\u0434\u043d\u0443 \u0438 \u0442\u0443 \u0436\u0435 \u043e\u043f\u0438\u0441\u0430\u043d\u043d\u0443\u044e \u043f\u043e\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u044c \u0434\u0432\u0430\u0436\u0434\u044b, \u0434\u043b\u044f \u0433\u0435\u043d\u0435\u0440\u0430\u0446\u0438\u0438 \u043a\u043b\u0438\u0435\u043d\u0442\u0441\u043a\u043e\u0439 \u0438 \u0441\u0435\u0440\u0432\u0435\u0440\u043d\u043e\u0439 \u0441\u0442\u043e\u0440\u043e\u043d!<\/p>\n<p>  \u0421\u0430\u043c\u043e\u0435 \u0432\u0440\u0435\u043c\u044f \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u0438\u0442\u044c, \u043a\u0430\u043a \u043c\u044b \u0445\u043e\u0442\u0438\u043c \u0432\u0438\u0434\u0435\u0442\u044c \u0432\u0441\u0435 \u044d\u0442\u043e \u0432 \u043a\u043e\u043d\u0435\u0447\u043d\u043e\u043c \u0441\u0447\u0435\u0442\u0435:  <\/p>\n<pre><code class=\"cpp\">MACRO( \tclient_invoker, \/\/ name of the client invoker implementation class \t((registration, \/\/ procedure name \t\t((std::string, std::string)) \/\/ message : registration key \t)) \t((activation, \t\t((std::string)) \/\/ message \t)) \t((login, \t\t((std::string)) \/\/ message \t)) \t((logout, \t\t((std::string)) \/\/ message \t)) \t((users_online, \t\t((std::vector&lt;std::string&gt;)) \/\/ without args \t)) \t, \tserver_invoker, \/\/ name of the server invoker implementation class \t((registration, \t\t((std::string)) \/\/ username \t)) \t((activation, \t\t((std::string, std::string, std::string)) \/\/ registration key : username : password \t)) \t((login, \t\t((std::string, std::string)) \/\/ username : password \t)) \t((logout, \t\t(()) \/\/ without args \t)) \t((users_online, \t\t(()) \/\/ without args \t)) ) <\/code><\/pre>\n<p>  \u0427\u0442\u043e\u0431 \u043d\u0435 \u0431\u044b\u043b\u043e \u043f\u0443\u0442\u0430\u043d\u0438\u0446\u044b \u0432 \u0442\u043e\u043c, \u043a\u0442\u043e \u0432\u0435\u0434\u0443\u0449\u0438\u0439, \u0430 \u043a\u0442\u043e \u0432\u0435\u0434\u043e\u043c\u044b\u0439 \u2014 \u0443\u0441\u043b\u043e\u0432\u0438\u043c\u0441\u044f \u0442\u0430\u043a, \u0447\u0442\u043e \u043f\u0440\u043e\u0446\u0435\u0434\u0443\u0440\u044b, \u043e\u043f\u0438\u0441\u044b\u0432\u0430\u0435\u043c\u044b\u0435 \u043d\u0430 \u043e\u0434\u043d\u043e\u0439 \u0438\u0437 \u0441\u0442\u043e\u0440\u043e\u043d, \u044f\u0432\u043b\u044f\u044e\u0442\u0441\u044f \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f\u043c\u0438, \u043d\u0430\u0445\u043e\u0434\u044f\u0449\u0438\u043c\u0438\u0441\u044f \u043d\u0430 \u043f\u0440\u043e\u0442\u0438\u0432\u043e\u043f\u043e\u043b\u043e\u0436\u043d\u043e\u0439 \u0441\u0442\u043e\u0440\u043e\u043d\u0435. \u0422.\u0435., \u043a \u043f\u0440\u0438\u043c\u0435\u0440\u0443, <code>client_invoker::registration(std::string, std::string)<\/code> \u0433\u043e\u0432\u043e\u0440\u0438\u0442 \u043d\u0430\u043c \u043e \u0442\u043e\u043c, \u0447\u0442\u043e \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f \u044d\u0442\u043e\u0439 \u043f\u0440\u043e\u0446\u0435\u0434\u0443\u0440\u044b \u0431\u0443\u0434\u0435\u0442 \u043d\u0430\u0445\u043e\u0434\u0438\u0442\u044c\u0441\u044f \u043d\u0430 \u0441\u0442\u043e\u0440\u043e\u043d\u0435 \u0441\u0435\u0440\u0432\u0435\u0440\u0430, \u0432 \u0442\u043e \u0432\u0440\u0435\u043c\u044f \u043a\u0430\u043a \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441 \u043a \u044d\u0442\u043e\u0439 \u043f\u0440\u043e\u0446\u0435\u0434\u0443\u0440\u0435 \u0431\u0443\u0434\u0435\u0442 \u043d\u0430\u0445\u043e\u0434\u0438\u0442\u044c\u0441\u044f \u043d\u0430 \u0441\u0442\u043e\u0440\u043e\u043d\u0435 \u043a\u043b\u0438\u0435\u043d\u0442\u0430, \u0438 \u043d\u0430\u043e\u0431\u043e\u0440\u043e\u0442.<br \/>  (\u0434\u0432\u043e\u0439\u043d\u044b\u0435 \u043a\u0440\u0443\u0433\u043b\u044b\u0435 \u0441\u043a\u043e\u0431\u043a\u0438 \u043c\u044b \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c \u043f\u043e\u0442\u043e\u043c\u0443, \u0447\u0442\u043e \u043f\u0440\u0435\u043f\u0440\u043e\u0446\u0435\u0441\u0441\u043e\u0440 \u043f\u0440\u0438 \u0444\u043e\u0440\u043c\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0438 \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442\u0430 \u0434\u043b\u044f \u043d\u0430\u0448\u0435\u0433\u043e MACRO(), \u0440\u0430\u0437\u0432\u0435\u0440\u043d\u0435\u0442 \u043d\u0430\u043c\u0438 \u043e\u043f\u0438\u0441\u0430\u043d\u043d\u043e\u0435 API. \u044d\u0442\u043e \u043c\u043e\u0436\u043d\u043e \u043f\u043e\u0431\u043e\u0440\u043e\u0442\u044c, \u043d\u043e \u043d\u0435 \u0437\u043d\u0430\u044e, \u043d\u0443\u0436\u043d\u043e \u043b\u0438?..)<\/p>\n<h4>\u0418\u0442\u043e\u0433<\/h4>\n<p>  \u0418\u0437 \u043f\u0440\u0438\u0432\u0435\u0434\u0435\u043d\u043d\u043e\u0433\u043e \u0432\u044b\u0448\u0435 \u043c\u0430\u043a\u0440\u043e\u0432\u044b\u0437\u043e\u0432\u0430, \u0431\u0443\u0434\u0435\u0442 \u0441\u0433\u0435\u043d\u0435\u0440\u0438\u0440\u043e\u0432\u0430\u043d \u043a\u043e\u0434, \u043d\u0430\u0445\u043e\u0434\u044f\u0449\u0438\u0439\u0441\u044f \u043f\u043e\u0434 \u0441\u043f\u043e\u0439\u043b\u0435\u0440\u043e\u043c.  <\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">\u041a\u043e\u0434<\/b><\/p>\n<div class=\"spoiler_text\">\n<pre><code class=\"cpp\">namespace yarmi {  template&lt;typename Impl, typename IO = Impl&gt; struct client_invoker { \tclient_invoker(Impl &impl, IO &io) \t\t:impl(impl) \t\t,io(io) \t{} \t \tvoid registration(const std::string &arg0) { \t\tyas::binary_mem_oarchive oa(yas::no_header); \t\toa & static_cast&lt;std::uint8_t&gt;(0) \t\t\t& static_cast&lt;std::uint8_t&gt;(0) \t\t\t& arg0; \t\tyas::binary_mem_oarchive pa; \t\tpa & oa.get_intrusive_buffer(); \t\tio.send(pa.get_shared_buffer()); \t} \tvoid activation(const std::string &arg0, const std::string &arg1, const std::string &arg2) { \t\tyas::binary_mem_oarchive oa(yas::no_header); \t\toa & static_cast&lt;std::uint8_t&gt;(1) \t\t\t& static_cast&lt;std::uint8_t&gt;(0) \t\t\t& arg0 \t\t\t& arg1 \t\t\t& arg2; \t\tyas::binary_mem_oarchive pa; \t\tpa & oa.get_intrusive_buffer(); \t\tio.send(pa.get_shared_buffer()); \t} \tvoid login(const std::string &arg0, const std::string &arg1) { \t\tyas::binary_mem_oarchive oa(yas::no_header); \t\toa & static_cast&lt;std::uint8_t&gt;(2) \t\t\t& static_cast&lt;std::uint8_t&gt;(0) \t\t\t& arg0 \t\t\t& arg1; \t\tyas::binary_mem_oarchive pa; \t\tpa & oa.get_intrusive_buffer(); \t\tio.send(pa.get_shared_buffer()); \t} \tvoid logout() { \t\tyas::binary_mem_oarchive oa(yas::no_header); \t\toa & static_cast&lt;std::uint8_t&gt;(3) \t\t\t& static_cast&lt;std::uint8_t&gt;(0); \t\tyas::binary_mem_oarchive pa; \t\tpa & oa.get_intrusive_buffer(); \t\tio.send(pa.get_shared_buffer()); \t} \tvoid users_online() { \t\tyas::binary_mem_oarchive oa(yas::no_header); \t\toa & static_cast&lt;std::uint8_t&gt;(4) \t\t\t& static_cast&lt;std::uint8_t&gt;(0); \t\tyas::binary_mem_oarchive pa; \t\tpa & oa.get_intrusive_buffer(); \t\tio.send(pa.get_shared_buffer()); \t} \tvoid yarmi_error(const std::uint8_t &arg0, const std::uint8_t &arg1, const std::string &arg2) { \t\tyas::binary_mem_oarchive oa(yas::no_header); \t\toa & static_cast&lt;std::uint8_t&gt;(5) \t\t\t& static_cast&lt;std::uint8_t&gt;(0) \t\t\t& arg0 \t\t\t& arg1 \t\t\t& arg2; \t\tyas::binary_mem_oarchive pa; \t\tpa & oa.get_intrusive_buffer(); \t\tio.send(pa.get_shared_buffer()); \t} \tvoid invoke(const char *ptr, std::size_t size) { \t\tstd::uint8_t call_id, call_version; \t\tstatic const char* names[] = { \t\t\t &quot;registration&quot; \t\t\t,&quot;activation&quot; \t\t\t,&quot;login&quot; \t\t\t,&quot;logout&quot; \t\t\t,&quot;users_online&quot; \t\t\t,&quot;yarmi_error&quot; \t\t}; \t\tstatic const std::uint8_t versions[] = { 0, 0, 0, 0, 0, 0 }; \t\ttry { \t\t\tyas::binary_mem_iarchive ia(ptr, size, yas::no_header); \t\t\tia & call_id \t\t\t\t& call_version; \t\t\t \t\t\tif ( call_id &lt; 0 || call_id &gt; 5 ) { \t\t\t\tchar errstr[1024] = {0}; \t\t\t\tstd::snprintf( \t\t\t\t\t errstr \t\t\t\t\t,sizeof(errstr) \t\t\t\t\t,&quot;%s::%s(): bad call_id %d&quot; \t\t\t\t\t,&quot;client_invoker&quot; \t\t\t\t\t,__FUNCTION__ \t\t\t\t\t,static_cast&lt;int&gt;(call_id) \t\t\t\t); \t\t\t\tthrow std::runtime_error(errstr); \t\t\t} \t\t\tif ( call_version &gt; versions[call_id] ) { \t\t\t\tchar errstr[1024] = {0}; \t\t\t\tstd::snprintf( \t\t\t\t\t errstr \t\t\t\t\t,sizeof(errstr) \t\t\t\t\t,&quot;%s::%s(): bad call_version %d for call_id %d(%s::%s())&quot; \t\t\t\t\t,&quot;client_invoker&quot; \t\t\t\t\t,__FUNCTION__ \t\t\t\t\t,static_cast&lt;int&gt;(call_version) \t\t\t\t\t,static_cast&lt;int&gt;(call_id) \t\t\t\t\t,&quot;client_invoker&quot; \t\t\t\t\t,names[call_id] \t\t\t\t); \t\t\t\tthrow std::runtime_error(errstr); \t\t\t} \t\t\t \t\t\tswitch ( call_id ) { \t\t\t\tcase 0: { \t\t\t\t\tswitch ( call_version ) { \t\t\t\t\t\tcase 0: { \t\t\t\t\t\t\tstd::string arg0; \t\t\t\t\t\t\tstd::string arg1; \t\t\t\t\t\t\tia & arg0 \t\t\t\t\t\t\t\t& arg1; \t\t\t\t\t\t\t \t\t\t\t\t\t\timpl.on_registration(arg0, arg1); \t\t\t\t\t\t}; \t\t\t\t\t\tbreak; \t\t\t\t\t} \t\t\t\t}; \t\t\t\tbreak; \t\t\t\tcase 1: { \t\t\t\t\tswitch ( call_version ) { \t\t\t\t\t\tcase 0: { \t\t\t\t\t\t\tstd::string arg0; \t\t\t\t\t\t\tia & arg0; \t\t\t\t\t\t\t \t\t\t\t\t\t\timpl.on_activation(arg0); \t\t\t\t\t\t}; \t\t\t\t\t\tbreak; \t\t\t\t\t} \t\t\t\t}; \t\t\t\tbreak; \t\t\t\tcase 2: { \t\t\t\t\tswitch ( call_version ) { \t\t\t\t\t\tcase 0: { \t\t\t\t\t\t\tstd::string arg0; \t\t\t\t\t\t\tia & arg0; \t\t\t\t\t\t\t \t\t\t\t\t\t\timpl.on_login(arg0); \t\t\t\t\t\t}; \t\t\t\t\t\tbreak; \t\t\t\t\t} \t\t\t\t}; \t\t\t\tbreak; \t\t\t\tcase 3: { \t\t\t\t\tswitch ( call_version ) { \t\t\t\t\t\tcase 0: { \t\t\t\t\t\t\tstd::string arg0; \t\t\t\t\t\t\tia & arg0; \t\t\t\t\t\t\t \t\t\t\t\t\t\timpl.on_logout(arg0); \t\t\t\t\t\t}; \t\t\t\t\t\tbreak; \t\t\t\t\t} \t\t\t\t}; \t\t\t\tbreak; \t\t\t\tcase 4: { \t\t\t\t\tswitch ( call_version ) { \t\t\t\t\t\tcase 0: { \t\t\t\t\t\t\tstd::vector&lt;std::string&gt; arg0; \t\t\t\t\t\t\tia & arg0; \t\t\t\t\t\t\t \t\t\t\t\t\t\timpl.on_users_online(arg0); \t\t\t\t\t\t}; \t\t\t\t\t\tbreak; \t\t\t\t\t} \t\t\t\t}; \t\t\t\tbreak; \t\t\t\tcase 5: { \t\t\t\t\tswitch ( call_version ) { \t\t\t\t\t\tcase 0: { \t\t\t\t\t\t\tstd::uint8_t arg0; \t\t\t\t\t\t\tstd::uint8_t arg1; \t\t\t\t\t\t\tstd::string arg2; \t\t\t\t\t\t\tia & arg0 \t\t\t\t\t\t\t\t& arg1 \t\t\t\t\t\t\t\t& arg2; \t\t\t\t\t\t\t \t\t\t\t\t\t\timpl.on_yarmi_error(arg0, arg1, arg2); \t\t\t\t\t\t}; \t\t\t\t\t\tbreak; \t\t\t\t\t} \t\t\t\t}; \t\t\t\tbreak; \t\t\t} \t\t} catch (const std::exception &ex) { \t\t\tchar errstr[1024] = {0}; \t\t\tstd::snprintf( \t\t\t\t errstr \t\t\t\t,sizeof(errstr) \t\t\t\t,&quot;std::exception is thrown when %s::%s() is called: '%s'&quot; \t\t\t\t,&quot;client_invoker&quot; \t\t\t\t,names[call_id] \t\t\t\t,ex.what() \t\t\t); \t\t\tyarmi_error(call_id, call_version, errstr); \t\t} catch (...) { \t\t\tchar errstr[1024] = {0}; \t\t\tstd::snprintf( \t\t\t\t errstr \t\t\t\t,sizeof(errstr) \t\t\t\t,&quot;unknown exception is thrown when %s::%s() is called&quot; \t\t\t\t,&quot;client_invoker&quot; \t\t\t\t,names[call_id] \t\t\t); \t\t\tyarmi_error(call_id, call_version, errstr); \t\t} \t} private: \tImpl &impl; \tIO &io; }; \/\/ struct client_invoker  template&lt;typename Impl, typename IO = Impl&gt; struct server_invoker { \tserver_invoker(Impl &impl, IO &io) \t\t:impl(impl) \t\t,io(io) \t{} \t \tvoid registration(const std::string &arg0, const std::string &arg1) { \t\tyas::binary_mem_oarchive oa(yas::no_header); \t\toa & static_cast&lt;std::uint8_t&gt;(0) \t\t\t& static_cast&lt;std::uint8_t&gt;(0) \t\t\t& arg0 \t\t\t& arg1; \t\tyas::binary_mem_oarchive pa; \t\tpa & oa.get_intrusive_buffer(); \t\tio.send(pa.get_shared_buffer()); \t} \tvoid activation(const std::string &arg0) { \t\tyas::binary_mem_oarchive oa(yas::no_header); \t\toa & static_cast&lt;std::uint8_t&gt;(1) \t\t\t& static_cast&lt;std::uint8_t&gt;(0) \t\t\t& arg0; \t\tyas::binary_mem_oarchive pa; \t\tpa & oa.get_intrusive_buffer(); \t\tio.send(pa.get_shared_buffer()); \t} \tvoid login(const std::string &arg0) { \t\tyas::binary_mem_oarchive oa(yas::no_header); \t\toa & static_cast&lt;std::uint8_t&gt;(2) \t\t\t& static_cast&lt;std::uint8_t&gt;(0) \t\t\t& arg0; \t\tyas::binary_mem_oarchive pa; \t\tpa & oa.get_intrusive_buffer(); \t\tio.send(pa.get_shared_buffer()); \t} \tvoid logout(const std::string &arg0) { \t\tyas::binary_mem_oarchive oa(yas::no_header); \t\toa & static_cast&lt;std::uint8_t&gt;(3) \t\t\t& static_cast&lt;std::uint8_t&gt;(0) \t\t\t& arg0; \t\tyas::binary_mem_oarchive pa; \t\tpa & oa.get_intrusive_buffer(); \t\tio.send(pa.get_shared_buffer()); \t} \tvoid users_online(const std::vector&lt;std::string&gt; &arg0) { \t\tyas::binary_mem_oarchive oa(yas::no_header); \t\toa & static_cast&lt;std::uint8_t&gt;(4) \t\t\t& static_cast&lt;std::uint8_t&gt;(0) \t\t\t& arg0; \t\tyas::binary_mem_oarchive pa; \t\tpa & oa.get_intrusive_buffer(); \t\tio.send(pa.get_shared_buffer()); \t} \tvoid yarmi_error(const std::uint8_t &arg0, const std::uint8_t &arg1, const std::string &arg2) { \t\tyas::binary_mem_oarchive oa(yas::no_header); \t\toa & static_cast&lt;std::uint8_t&gt;(5) \t\t\t& static_cast&lt;std::uint8_t&gt;(0) \t\t\t& arg0 \t\t\t& arg1 \t\t\t& arg2; \t\tyas::binary_mem_oarchive pa; \t\tpa & oa.get_intrusive_buffer(); \t\tio.send(pa.get_shared_buffer()); \t} \t \tvoid invoke(const char *ptr, std::size_t size) { \t\tstd::uint8_t call_id, call_version; \t\tstatic const char* names[] = { \t\t\t &quot;registration&quot; \t\t\t,&quot;activation&quot; \t\t\t,&quot;login&quot; \t\t\t,&quot;logout&quot; \t\t\t,&quot;users_online&quot; \t\t\t,&quot;yarmi_error&quot; \t\t}; \t\tstatic const std::uint8_t versions[] = { 0, 0, 0, 0, 0, 0 }; \t\t \t\ttry { \t\t\tyas::binary_mem_iarchive ia(ptr, size, yas::no_header); \t\t\tia & call_id \t\t\t\t& call_version; \t\t\t \t\t\tif ( call_id &lt; 0 || call_id &gt; 5 ) { \t\t\t\tchar errstr[1024] = {0}; \t\t\t\tstd::snprintf( \t\t\t\t\t errstr \t\t\t\t\t,sizeof(errstr) \t\t\t\t\t,&quot;%s::%s(): bad call_id %d&quot; \t\t\t\t\t,&quot;server_invoker&quot; \t\t\t\t\t,__FUNCTION__ \t\t\t\t\t,static_cast&lt;int&gt;(call_id) \t\t\t\t); \t\t\t\tthrow std::runtime_error(errstr); \t\t\t} \t\t\tif ( call_version &gt; versions[call_id] ) { \t\t\t\tchar errstr[1024] = {0}; \t\t\t\tstd::snprintf( \t\t\t\t\t errstr \t\t\t\t\t,sizeof(errstr) \t\t\t\t\t,&quot;%s::%s(): bad call_version %d for call_id %d(%s::%s())&quot; \t\t\t\t\t,&quot;server_invoker&quot; \t\t\t\t\t,__FUNCTION__ \t\t\t\t\t,static_cast&lt;int&gt;(call_version) \t\t\t\t\t,static_cast&lt;int&gt;(call_id) \t\t\t\t\t,&quot;server_invoker&quot; \t\t\t\t\t,names[call_id] \t\t\t\t); \t\t\t\tthrow std::runtime_error(errstr); \t\t\t} \t\t\t \t\t\tswitch ( call_id ) { \t\t\t\tcase 0: { \t\t\t\t\tswitch ( call_version ) { \t\t\t\t\t\tcase 0: { \t\t\t\t\t\t\tstd::string arg0; \t\t\t\t\t\t\tia & arg0; \t\t\t\t\t\t\t \t\t\t\t\t\t\timpl.on_registration(arg0); \t\t\t\t\t\t}; \t\t\t\t\t\tbreak; \t\t\t\t\t} \t\t\t\t}; \t\t\t\tbreak; \t\t\t\tcase 1: { \t\t\t\t\tswitch ( call_version ) { \t\t\t\t\t\tcase 0: { \t\t\t\t\t\t\tstd::string arg0; \t\t\t\t\t\t\tstd::string arg1; \t\t\t\t\t\t\tstd::string arg2; \t\t\t\t\t\t\tia & arg0 \t\t\t\t\t\t\t\t& arg1 \t\t\t\t\t\t\t\t& arg2; \t\t\t\t\t\t\t \t\t\t\t\t\t\timpl.on_activation(arg0, arg1, arg2); \t\t\t\t\t\t}; \t\t\t\t\t\tbreak; \t\t\t\t\t} \t\t\t\t}; \t\t\t\tbreak; \t\t\t\tcase 2: { \t\t\t\t\tswitch ( call_version ) { \t\t\t\t\t\tcase 0: { \t\t\t\t\t\t\tstd::string arg0; \t\t\t\t\t\t\tstd::string arg1; \t\t\t\t\t\t\tia & arg0 \t\t\t\t\t\t\t\t& arg1; \t\t\t\t\t\t\t \t\t\t\t\t\t\timpl.on_login(arg0, arg1); \t\t\t\t\t\t}; \t\t\t\t\t\tbreak; \t\t\t\t\t} \t\t\t\t}; \t\t\t\tbreak; \t\t\t\tcase 3: { \t\t\t\t\tswitch ( call_version ) { \t\t\t\t\t\tcase 0: { \t\t\t\t\t\t\timpl.on_logout(); \t\t\t\t\t\t}; \t\t\t\t\t\tbreak; \t\t\t\t\t} \t\t\t\t}; \t\t\t\tbreak; \t\t\t\tcase 4: { \t\t\t\t\tswitch ( call_version ) { \t\t\t\t\t\tcase 0: { \t\t\t\t\t\t\timpl.on_users_online(); \t\t\t\t\t\t}; \t\t\t\t\t\tbreak; \t\t\t\t\t} \t\t\t\t}; \t\t\t\tbreak; \t\t\t\tcase 5: { \t\t\t\t\tswitch ( call_version ) { \t\t\t\t\t\tcase 0: { \t\t\t\t\t\t\tstd::uint8_t arg0; \t\t\t\t\t\t\tstd::uint8_t arg1; \t\t\t\t\t\t\tstd::string arg2; \t\t\t\t\t\t\tia & arg0 \t\t\t\t\t\t\t\t& arg1 \t\t\t\t\t\t\t\t& arg2; \t\t\t\t\t\t\t \t\t\t\t\t\t\timpl.on_yarmi_error(arg0, arg1, arg2); \t\t\t\t\t\t}; \t\t\t\t\t\tbreak; \t\t\t\t\t} \t\t\t\t}; \t\t\t\tbreak; \t\t\t} \t\t} catch (const std::exception &ex) { \t\t\tchar errstr[1024] = {0}; \t\t\tstd::snprintf( \t\t\t\t errstr \t\t\t\t,sizeof(errstr) \t\t\t\t,&quot;std::exception is thrown when %s::%s() is called: '%s'&quot; \t\t\t\t,&quot;server_invoker&quot; \t\t\t\t,names[call_id] \t\t\t\t,ex.what() \t\t\t); \t\t\tyarmi_error(call_id, call_version, errstr); \t\t} catch (...) { \t\t\tchar errstr[1024] = {0}; \t\t\tstd::snprintf( \t\t\t\t errstr \t\t\t\t,sizeof(errstr) \t\t\t\t,&quot;unknown exception is thrown when %s::%s() is called&quot; \t\t\t\t,&quot;server_invoker&quot; \t\t\t\t,names[call_id] \t\t\t); \t\t\tyarmi_error(call_id, call_version, errstr); \t\t} \t} private: \tImpl &impl; \tIO &io; }; \/\/ struct server_invoker } \/\/ ns yarmi <\/code><\/pre>\n<p>  <\/div>\n<\/div>\n<p>  (\u0432 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 \u0441\u0435\u0440\u0438\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f \u0434\u0440\u0443\u0433\u043e\u0439 \u043c\u043e\u0439 \u043f\u0440\u043e\u0435\u043a\u0442 \u2014 <a href=\"https:\/\/github.com\/niXman\/yas\">YAS<\/a>)<\/p>\n<p>  \u041a\u0430\u043a \u0431\u043e\u043d\u0443\u0441, \u0431\u044b\u043b\u0430 \u0434\u043e\u0431\u0430\u0432\u043b\u0435\u043d\u0430 \u0441\u0438\u0441\u0442\u0435\u043c\u043d\u0430\u044f \u043f\u0440\u043e\u0446\u0435\u0434\u0443\u0440\u0430 <code>yarmi_error()<\/code> \u2014 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f \u0434\u043b\u044f \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u044f \u043f\u0440\u043e\u0442\u0438\u0432\u043e\u043f\u043e\u043b\u043e\u0436\u043d\u043e\u0439 \u0441\u0442\u043e\u0440\u043e\u043d\u0435 \u043e \u0442\u043e\u043c, \u0447\u0442\u043e \u043f\u0440\u0438 \u043f\u043e\u043f\u044b\u0442\u043a\u0435 \u043f\u0440\u043e\u0438\u0437\u0432\u0435\u0441\u0442\u0438 \u0432\u044b\u0437\u043e\u0432 \u043f\u0440\u043e\u0438\u0437\u043e\u0448\u043b\u0430 \u043e\u0448\u0438\u0431\u043a\u0430. \u041f\u043e\u0441\u043c\u043e\u0442\u0440\u0438\u0442\u0435 \u0432\u043d\u0438\u043c\u0430\u0442\u0435\u043b\u044c\u043d\u043e, <code>\u0432 client_invoker::invoke()<\/code>, \u0434\u0435\u0441\u0435\u0440\u0438\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f \u0438 \u0432\u044b\u0437\u043e\u0432 \u043e\u0431\u0435\u0440\u043d\u0443\u0442\u044b \u0432 <code>try{}catch()<\/code> \u0431\u043b\u043e\u043a, \u0430 \u0432 <code>catch()<\/code> \u0431\u043b\u043e\u043a\u0430\u0445 \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u0441\u044f \u0432\u044b\u0437\u043e\u0432 <code>yarmi_error()<\/code>. \u0422\u0430\u043a\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c, \u0435\u0441\u043b\u0438 \u043f\u0440\u0438 \u0434\u0435\u0441\u0435\u0440\u0438\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 \u0438\u043b\u0438 \u0432\u044b\u0437\u043e\u0432\u0435 \u043f\u0440\u043e\u0446\u0435\u0434\u0443\u0440\u044b \u0432\u043e\u0437\u043d\u0438\u043a\u043d\u0435\u0442 \u0438\u0441\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435 \u2014 \u043e\u043d\u043e \u0431\u0443\u0434\u0435\u0442 \u0443\u0441\u043f\u0435\u0448\u043d\u043e \u043f\u0435\u0440\u0435\u0445\u0432\u0430\u0447\u0435\u043d\u043e <code>catch()<\/code> \u0431\u043b\u043e\u043a\u043e\u043c, \u0438 \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u044f \u043e\u0431 \u0438\u0441\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0438 \u0431\u0443\u0434\u0435\u0442 \u043e\u0442\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0430 \u0432\u044b\u0437\u044b\u0432\u0430\u044e\u0449\u0435\u0439 \u0441\u0442\u043e\u0440\u043e\u043d\u0435. \u0422\u043e \u0436\u0435 \u0441\u0430\u043c\u043e\u0435 \u0431\u0443\u0434\u0435\u0442 \u043f\u0440\u043e\u0438\u0441\u0445\u043e\u0434\u0438\u0442\u044c \u0438 \u0432 \u043f\u0440\u043e\u0442\u0438\u0432\u043e\u043f\u043e\u043b\u043e\u0436\u043d\u043e\u043c \u043d\u0430\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u0438. \u0422.\u0435. \u0435\u0441\u043b\u0438 \u0441\u0435\u0440\u0432\u0435\u0440 \u0432\u044b\u0437\u0432\u0430\u043b \u0443 \u043a\u043b\u0438\u0435\u043d\u0442\u0430 \u043f\u0440\u043e\u0446\u0435\u0434\u0443\u0440\u0443, \u0432 \u0445\u043e\u0434\u0435 \u0432\u044b\u0437\u043e\u0432\u0430 \u043a\u043e\u0442\u043e\u0440\u043e\u0439 \u0432\u043e\u0437\u043d\u0438\u043a\u043b\u043e \u0438\u0441\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435 \u2014 \u043a\u043b\u0438\u0435\u043d\u0442 \u043e\u0442\u043f\u0440\u0430\u0432\u0438\u0442 \u0441\u0435\u0440\u0432\u0435\u0440\u0443 \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u044e \u043e\u0431 \u043e\u0448\u0438\u0431\u043a\u0435, \u0442\u0430\u043a\u0436\u0435 \u0434\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u0441\u043e\u043e\u0431\u0449\u0438\u0432 ID \u0438 \u0432\u0435\u0440\u0441\u0438\u044e \u0432\u044b\u0437\u043e\u0432\u0430, \u0432 \u043a\u043e\u0442\u043e\u0440\u043e\u043c \u0432\u043e\u0437\u043d\u0438\u043a\u043b\u043e \u0438\u0441\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435. \u041d\u043e, \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c <code>yarmi_error()<\/code> \u0432\u044b \u043c\u043e\u0436\u0435\u0442\u0435 \u0438 \u0441\u0430\u043c\u0438, \u043d\u0438\u0447\u0442\u043e \u044d\u0442\u043e\u0433\u043e \u043d\u0435 \u0437\u0430\u043f\u0440\u0435\u0449\u0430\u0435\u0442. \u041f\u0440\u0438\u043c\u0435\u0440: <code>yarmi_error(call_id, version_id, &quot;message&quot;);<\/code><\/p>\n<p>  \u041a\u0430\u043a \u0432\u044b \u043c\u043e\u0433\u043b\u0438 \u0437\u0430\u043c\u0435\u0442\u0438\u0442\u044c, \u043a \u0438\u043c\u0435\u043d\u0430\u043c \u043e\u043f\u0438\u0441\u0430\u043d\u043d\u044b\u0445 \u043d\u0430\u043c\u0438 \u043f\u0440\u043e\u0446\u0435\u0434\u0443\u0440, \u043d\u0430 \u0441\u0442\u043e\u0440\u043e\u043d\u0435 \u0438\u0445 \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u043f\u0440\u0435\u0444\u0438\u043a\u0441 <code>on_<\/code><\/p>\n<p>  \u041a\u043b\u0430\u0441\u0441\u044b <code>client_invoker<\/code> \u0438 <code>server_invoker<\/code> \u043f\u0440\u0438\u043d\u0438\u043c\u0430\u044e\u0442 \u0434\u0432\u0430 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u0430. \u041f\u0435\u0440\u0432\u044b\u0439 \u0438\u0445 \u043d\u0438\u0437 \u2014 \u043a\u043b\u0430\u0441\u0441, \u0432 \u043a\u043e\u0442\u043e\u0440\u043e\u043c \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u043d\u044b \u0432\u044b\u0437\u044b\u0432\u0430\u0435\u043c\u044b\u0435 \u043f\u0440\u043e\u0446\u0435\u0434\u0443\u0440\u044b, \u0432\u0442\u043e\u0440\u043e\u0439 \u2014 \u043a\u043b\u0430\u0441\u0441, \u0432 \u043a\u043e\u0442\u043e\u0440\u043e\u043c \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u043d \u043c\u0435\u0442\u043e\u0434 <code>send(yas::shared_buffer buf)<\/code>.<br \/>  \u0415\u0441\u043b\u0438 \u0443 \u0432\u0430\u0441 \u043e\u0434\u0438\u043d \u0438 \u0442\u043e\u0442 \u0436\u0435 \u043a\u043b\u0430\u0441\u0441 \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0435\u0442 \u043e\u0431\u0435 \u0440\u043e\u043b\u0438, \u0432\u044b \u043c\u043e\u0436\u0435\u0442\u0435 \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u0442\u0430\u043a:  <\/p>\n<pre><code class=\"cpp\">struct client_session: yarmi::client_base&lt;client_session&gt;, yarmi::client_invoker&lt;client_session&gt; {    client_session(boost::asio::io_service &ios)       :yarmi::client_base&lt;client_session&gt;(ios, *this)       ,yarmi::client_invoker&lt;client_session&gt;(*this, *this) \/\/ &lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;    {} }; <\/code><\/pre>\n<p>  \u041a\u043e\u043d\u0435\u0447\u043d\u044b\u0439 \u0432\u0430\u0440\u0438\u0430\u043d\u0442 \u0432\u044b\u0433\u043b\u044f\u0434\u0438\u0442 \u0442\u0430\u043a:  <\/p>\n<pre><code class=\"cpp\">struct client_session: yarmi::client_base&lt;client_session&gt;, yarmi::client_invoker&lt;client_session&gt; {    client_session(boost::asio::io_service &ios);     void on_registration(const std::string &msg, const std::string &regkey);    void on_activation(const std::string &msg);    void on_login(const std::string &msg);    void on_logout(const std::string &msg);    void on_users_online(const std::vector&lt;std::string&gt; &users); }; <\/code><\/pre>\n<p>  \u0418\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441 \u043a \u043f\u0440\u043e\u0442\u0438\u0432\u043e\u043f\u043e\u043b\u043e\u0436\u043d\u043e\u0439 \u0441\u0442\u043e\u0440\u043e\u043d\u0435 \u0431\u0443\u0434\u0435\u0442 \u0443\u043d\u0430\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u043d \u0438\u0437 \u043f\u0440\u0435\u0434\u043a\u0430 <code>yarmi::client_invoker<\/code>. \u0422.\u0435., \u043a \u043f\u0440\u0438\u043c\u0435\u0440\u0443, \u0431\u0443\u0434\u0443\u0447\u0438 \u0432 \u043a\u043e\u043d\u0441\u0442\u0440\u0443\u043a\u0442\u043e\u0440\u0435 \u043d\u0430\u0448\u0435\u0433\u043e <code>client_session<\/code>, \u0432\u044b \u043c\u043e\u0436\u0435\u0442\u0435 \u0432\u044b\u0437\u0432\u0430\u0442\u044c \u043f\u0440\u043e\u0446\u0435\u0434\u0443\u0440\u0443 <code>registration()<\/code> \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c:  <\/p>\n<pre><code class=\"cpp\">{    registration(&quot;niXman&quot;); } <\/code><\/pre>\n<p>  \u041e\u0442\u0432\u0435\u0442 \u043c\u044b \u043f\u043e\u043b\u0443\u0447\u0438\u043c \u0432 \u043d\u0430\u0448\u0443 \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044e <code>client_session::on_registration(std::string msg, std::string regkey)<\/code><br \/>  \u0412\u0441\u0451!<\/p>\n<p>  \u0418\u0437 \u043d\u0435\u0434\u043e\u0434\u0435\u043b\u043e\u043a \u043d\u0443\u0436\u043d\u043e \u043e\u0442\u043c\u0435\u0442\u0438\u0442\u044c \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0435:<br \/>  1. ID \u043f\u0440\u043e\u0446\u0435\u0434\u0443\u0440\u044b <code>yarmi_error()<\/code> \u2014 \u00ab\u043f\u043b\u0430\u0432\u0430\u0435\u0442\u00bb. \u042d\u0442\u043e \u0431\u0443\u0434\u0435\u0442 \u0438\u0441\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u043e. (\u0443\u0436\u0435 \u0438\u0441\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u043e. \u0437\u0430 <code>yarmi_error()<\/code> \u0437\u0430\u043a\u0440\u0435\u043f\u043b\u0435\u043d \u043d\u0443\u043b\u0435\u0432\u043e\u0439 ID.)<br \/>  2. \u0414\u0430\u0436\u0435 \u043a\u043e\u0433\u0434\u0430 \u0443 \u043d\u0430\u0441 \u0432\u0441\u0435\u0433\u043e \u043e\u0434\u043d\u0430 \u0432\u0435\u0440\u0441\u0438\u044f \u043f\u0440\u043e\u0446\u0435\u0434\u0443\u0440\u044b, \u0433\u0435\u043d\u0435\u0440\u0438\u0440\u0443\u0435\u0442\u0441\u044f <code>swith()<\/code> \u0434\u043b\u044f \u0432\u0435\u0440\u0441\u0438\u0439 \u043f\u0440\u043e\u0446\u0435\u0434\u0443\u0440. \u042d\u0442\u043e\u0433\u043e \u044f \u043f\u043e\u043a\u0430 \u043d\u0435 \u043c\u043e\u0433\u0443 \u0438\u0441\u043f\u0440\u0430\u0432\u0438\u0442\u044c. \u041f\u0440\u043e\u0431\u043b\u0435\u043c\u0430 \u0432 \u0442\u043e\u043c, \u0447\u0442\u043e \u0432 \u0432\u0435\u0442\u043a\u0435 \u043a\u043e\u0434\u043e\u0433\u0435\u043d\u0435\u0440\u0430\u0446\u0438\u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f \u043f\u0440\u0435\u043f\u0440\u043e\u0446\u0435\u0441\u0441\u043e\u0440\u043d\u044b\u0439 <code>LAZY_IF()<\/code>, \u0432 \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043d\u0443\u0436\u043d\u043e \u043f\u043e\u043c\u0435\u0441\u0442\u0438\u0442\u044c \u0435\u0449\u0435 \u043e\u0434\u0438\u043d <code>LAZY_IF()<\/code>, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0438 \u0431\u0443\u0434\u0435\u0442 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u0442\u044c, \u0433\u0435\u043d\u0435\u0440\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u043b\u0438 <code>switch()<\/code> \u0434\u043b\u044f \u0432\u0435\u0440\u0441\u0438\u0439, \u0438\u043b\u0438 \u043d\u0435\u0442. \u041d\u043e! \u0412 \u0432\u0435\u0442\u043a\u0435, \u043e\u0431\u0440\u0430\u0437\u0443\u044e\u0449\u0435\u0439\u0441\u044f \u043f\u0443\u0442\u0435\u043c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044f <code>LAZY_IF()<\/code>, \u0432\u0442\u043e\u0440\u043e\u0439 <code>LAZY_IF()<\/code> \u043d\u0435 \u0431\u0443\u0434\u0435\u0442 \u0440\u0430\u0437\u0432\u0435\u0440\u043d\u0443\u0442. \u0422\u0430\u043a\u043e\u0432\u0430 \u043e\u0441\u043e\u0431\u0435\u043d\u043d\u043e\u0441\u0442\u044c \u043f\u0440\u0435\u043f\u0440\u043e\u0446\u0435\u0441\u0441\u043e\u0440\u0430, \u043e\u043d \u043e\u0434\u043d\u043e\u043f\u0440\u043e\u0445\u043e\u0434\u043d\u044b\u0439.<br \/>  \u041a \u0442\u043e\u043c\u0443 \u0436\u0435, \u044f \u043f\u0440\u0430\u0432\u043e \u043d\u0435 \u0443\u0432\u0435\u0440\u0435\u043d, \u0447\u0442\u043e \u043a\u043e\u043c\u043f\u0438\u043b\u044f\u0442\u043e\u0440 \u043d\u0435 \u0441\u043c\u043e\u0436\u0435\u0442 \u0440\u0430\u0441\u043a\u0443\u0441\u0438\u0442\u044c \u044d\u0442\u0443 \u0431\u0435\u0441\u0441\u043c\u044b\u0441\u043b\u0435\u043d\u043d\u0443\u044e \u043a\u043e\u043d\u0441\u0442\u0440\u0443\u043a\u0446\u0438\u044e, \u0438 \u0432\u044b\u0440\u0435\u0437\u0430\u0442\u044c \u043d\u0435\u043f\u0443\u0442\u0435\u0432\u044b\u0439 <code>swith()<\/code>\u2026<br \/>  3. \u0412 \u0438\u043c\u0435\u043d\u0430\u0445 \u0442\u0438\u043f\u043e\u0432, \u043e\u043f\u0438\u0441\u044b\u0432\u0430\u044e\u0449\u0438\u0445 \u043f\u0440\u043e\u0446\u0435\u0434\u0443\u0440\u044b, \u043d\u0435\u043b\u044c\u0437\u044f \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0437\u0430\u043f\u044f\u0442\u044b\u0435, \u0438\u0431\u043e \u043f\u0440\u0435\u043f\u0440\u043e\u0446\u0435\u0441\u0441\u043e\u0440 \u043d\u0435 \u043f\u043e\u043d\u0438\u043c\u0430\u0435\u0442 \u043a\u043e\u043d\u0442\u0435\u043a\u0441\u0442\u0430, \u0432 \u043a\u043e\u0442\u043e\u0440\u043e\u043c \u043e\u043d\u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044e\u0442\u0441\u044f. \u0411\u0443\u0434\u0435\u0442 \u0438\u0441\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u043e.<\/p>\n<p>  \u0412 \u043a\u043e\u043d\u0435\u0447\u043d\u043e\u043c \u0441\u0447\u0435\u0442\u0435, \u0432\u0441\u0435 \u044d\u0442\u043e \u0432\u044b\u043b\u0438\u043b\u043e\u0441\u044c \u0432 \u043f\u0440\u043e\u0435\u043a\u0442 \u043f\u043e\u0434 \u043d\u0430\u0437\u0432\u0430\u043d\u0438\u0435\u043c <a href=\"https:\/\/github.com\/niXman\/yarmi\">YARMI<\/a>(Yet Another RMI).<br \/>  \u041e\u043f\u0438\u0441\u0430\u043d\u043d\u044b\u0439 \u043a\u043e\u0434\u043e\u0433\u0435\u043d\u0435\u0440\u0430\u0442\u043e\u0440 \u0437\u0430\u043a\u043e\u0434\u0438\u0440\u043e\u0432\u0430\u043d \u0432 \u043e\u0434\u043d\u043e\u043c \u0444\u0430\u0439\u043b\u0435 \u2014 <a href=\"https:\/\/github.com\/niXman\/yarmi\/blob\/master\/include\/yarmi\/yarmi.hpp\">yarmi.hpp<\/a>. \u0412 \u0441\u0443\u043c\u043c\u0435, \u043d\u0430 \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044e \u043a\u043e\u0434\u043e\u0433\u0435\u043d\u0435\u0440\u0430\u0442\u043e\u0440\u0430 \u0443\u0448\u0435\u043b \u043e\u0434\u0438\u043d \u0440\u0430\u0431\u043e\u0447\u0438\u0439 \u0434\u0435\u043d\u044c.<\/p>\n<p>  \u041f\u0440\u0438\u043c\u0435\u0440 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044f \u0432\u0441\u0435\u0433\u043e \u044d\u0442\u043e\u0433\u043e \u0434\u0435\u043b\u0430 \u043c\u043e\u0436\u043d\u043e \u0443\u0432\u0438\u0434\u0435\u0442\u044c <a href=\"https:\/\/github.com\/niXman\/yarmi\/tree\/master\/examples\/chat\">\u0442\u0443\u0442<\/a> \u0438 <a href=\"https:\/\/github.com\/niXman\/yarmi\/tree\/master\/examples\/echo\">\u0442\u0443\u0442<\/a>. \u041f\u0435\u0440\u0432\u044b\u0439 \u0442\u0435\u0441\u0442\u043e\u0432\u044b\u0439 \u043f\u0440\u043e\u0435\u043a\u0442 \u0432\u0441\u0435 \u0435\u0449\u0435 \u043d\u0435 \u0437\u0430\u0432\u0435\u0440\u0448\u0435\u043d, \u043a \u0441\u043e\u0436\u0430\u043b\u0435\u043d\u0438\u044e.<\/p>\n<p>  \u0412 \u0434\u043e\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u0435 \u043a \u043e\u043f\u0438\u0441\u0430\u043d\u043d\u043e\u043c\u0443, \u043d\u0430 \u0441\u0442\u0440\u0430\u043d\u0438\u0446\u0435 \u043f\u0440\u043e\u0435\u043a\u0442\u0430 \u0432\u044b \u043d\u0430\u0439\u0434\u0435\u0442\u0435 \u043a\u043e\u0434\u044b \u0430\u0441\u0438\u043d\u0445\u0440\u043e\u043d\u043d\u043e\u0433\u043e \u043c\u043d\u043e\u0433\u043e\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u0441\u043a\u043e\u0433\u043e \u043e\u0434\u043d\u043e\u043f\u043e\u0442\u043e\u0447\u043d\u043e\u0433\u043e \u0441\u0435\u0440\u0432\u0435\u0440\u0430, \u0438 \u043a\u043e\u0434\u044b \u043a\u043b\u0438\u043d\u0435\u043d\u0442\u0430.<\/p>\n<h4>\u0412\u043c\u0435\u0441\u0442\u043e \u0437\u0430\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u044f<\/h4>\n<p>  \u041f\u043b\u0430\u043d\u044b:<br \/>  1. \u0413\u0435\u043d\u0435\u0440\u0430\u0446\u0438\u044f \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u0438\u0445 \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441\u043e\u0432<br \/>  2. \u041e\u043f\u0438\u0441\u0430\u0442\u044c \u0441\u043f\u0435\u0446\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u044e (\u0445\u043e\u0442\u044c \u043e\u043d\u0430 \u0438 \u043f\u0440\u043e\u0449\u0435 \u043d\u0435\u043a\u0443\u0434\u0430)<br \/>  3. \u0412\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0441\u043e\u0431\u0441\u0442\u0432\u0435\u043d\u043d\u044b\u0439 \u0430\u043b\u043e\u043a\u0430\u0442\u043e\u0440<br \/>  4. \u041f\u0440\u0435\u0430\u043b\u043b\u043e\u0446\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0435 \u0445\u0435\u043d\u0434\u043b\u0435\u0440\u044b \u043f\u043e \u0443\u043c\u043e\u043b\u0447\u0430\u043d\u0438\u044e<\/p>\n<p>  \u0411\u0443\u0434\u0443 \u0431\u043b\u0430\u0433\u043e\u0434\u0430\u0440\u0435\u043d \u043a\u043e\u043d\u0441\u0442\u0440\u0443\u043a\u0442\u0438\u0432\u043d\u043e\u0439 \u043a\u0440\u0438\u0442\u0438\u043a\u0435 \u0438 \u043f\u0440\u0435\u0434\u043b\u043e\u0436\u0435\u043d\u0438\u044f\u043c.<\/p>\n<p>  PS<br \/>  \u042d\u0442\u043e\u0442 \u043a\u043e\u0434 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f \u0432 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u0438\u0445 \u043d\u0430\u0448\u0438\u0445 \u043a\u043e\u043c\u043c\u0435\u0440\u0447\u0435\u0441\u043a\u0438\u0445 \u043f\u0440\u043e\u0435\u043a\u0442\u0430\u0445, \u0432 \u0433\u0435\u0439\u043c\u0434\u0435\u0432\u0435. \t\t\t<\/p>\n<div class=\"clear\"><\/div>\n<\/p><\/div>\n<p> \u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b \u0441\u0442\u0430\u0442\u044c\u0438 <a href=\"http:\/\/habrahabr.ru\/post\/199496\/\"> http:\/\/habrahabr.ru\/post\/199496\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<div class=\"content html_format\"> \t\t\t<i>\u042d\u0442\u043e \u043c\u043e\u044f \u043f\u0435\u0440\u0432\u0430\u044f \u043f\u0443\u0431\u043b\u0438\u043a\u0430\u0446\u0438\u044f \u043d\u0430 \u0441\u0435\u043c \u0440\u0435\u0441\u0443\u0440\u0441\u0435, \u043f\u043e\u0441\u0435\u043c\u0443, \u043f\u0440\u043e\u0448\u0443 \u043e\u0442\u043d\u0435\u0441\u0442\u0438\u0441\u044c \u0441 \u043f\u043e\u043d\u0438\u043c\u0430\u043d\u0438\u0435\u043c \u043a \u0434\u043e\u043f\u0443\u0449\u0435\u043d\u043d\u044b\u043c \u043c\u043d\u043e\u044e \u043e\u0448\u0438\u0431\u043a\u0430\u043c.<\/i><\/p>\n<p>  <a href=\"https:\/\/en.wikipedia.org\/wiki\/Java_remote_method_invocation\">RMI<\/a> \u2014 \u0432\u0435\u0441\u044c\u043c\u0430 \u0431\u0430\u043d\u0430\u043b\u044c\u043d\u0430\u044f \u0437\u0430\u0434\u0430\u0447\u0430 \u0434\u043b\u044f \u042f\u041f, \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u044e\u0449\u0438\u0445 <a href=\"https:\/\/en.wikipedia.org\/wiki\/Type_introspection\">\u0438\u043d\u0442\u0440\u043e\u0441\u043f\u0435\u043a\u0446\u0438\u044e<\/a>. \u041d\u043e, \u0421++, \u043a \u0441\u043e\u0436\u0430\u043b\u0435\u043d\u0438\u044e, \u043a \u043d\u0438\u043c \u043d\u0435 \u043e\u0442\u043d\u043e\u0441\u0438\u0442\u0441\u044f.<\/p>\n<p>  \u0412 \u0434\u0430\u043d\u043d\u043e\u0439 \u043f\u0443\u0431\u043b\u0438\u043a\u0430\u0446\u0438\u0438 \u044f \u0445\u043e\u0447\u0443 \u043f\u0440\u043e\u0434\u0435\u043c\u043e\u043d\u0441\u0442\u0440\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044c \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 \u0432\u0435\u0441\u044c\u043c\u0430 \u044e\u0437\u0430\u0431\u0438\u043b\u044c\u043d\u043e\u0439 RMI \u0441\u0440\u0435\u0434\u0441\u0442\u0432\u0430\u043c\u0438 \u0421++ \u043f\u0440\u0435\u043f\u0440\u043e\u0446\u0435\u0441\u0441\u043e\u0440\u0430.<\/p>\n<h4>\u041f\u043e\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0430 \u0437\u0430\u0434\u0430\u0447\u0438<\/h4>\n<p>  1. \u041f\u0440\u0435\u0434\u043e\u0441\u0442\u0430\u0432\u0438\u0442\u044c \u043c\u0430\u043a\u0441\u0438\u043c\u0430\u043b\u044c\u043d\u043e \u043f\u0440\u043e\u0441\u0442\u043e\u0439 \u0441\u0438\u043d\u0442\u0430\u043a\u0441\u0438\u0441, \u0447\u0442\u043e\u0431 \u043d\u0435\u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e \u0431\u044b\u043b\u043e \u0434\u043e\u043f\u0443\u0441\u0442\u0438\u0442\u044c \u043e\u0448\u0438\u0431\u043a\u0443.<br \/>  2. \u0418\u0434\u0435\u043d\u0442\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u044f(\u0441\u0432\u044f\u0437\u044b\u0432\u0430\u043d\u0438\u0435) \u043f\u0440\u043e\u0446\u0435\u0434\u0443\u0440 \u0434\u043e\u043b\u0436\u043d\u0430 \u0431\u044b\u0442\u044c \u0441\u043a\u0440\u044b\u0442\u0430 \u043e\u0442 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f \u0434\u043b\u044f \u0442\u043e\u0433\u043e, \u0447\u0442\u043e\u0431 \u043d\u0435\u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e \u0431\u044b\u043b\u043e \u0434\u043e\u043f\u0443\u0441\u0442\u0438\u0442\u044c \u043e\u0448\u0438\u0431\u043a\u0443.<br \/>  3. \u0421\u0438\u043d\u0442\u0430\u043a\u0441\u0438\u0441 \u043d\u0435 \u0434\u043e\u043b\u0436\u0435\u043d \u043d\u0430\u043a\u043b\u0430\u0434\u044b\u0432\u0430\u0442\u044c \u043e\u0433\u0440\u0430\u043d\u0438\u0447\u0435\u043d\u0438\u044f \u043d\u0430 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c\u044b\u0435 \u0421++ \u0442\u0438\u043f\u044b.<br \/>  4. \u0414\u043e\u043b\u0436\u043d\u0430 \u043f\u0440\u0438\u0441\u0443\u0442\u0441\u0442\u0432\u043e\u0432\u0430\u0442\u044c \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044c \u0432\u0435\u0440\u0441\u0438\u043e\u043d\u043d\u043e\u0441\u0442\u0438 \u043f\u0440\u043e\u0446\u0435\u0434\u0443\u0440, \u043d\u043e, \u0442\u0430\u043a, \u0447\u0442\u043e\u0431 \u043d\u0435 \u043b\u043e\u043c\u0430\u043b\u0430\u0441\u044c \u0441\u043e\u0432\u043c\u0435\u0441\u0442\u0438\u043c\u043e\u0441\u0442\u044c \u0441 \u0443\u0436\u0435 \u0440\u0430\u0431\u043e\u0442\u0430\u044e\u0449\u0438\u043c\u0438 \u043a\u043b\u0438\u0435\u043d\u0442\u0430\u043c\u0438.  <\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[],"tags":[],"class_list":["post-199496","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/199496","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=199496"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/199496\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=199496"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=199496"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=199496"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}