{"action":"created","comment":{"url":"https://api.github.com/repos/stan-dev/stan/pulls/comments/93936862","pull_request_review_id":14466650,"id":93936862,"diff_hunk":"@@ -0,0 +1,89 @@\n+#ifndef STAN_CALLBACKS_CHAINED_WRITER_HPP\n+#define STAN_CALLBACKS_CHAINED_WRITER_HPP\n+\n+#include <stan/callbacks/writer.hpp>\n+#include <ostream>\n+#include <vector>\n+#include <string>\n+\n+namespace stan {\n+  namespace callbacks {\n+\n+    /**\n+     * <code>chained_writer</code> is an implementation that writes to\n+     * multiple writers.\n+     *\n+     * For any given call to this writer, it will delegate to both writers\n+     * provided in the constructor.\n+     */\n+    class chained_writer : public writer {\n+    public:\n+      /**\n+       * Constructor.\n+       *\n+       * @param[in, out] writer1 first writer\n+       * @param[in, out] writer2 second writer\n+       */\n+      chained_writer(writer& writer1,\n+                     writer& writer2)\n+        : writer1_(writer1), writer2_(writer2) {\n+      }\n+\n+\n+      void operator()(const std::string& key, double value) {\n+        writer1_(key, value);\n+        writer2_(key, value);\n+      }\n+\n+      void operator()(const std::string& key, int value) {\n+        writer1_(key, value);\n+        writer2_(key, value);\n+      }\n+\n+      void operator()(const std::string& key, const std::string& value) {\n+        writer1_(key, value);\n+        writer2_(key, value);\n+      }\n+\n+      void operator()(const std::string& key,\n+                      const double* values,","path":"src/stan/callbacks/chained_writer.hpp","position":49,"original_position":49,"commit_id":"0327d322c0df5f356c9728192211468d086c57f6","original_commit_id":"0327d322c0df5f356c9728192211468d086c57f6","user":{"login":"syclik","id":425751,"avatar_url":"https://avatars.githubusercontent.com/u/425751?v=3","gravatar_id":"","url":"https://api.github.com/users/syclik","html_url":"https://github.com/syclik","followers_url":"https://api.github.com/users/syclik/followers","following_url":"https://api.github.com/users/syclik/following{/other_user}","gists_url":"https://api.github.com/users/syclik/gists{/gist_id}","starred_url":"https://api.github.com/users/syclik/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/syclik/subscriptions","organizations_url":"https://api.github.com/users/syclik/orgs","repos_url":"https://api.github.com/users/syclik/repos","events_url":"https://api.github.com/users/syclik/events{/privacy}","received_events_url":"https://api.github.com/users/syclik/received_events","type":"User","site_admin":false},"body":"The doc is inherited in doxygen.\r\nThe reason for the pointer was to keep in line with the old pull request. I really think IO should be handled better, so I'm going to scale back the writers to what we use now:\r\n- `writer()`\r\n- `writer(std::string)`\r\n- `writer(std::vector<std::string>)`\r\n- `writer(std::vector<double>)`\r\n\r\nIt'll cut down on our overhead for now. I think it's the right way to go and we won't have pointers floating around.\r\n","created_at":"2016-12-27T14:39:59Z","updated_at":"2016-12-27T14:51:47Z","html_url":"https://github.com/stan-dev/stan/pull/2004#discussion_r93936862","pull_request_url":"https://api.github.com/repos/stan-dev/stan/pulls/2004","_links":{"self":{"href":"https://api.github.com/repos/stan-dev/stan/pulls/comments/93936862"},"html":{"href":"https://github.com/stan-dev/stan/pull/2004#discussion_r93936862"},"pull_request":{"href":"https://api.github.com/repos/stan-dev/stan/pulls/2004"}}},"pull_request":{"url":"https://api.github.com/repos/stan-dev/stan/pulls/2004","id":80550773,"html_url":"https://github.com/stan-dev/stan/pull/2004","diff_url":"https://github.com/stan-dev/stan/pull/2004.diff","patch_url":"https://github.com/stan-dev/stan/pull/2004.patch","issue_url":"https://api.github.com/repos/stan-dev/stan/issues/2004","number":2004,"state":"open","locked":false,"title":"Stan refactor","user":{"login":"syclik","id":425751,"avatar_url":"https://avatars.githubusercontent.com/u/425751?v=3","gravatar_id":"","url":"https://api.github.com/users/syclik","html_url":"https://github.com/syclik","followers_url":"https://api.github.com/users/syclik/followers","following_url":"https://api.github.com/users/syclik/following{/other_user}","gists_url":"https://api.github.com/users/syclik/gists{/gist_id}","starred_url":"https://api.github.com/users/syclik/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/syclik/subscriptions","organizations_url":"https://api.github.com/users/syclik/orgs","repos_url":"https://api.github.com/users/syclik/repos","events_url":"https://api.github.com/users/syclik/events{/privacy}","received_events_url":"https://api.github.com/users/syclik/received_events","type":"User","site_admin":false},"body":"#### Submisison Checklist\n- [x] Run unit tests: `./runTests.py src/test/unit`\n- [x] Run cpplint: `make cpplint`\n- [x] Declare copyright holder and open-source license: see below\n#### Summary\n\nThis pull request accomplishes two major things:\n1. In the `src/stan/services` folder (the `stan::services` namespace), we now have functions that should be called by the interfaces.\n2. Removes a lot of the old code.\n\nIt does this while maintaining all current behavior.\n#### Intended Effect\n\nThe intended effect is to make the downstream interfaces easier to implement and maintain.\n\nThe code is much cleaner. Each of the functions in `src/stan/services` excluding the `src/stan/services/util` folder are meant to be called by RStan, PyStan, and CmdStan. This will also make it much easier to deal with the upcoming template build issue we will have with the introduction of forward-mode and RHMC.\n#### How to Verify\n\n(I'm sorry -- the diff is large.)\n1. All tests should pass. (The upstream tests will fail due to CmdStan `develop` branch not having changes necessary, but I'll submit a pull request on the CmdStan branch.)\n2. Take a look at all the new functions in `src/stan/services`. I've covered all the use cases of CmdStan, PyStan, and RStan. See side effects below.\n3. There were a couple of additional utilities outside of `src/stan/services` that were added. Take a look.\n\nIf there are some oddly implemented things in there, most weird implementations are due to keeping the existing behavior intact. This way, we can roll these changes out with a minor release and keep moving forward.\n#### Side Effects\n\nCmdStan, RStan, and PyStan will break under the current branch, but will maintain the same behavior.\n\nI have a branch of CmdStan that works. Allen has a branch of PyStan that's almost working. I have a branch of RStan that's almost working.\n#### Documentation\n\nThe C++ code may need some more doc.\n\nIf anyone wants to help, there's that and adding more tests.\n#### Reviewer Suggestions\n\nThis one's big, so it'd be helpful to have a few eyes on it.\n\n@ariddell, @bgoodri: since this will effect both of you directly.\n@sakrejda: since you've been looking at this for a while.\n@bob-carpenter, @betanalpha, @rtrangucci: if you've got the time.\n\nAlthough I'm confident that this behaves identically, this one shouldn't be taken lightly.\n#### Copyright and Licensing\n\nPlease list the copyright holder for the work you are submitting (this will be you or your assignee, such as a university or company): Columbia University\n\nBy submitting this pull request, the copyright holder is agreeing to license the submitted work under the following licenses:\n- Code: BSD 3-clause (https://opensource.org/licenses/BSD-3-Clause)\n- Documentation: CC-BY 4.0 (https://creativecommons.org/licenses/by/4.0/)\n","created_at":"2016-08-09T02:05:25Z","updated_at":"2016-12-27T14:51:47Z","closed_at":null,"merged_at":null,"merge_commit_sha":"4f9ac3667d045c8d894387920a028ff59dca0795","assignee":null,"assignees":[],"milestone":{"url":"https://api.github.com/repos/stan-dev/stan/milestones/25","html_url":"https://github.com/stan-dev/stan/milestone/25","labels_url":"https://api.github.com/repos/stan-dev/stan/milestones/25/labels","id":2215091,"number":25,"title":"v2.14.0++","description":"Next version after v2.14.0.","creator":{"login":"syclik","id":425751,"avatar_url":"https://avatars.githubusercontent.com/u/425751?v=3","gravatar_id":"","url":"https://api.github.com/users/syclik","html_url":"https://github.com/syclik","followers_url":"https://api.github.com/users/syclik/followers","following_url":"https://api.github.com/users/syclik/following{/other_user}","gists_url":"https://api.github.com/users/syclik/gists{/gist_id}","starred_url":"https://api.github.com/users/syclik/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/syclik/subscriptions","organizations_url":"https://api.github.com/users/syclik/orgs","repos_url":"https://api.github.com/users/syclik/repos","events_url":"https://api.github.com/users/syclik/events{/privacy}","received_events_url":"https://api.github.com/users/syclik/received_events","type":"User","site_admin":false},"open_issues":46,"closed_issues":1,"state":"open","created_at":"2016-12-26T00:54:20Z","updated_at":"2016-12-26T20:55:36Z","due_on":null,"closed_at":null},"commits_url":"https://api.github.com/repos/stan-dev/stan/pulls/2004/commits","review_comments_url":"https://api.github.com/repos/stan-dev/stan/pulls/2004/comments","review_comment_url":"https://api.github.com/repos/stan-dev/stan/pulls/comments{/number}","comments_url":"https://api.github.com/repos/stan-dev/stan/issues/2004/comments","statuses_url":"https://api.github.com/repos/stan-dev/stan/statuses/0327d322c0df5f356c9728192211468d086c57f6","head":{"label":"stan-dev:feature/issue-1751-service-methods","ref":"feature/issue-1751-service-methods","sha":"0327d322c0df5f356c9728192211468d086c57f6","user":{"login":"stan-dev","id":3374820,"avatar_url":"https://avatars.githubusercontent.com/u/3374820?v=3","gravatar_id":"","url":"https://api.github.com/users/stan-dev","html_url":"https://github.com/stan-dev","followers_url":"https://api.github.com/users/stan-dev/followers","following_url":"https://api.github.com/users/stan-dev/following{/other_user}","gists_url":"https://api.github.com/users/stan-dev/gists{/gist_id}","starred_url":"https://api.github.com/users/stan-dev/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/stan-dev/subscriptions","organizations_url":"https://api.github.com/users/stan-dev/orgs","repos_url":"https://api.github.com/users/stan-dev/repos","events_url":"https://api.github.com/users/stan-dev/events{/privacy}","received_events_url":"https://api.github.com/users/stan-dev/received_events","type":"Organization","site_admin":false},"repo":{"id":8043756,"name":"stan","full_name":"stan-dev/stan","owner":{"login":"stan-dev","id":3374820,"avatar_url":"https://avatars.githubusercontent.com/u/3374820?v=3","gravatar_id":"","url":"https://api.github.com/users/stan-dev","html_url":"https://github.com/stan-dev","followers_url":"https://api.github.com/users/stan-dev/followers","following_url":"https://api.github.com/users/stan-dev/following{/other_user}","gists_url":"https://api.github.com/users/stan-dev/gists{/gist_id}","starred_url":"https://api.github.com/users/stan-dev/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/stan-dev/subscriptions","organizations_url":"https://api.github.com/users/stan-dev/orgs","repos_url":"https://api.github.com/users/stan-dev/repos","events_url":"https://api.github.com/users/stan-dev/events{/privacy}","received_events_url":"https://api.github.com/users/stan-dev/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/stan-dev/stan","description":"Stan development repository (home page is linked below). The master branch contains the current release. The develop branch contains the latest stable development.  See the Developer Process Wiki for details.  ","fork":false,"url":"https://api.github.com/repos/stan-dev/stan","forks_url":"https://api.github.com/repos/stan-dev/stan/forks","keys_url":"https://api.github.com/repos/stan-dev/stan/keys{/key_id}","collaborators_url":"https://api.github.com/repos/stan-dev/stan/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/stan-dev/stan/teams","hooks_url":"https://api.github.com/repos/stan-dev/stan/hooks","issue_events_url":"https://api.github.com/repos/stan-dev/stan/issues/events{/number}","events_url":"https://api.github.com/repos/stan-dev/stan/events","assignees_url":"https://api.github.com/repos/stan-dev/stan/assignees{/user}","branches_url":"https://api.github.com/repos/stan-dev/stan/branches{/branch}","tags_url":"https://api.github.com/repos/stan-dev/stan/tags","blobs_url":"https://api.github.com/repos/stan-dev/stan/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/stan-dev/stan/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/stan-dev/stan/git/refs{/sha}","trees_url":"https://api.github.com/repos/stan-dev/stan/git/trees{/sha}","statuses_url":"https://api.github.com/repos/stan-dev/stan/statuses/{sha}","languages_url":"https://api.github.com/repos/stan-dev/stan/languages","stargazers_url":"https://api.github.com/repos/stan-dev/stan/stargazers","contributors_url":"https://api.github.com/repos/stan-dev/stan/contributors","subscribers_url":"https://api.github.com/repos/stan-dev/stan/subscribers","subscription_url":"https://api.github.com/repos/stan-dev/stan/subscription","commits_url":"https://api.github.com/repos/stan-dev/stan/commits{/sha}","git_commits_url":"https://api.github.com/repos/stan-dev/stan/git/commits{/sha}","comments_url":"https://api.github.com/repos/stan-dev/stan/comments{/number}","issue_comment_url":"https://api.github.com/repos/stan-dev/stan/issues/comments{/number}","contents_url":"https://api.github.com/repos/stan-dev/stan/contents/{+path}","compare_url":"https://api.github.com/repos/stan-dev/stan/compare/{base}...{head}","merges_url":"https://api.github.com/repos/stan-dev/stan/merges","archive_url":"https://api.github.com/repos/stan-dev/stan/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/stan-dev/stan/downloads","issues_url":"https://api.github.com/repos/stan-dev/stan/issues{/number}","pulls_url":"https://api.github.com/repos/stan-dev/stan/pulls{/number}","milestones_url":"https://api.github.com/repos/stan-dev/stan/milestones{/number}","notifications_url":"https://api.github.com/repos/stan-dev/stan/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/stan-dev/stan/labels{/name}","releases_url":"https://api.github.com/repos/stan-dev/stan/releases{/id}","deployments_url":"https://api.github.com/repos/stan-dev/stan/deployments","created_at":"2013-02-06T03:25:04Z","updated_at":"2016-12-24T01:54:20Z","pushed_at":"2016-12-26T23:53:58Z","git_url":"git://github.com/stan-dev/stan.git","ssh_url":"git@github.com:stan-dev/stan.git","clone_url":"https://github.com/stan-dev/stan.git","svn_url":"https://github.com/stan-dev/stan","homepage":"http://mc-stan.org","size":248685,"stargazers_count":736,"watchers_count":736,"language":"Stan","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":155,"mirror_url":null,"open_issues_count":149,"forks":155,"open_issues":149,"watchers":736,"default_branch":"develop"}},"base":{"label":"stan-dev:develop","ref":"develop","sha":"e0e1a2fd7b2f21926fdd5dc7f87a3f2d7803143c","user":{"login":"stan-dev","id":3374820,"avatar_url":"https://avatars.githubusercontent.com/u/3374820?v=3","gravatar_id":"","url":"https://api.github.com/users/stan-dev","html_url":"https://github.com/stan-dev","followers_url":"https://api.github.com/users/stan-dev/followers","following_url":"https://api.github.com/users/stan-dev/following{/other_user}","gists_url":"https://api.github.com/users/stan-dev/gists{/gist_id}","starred_url":"https://api.github.com/users/stan-dev/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/stan-dev/subscriptions","organizations_url":"https://api.github.com/users/stan-dev/orgs","repos_url":"https://api.github.com/users/stan-dev/repos","events_url":"https://api.github.com/users/stan-dev/events{/privacy}","received_events_url":"https://api.github.com/users/stan-dev/received_events","type":"Organization","site_admin":false},"repo":{"id":8043756,"name":"stan","full_name":"stan-dev/stan","owner":{"login":"stan-dev","id":3374820,"avatar_url":"https://avatars.githubusercontent.com/u/3374820?v=3","gravatar_id":"","url":"https://api.github.com/users/stan-dev","html_url":"https://github.com/stan-dev","followers_url":"https://api.github.com/users/stan-dev/followers","following_url":"https://api.github.com/users/stan-dev/following{/other_user}","gists_url":"https://api.github.com/users/stan-dev/gists{/gist_id}","starred_url":"https://api.github.com/users/stan-dev/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/stan-dev/subscriptions","organizations_url":"https://api.github.com/users/stan-dev/orgs","repos_url":"https://api.github.com/users/stan-dev/repos","events_url":"https://api.github.com/users/stan-dev/events{/privacy}","received_events_url":"https://api.github.com/users/stan-dev/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/stan-dev/stan","description":"Stan development repository (home page is linked below). The master branch contains the current release. The develop branch contains the latest stable development.  See the Developer Process Wiki for details.  ","fork":false,"url":"https://api.github.com/repos/stan-dev/stan","forks_url":"https://api.github.com/repos/stan-dev/stan/forks","keys_url":"https://api.github.com/repos/stan-dev/stan/keys{/key_id}","collaborators_url":"https://api.github.com/repos/stan-dev/stan/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/stan-dev/stan/teams","hooks_url":"https://api.github.com/repos/stan-dev/stan/hooks","issue_events_url":"https://api.github.com/repos/stan-dev/stan/issues/events{/number}","events_url":"https://api.github.com/repos/stan-dev/stan/events","assignees_url":"https://api.github.com/repos/stan-dev/stan/assignees{/user}","branches_url":"https://api.github.com/repos/stan-dev/stan/branches{/branch}","tags_url":"https://api.github.com/repos/stan-dev/stan/tags","blobs_url":"https://api.github.com/repos/stan-dev/stan/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/stan-dev/stan/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/stan-dev/stan/git/refs{/sha}","trees_url":"https://api.github.com/repos/stan-dev/stan/git/trees{/sha}","statuses_url":"https://api.github.com/repos/stan-dev/stan/statuses/{sha}","languages_url":"https://api.github.com/repos/stan-dev/stan/languages","stargazers_url":"https://api.github.com/repos/stan-dev/stan/stargazers","contributors_url":"https://api.github.com/repos/stan-dev/stan/contributors","subscribers_url":"https://api.github.com/repos/stan-dev/stan/subscribers","subscription_url":"https://api.github.com/repos/stan-dev/stan/subscription","commits_url":"https://api.github.com/repos/stan-dev/stan/commits{/sha}","git_commits_url":"https://api.github.com/repos/stan-dev/stan/git/commits{/sha}","comments_url":"https://api.github.com/repos/stan-dev/stan/comments{/number}","issue_comment_url":"https://api.github.com/repos/stan-dev/stan/issues/comments{/number}","contents_url":"https://api.github.com/repos/stan-dev/stan/contents/{+path}","compare_url":"https://api.github.com/repos/stan-dev/stan/compare/{base}...{head}","merges_url":"https://api.github.com/repos/stan-dev/stan/merges","archive_url":"https://api.github.com/repos/stan-dev/stan/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/stan-dev/stan/downloads","issues_url":"https://api.github.com/repos/stan-dev/stan/issues{/number}","pulls_url":"https://api.github.com/repos/stan-dev/stan/pulls{/number}","milestones_url":"https://api.github.com/repos/stan-dev/stan/milestones{/number}","notifications_url":"https://api.github.com/repos/stan-dev/stan/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/stan-dev/stan/labels{/name}","releases_url":"https://api.github.com/repos/stan-dev/stan/releases{/id}","deployments_url":"https://api.github.com/repos/stan-dev/stan/deployments","created_at":"2013-02-06T03:25:04Z","updated_at":"2016-12-24T01:54:20Z","pushed_at":"2016-12-26T23:53:58Z","git_url":"git://github.com/stan-dev/stan.git","ssh_url":"git@github.com:stan-dev/stan.git","clone_url":"https://github.com/stan-dev/stan.git","svn_url":"https://github.com/stan-dev/stan","homepage":"http://mc-stan.org","size":248685,"stargazers_count":736,"watchers_count":736,"language":"Stan","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":155,"mirror_url":null,"open_issues_count":149,"forks":155,"open_issues":149,"watchers":736,"default_branch":"develop"}},"_links":{"self":{"href":"https://api.github.com/repos/stan-dev/stan/pulls/2004"},"html":{"href":"https://github.com/stan-dev/stan/pull/2004"},"issue":{"href":"https://api.github.com/repos/stan-dev/stan/issues/2004"},"comments":{"href":"https://api.github.com/repos/stan-dev/stan/issues/2004/comments"},"review_comments":{"href":"https://api.github.com/repos/stan-dev/stan/pulls/2004/comments"},"review_comment":{"href":"https://api.github.com/repos/stan-dev/stan/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/stan-dev/stan/pulls/2004/commits"},"statuses":{"href":"https://api.github.com/repos/stan-dev/stan/statuses/0327d322c0df5f356c9728192211468d086c57f6"}}}}
{"actor":{"display_login":"syclik"}}