{"action":"created","comment":{"url":"https://api.github.com/repos/BlueBrain/Livre/pulls/comments/45093090","id":45093090,"diff_hunk":"@@ -0,0 +1,160 @@\n+/* Copyright (c) 2011-2014, EPFL/Blue Brain Project\n+ *                     Ahmet Bilgili <ahmet.bilgili@epfl.ch>\n+ *\n+ * This file is part of Livre <https://github.com/BlueBrain/Livre>\n+ *\n+ * This library is free software; you can redistribute it and/or modify it under\n+ * the terms of the GNU Lesser General Public License version 3.0 as published\n+ * by the Free Software Foundation.\n+ *\n+ * This library is distributed in the hope that it will be useful, but WITHOUT\n+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS\n+ * FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public License for more\n+ * details.\n+ *\n+ * You should have received a copy of the GNU Lesser General Public License\n+ * along with this library; if not, write to the Free Software Foundation, Inc.,\n+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.\n+ */\n+\n+#ifndef _FiterInput_h_\n+#define _FiterInput_h_\n+\n+#include <livre/core/types.h>\n+#include <livre/core/pipeline/InputPort.h>\n+#include <livre/core/pipeline/PortData.h>\n+\n+namespace livre\n+{\n+\n+/**\n+ * The FilterInput class is used by the @PipeFilter class to instantiate\n+ * the incoming connections to a given filter using the connection info\n+ * provided by the filter.\n+ *\n+ * It provides functionality to wait on any or all the ports given by\n+ * name.\n+ *\n+ * It also provides thread safe functions to query the state of the port.\n+ */\n+class FilterInput\n+{\n+public:\n+\n+    FilterInput();\n+    ~FilterInput();\n+\n+    /**\n+     * Gets the port according to given name.\n+     * @param portName is the name of the port.\n+     * @return the input port\n+     * @throw std::runtime_error whem the port with the port name\n+     * is not available.\n+     */\n+    ConstInputPortPtr getPort( const std::string& portName ) const;\n+\n+    /**\n+     * Queries if port with the given name is available.\n+     * @param portName is the name of the port.\n+     * @return true if there is a port with given name\n+     */\n+    bool hasPort( const std::string& portName ) const;\n+\n+    /**\n+     * Waits for a given port name or for all the input ports if\n+     * portname is empty.\n+     * @param portName is the name of the port. Empty for all ports.\n+     * @throw std::runtime_error whem the port with the port name\n+     * is not available.\n+     */\n+    void wait( const std::string& portName = \"\" ) const;\n+\n+    /**\n+     * Waits for a any ready input to a given port ( The port\n+     * can have many inputs )\n+     * @param portName is the name of the port.\n+     * @return true there are still waiting inputs.\n+     * @throw std::runtime_error whem the port with the port name\n+     * is not available.\n+     */\n+    bool waitForAny( const std::string& portName ) const;\n+\n+    /**\n+     * Waits for a any input to be ready.\n+     * @param readyPorts The ready ports are listed into readyPorts array.\n+     * @return true there are still waiting inputs.\n+     */\n+    bool waitForAny( lunchbox::Strings& readyPorts ) const;\n+\n+    /**\n+     * Queries given port name or for all the input ports if\n+     * port is ready.\n+     * @param portName is the name of the port. Empty for all ports.\n+     * @return true if port/ports are ready.\n+     * is not available.\n+     * @throw std::runtime_error whem the port with the port name\n+     */\n+    bool isReady( const std::string& portName = \"\" ) const;\n+\n+    /**\n+     * @return the list of port names.\n+     */\n+    lunchbox::Strings getPortNames() const;\n+\n+    /**\n+     * @return true if there are no ports.\n+     */\n+    bool isEmpty() const;\n+\n+    /**\n+     * Gets the count of connections to the given input port.\n+     * @param portName is the name of the port.\n+     * @return the number of inputs.\n+     * @throw std::runtime_error whem the port with the port name\n+     * is not available.\n+     */\n+    size_t getInputSize( const std::string& portName ) const;\n+\n+    /**\n+     * @param portName is the name of the port.\n+     * @return the input port\n+     * @throw std::runtime_error whem the port with the port name\n+     * is not available.\n+     */\n+    InputPortPtr getPort( const std::string& portName );\n+\n+    /**\n+     * Adds a new input port according to the given port info.\n+     * @param portInfo The port information\n+     * @return the generated code.\n+     * @throw std::runtime_error whem the port with the port name\n+     * is already registered.\n+     */\n+    InputPortPtr addPort( const PortInfo& portInfo );\n+\n+    /**\n+     * Clears the ports.\n+     */\n+    void clear();\n+\n+    /**\n+     * Connect given pipe filters with the given port name. Both filters","path":"livre/core/pipeline/FilterInput.h","position":141,"original_position":141,"commit_id":"1c7411c6084ef95485270fd40d1d149edbeaa0b1","original_commit_id":"1c7411c6084ef95485270fd40d1d149edbeaa0b1","user":{"login":"rdumusc","id":5166658,"avatar_url":"https://avatars.githubusercontent.com/u/5166658?v=3","gravatar_id":"","url":"https://api.github.com/users/rdumusc","html_url":"https://github.com/rdumusc","followers_url":"https://api.github.com/users/rdumusc/followers","following_url":"https://api.github.com/users/rdumusc/following{/other_user}","gists_url":"https://api.github.com/users/rdumusc/gists{/gist_id}","starred_url":"https://api.github.com/users/rdumusc/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rdumusc/subscriptions","organizations_url":"https://api.github.com/users/rdumusc/orgs","repos_url":"https://api.github.com/users/rdumusc/repos","events_url":"https://api.github.com/users/rdumusc/events{/privacy}","received_events_url":"https://api.github.com/users/rdumusc/received_events","type":"User","site_admin":false},"body":"the given","created_at":"2015-11-17T17:48:46Z","updated_at":"2015-11-17T17:48:46Z","html_url":"https://github.com/BlueBrain/Livre/pull/188#discussion_r45093090","pull_request_url":"https://api.github.com/repos/BlueBrain/Livre/pulls/188","_links":{"self":{"href":"https://api.github.com/repos/BlueBrain/Livre/pulls/comments/45093090"},"html":{"href":"https://github.com/BlueBrain/Livre/pull/188#discussion_r45093090"},"pull_request":{"href":"https://api.github.com/repos/BlueBrain/Livre/pulls/188"}}},"pull_request":{"url":"https://api.github.com/repos/BlueBrain/Livre/pulls/188","id":50720658,"html_url":"https://github.com/BlueBrain/Livre/pull/188","diff_url":"https://github.com/BlueBrain/Livre/pull/188.diff","patch_url":"https://github.com/BlueBrain/Livre/pull/188.patch","issue_url":"https://api.github.com/repos/BlueBrain/Livre/issues/188","number":188,"state":"open","locked":false,"title":"Pipelined livre","user":{"login":"bilgili","id":1157568,"avatar_url":"https://avatars.githubusercontent.com/u/1157568?v=3","gravatar_id":"","url":"https://api.github.com/users/bilgili","html_url":"https://github.com/bilgili","followers_url":"https://api.github.com/users/bilgili/followers","following_url":"https://api.github.com/users/bilgili/following{/other_user}","gists_url":"https://api.github.com/users/bilgili/gists{/gist_id}","starred_url":"https://api.github.com/users/bilgili/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bilgili/subscriptions","organizations_url":"https://api.github.com/users/bilgili/orgs","repos_url":"https://api.github.com/users/bilgili/repos","events_url":"https://api.github.com/users/bilgili/events{/privacy}","received_events_url":"https://api.github.com/users/bilgili/received_events","type":"User","site_admin":false},"body":"So, my pipelines are here:\r\n\r\nWhy did I do this ?\r\n\r\n1) Dash is a nice library but control over it is a bit difficult and I had to rearchitecture Livre a lot ( maybe dash as well ). Understanding it takes a bit time until people gets used to it. I wanted to simplify this. It may not be simpler, you are going to tell me :)\r\n2) Rearchitecture was needed to fix issues like: multiple windows under a node, cache overcommiting, etc. \r\n3) I wanted a way of running some parts of the codes asynchronously under some control. Like the visible tree generation per root octree node etc, but using my previous algorithms.\r\n4) I wanted to add easy ways of processing of data blocks ( filtering + adding information ) etc, and of course in paralellel.\r\n5) Graphs are easier to grasp for people and with the pipeline you can create this graphs easily. There is type control over the connections in runtime so you cant go wrong. The type checking is based on c++11 typeindex and this can be discussed.\r\n6) I want to gather different kinds of renderings together with Livre and the addition of those things into the code will be a bit more easier.\r\n7) The connection mechanism is currently based on futures and it is a synchronization object based on two pieces. promise + future and futures here provides means to query, set and retrieve data. These copules are similar to publisher + subscriber, hpx futures so in the future it may be possible to extend using remote functions.\r\n\r\nI am creating this pull req in order to discuss / change or even completely delete ( I am fine with it). I think at the end I really had a nice idea of using graph based algorithms and if we dont use it, I will make a library called \"TaskTube\" :) for my own things.\r\n\r\nDo jump in if you want but I would like to go with a couple of people different regions of the code.\r\n\r\nKnown issue: On exit I am getting \r\n21218.Main       ../Collage/co/localNode.cpp:387    8284 0 connections open after close\r\n21218.Main           ../apps/livre/livre.cpp:90     8284 Assert: client->getRefCount() == 1 [Client still referenced by 7]   in: \r\nbut I will have a look at it. ","created_at":"2015-11-14T10:00:02Z","updated_at":"2015-11-17T17:48:46Z","closed_at":null,"merged_at":null,"merge_commit_sha":"6161cb2dd5f83a3a49f449e317d15fa31b273191","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/BlueBrain/Livre/pulls/188/commits","review_comments_url":"https://api.github.com/repos/BlueBrain/Livre/pulls/188/comments","review_comment_url":"https://api.github.com/repos/BlueBrain/Livre/pulls/comments{/number}","comments_url":"https://api.github.com/repos/BlueBrain/Livre/issues/188/comments","statuses_url":"https://api.github.com/repos/BlueBrain/Livre/statuses/1c7411c6084ef95485270fd40d1d149edbeaa0b1","head":{"label":"bilgili:pipelined_livre","ref":"pipelined_livre","sha":"1c7411c6084ef95485270fd40d1d149edbeaa0b1","user":{"login":"bilgili","id":1157568,"avatar_url":"https://avatars.githubusercontent.com/u/1157568?v=3","gravatar_id":"","url":"https://api.github.com/users/bilgili","html_url":"https://github.com/bilgili","followers_url":"https://api.github.com/users/bilgili/followers","following_url":"https://api.github.com/users/bilgili/following{/other_user}","gists_url":"https://api.github.com/users/bilgili/gists{/gist_id}","starred_url":"https://api.github.com/users/bilgili/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bilgili/subscriptions","organizations_url":"https://api.github.com/users/bilgili/orgs","repos_url":"https://api.github.com/users/bilgili/repos","events_url":"https://api.github.com/users/bilgili/events{/privacy}","received_events_url":"https://api.github.com/users/bilgili/received_events","type":"User","site_admin":false},"repo":{"id":34505794,"name":"Livre","full_name":"bilgili/Livre","owner":{"login":"bilgili","id":1157568,"avatar_url":"https://avatars.githubusercontent.com/u/1157568?v=3","gravatar_id":"","url":"https://api.github.com/users/bilgili","html_url":"https://github.com/bilgili","followers_url":"https://api.github.com/users/bilgili/followers","following_url":"https://api.github.com/users/bilgili/following{/other_user}","gists_url":"https://api.github.com/users/bilgili/gists{/gist_id}","starred_url":"https://api.github.com/users/bilgili/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bilgili/subscriptions","organizations_url":"https://api.github.com/users/bilgili/orgs","repos_url":"https://api.github.com/users/bilgili/repos","events_url":"https://api.github.com/users/bilgili/events{/privacy}","received_events_url":"https://api.github.com/users/bilgili/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/bilgili/Livre","description":"Largescale Interactive Volume Rendering Engine","fork":true,"url":"https://api.github.com/repos/bilgili/Livre","forks_url":"https://api.github.com/repos/bilgili/Livre/forks","keys_url":"https://api.github.com/repos/bilgili/Livre/keys{/key_id}","collaborators_url":"https://api.github.com/repos/bilgili/Livre/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/bilgili/Livre/teams","hooks_url":"https://api.github.com/repos/bilgili/Livre/hooks","issue_events_url":"https://api.github.com/repos/bilgili/Livre/issues/events{/number}","events_url":"https://api.github.com/repos/bilgili/Livre/events","assignees_url":"https://api.github.com/repos/bilgili/Livre/assignees{/user}","branches_url":"https://api.github.com/repos/bilgili/Livre/branches{/branch}","tags_url":"https://api.github.com/repos/bilgili/Livre/tags","blobs_url":"https://api.github.com/repos/bilgili/Livre/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/bilgili/Livre/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/bilgili/Livre/git/refs{/sha}","trees_url":"https://api.github.com/repos/bilgili/Livre/git/trees{/sha}","statuses_url":"https://api.github.com/repos/bilgili/Livre/statuses/{sha}","languages_url":"https://api.github.com/repos/bilgili/Livre/languages","stargazers_url":"https://api.github.com/repos/bilgili/Livre/stargazers","contributors_url":"https://api.github.com/repos/bilgili/Livre/contributors","subscribers_url":"https://api.github.com/repos/bilgili/Livre/subscribers","subscription_url":"https://api.github.com/repos/bilgili/Livre/subscription","commits_url":"https://api.github.com/repos/bilgili/Livre/commits{/sha}","git_commits_url":"https://api.github.com/repos/bilgili/Livre/git/commits{/sha}","comments_url":"https://api.github.com/repos/bilgili/Livre/comments{/number}","issue_comment_url":"https://api.github.com/repos/bilgili/Livre/issues/comments{/number}","contents_url":"https://api.github.com/repos/bilgili/Livre/contents/{+path}","compare_url":"https://api.github.com/repos/bilgili/Livre/compare/{base}...{head}","merges_url":"https://api.github.com/repos/bilgili/Livre/merges","archive_url":"https://api.github.com/repos/bilgili/Livre/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/bilgili/Livre/downloads","issues_url":"https://api.github.com/repos/bilgili/Livre/issues{/number}","pulls_url":"https://api.github.com/repos/bilgili/Livre/pulls{/number}","milestones_url":"https://api.github.com/repos/bilgili/Livre/milestones{/number}","notifications_url":"https://api.github.com/repos/bilgili/Livre/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/bilgili/Livre/labels{/name}","releases_url":"https://api.github.com/repos/bilgili/Livre/releases{/id}","created_at":"2015-04-24T08:00:16Z","updated_at":"2015-05-04T13:03:11Z","pushed_at":"2015-11-14T15:40:55Z","git_url":"git://github.com/bilgili/Livre.git","ssh_url":"git@github.com:bilgili/Livre.git","clone_url":"https://github.com/bilgili/Livre.git","svn_url":"https://github.com/bilgili/Livre","homepage":"https://bluebrain.github.io","size":7115,"stargazers_count":0,"watchers_count":0,"language":"C++","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"BlueBrain:master","ref":"master","sha":"b2d8c95e7d4c43f0e4345495002fda3d1200c65a","user":{"login":"BlueBrain","id":1479142,"avatar_url":"https://avatars.githubusercontent.com/u/1479142?v=3","gravatar_id":"","url":"https://api.github.com/users/BlueBrain","html_url":"https://github.com/BlueBrain","followers_url":"https://api.github.com/users/BlueBrain/followers","following_url":"https://api.github.com/users/BlueBrain/following{/other_user}","gists_url":"https://api.github.com/users/BlueBrain/gists{/gist_id}","starred_url":"https://api.github.com/users/BlueBrain/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/BlueBrain/subscriptions","organizations_url":"https://api.github.com/users/BlueBrain/orgs","repos_url":"https://api.github.com/users/BlueBrain/repos","events_url":"https://api.github.com/users/BlueBrain/events{/privacy}","received_events_url":"https://api.github.com/users/BlueBrain/received_events","type":"Organization","site_admin":false},"repo":{"id":10625435,"name":"Livre","full_name":"BlueBrain/Livre","owner":{"login":"BlueBrain","id":1479142,"avatar_url":"https://avatars.githubusercontent.com/u/1479142?v=3","gravatar_id":"","url":"https://api.github.com/users/BlueBrain","html_url":"https://github.com/BlueBrain","followers_url":"https://api.github.com/users/BlueBrain/followers","following_url":"https://api.github.com/users/BlueBrain/following{/other_user}","gists_url":"https://api.github.com/users/BlueBrain/gists{/gist_id}","starred_url":"https://api.github.com/users/BlueBrain/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/BlueBrain/subscriptions","organizations_url":"https://api.github.com/users/BlueBrain/orgs","repos_url":"https://api.github.com/users/BlueBrain/repos","events_url":"https://api.github.com/users/BlueBrain/events{/privacy}","received_events_url":"https://api.github.com/users/BlueBrain/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/BlueBrain/Livre","description":"Largescale Interactive Volume Rendering Engine","fork":false,"url":"https://api.github.com/repos/BlueBrain/Livre","forks_url":"https://api.github.com/repos/BlueBrain/Livre/forks","keys_url":"https://api.github.com/repos/BlueBrain/Livre/keys{/key_id}","collaborators_url":"https://api.github.com/repos/BlueBrain/Livre/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/BlueBrain/Livre/teams","hooks_url":"https://api.github.com/repos/BlueBrain/Livre/hooks","issue_events_url":"https://api.github.com/repos/BlueBrain/Livre/issues/events{/number}","events_url":"https://api.github.com/repos/BlueBrain/Livre/events","assignees_url":"https://api.github.com/repos/BlueBrain/Livre/assignees{/user}","branches_url":"https://api.github.com/repos/BlueBrain/Livre/branches{/branch}","tags_url":"https://api.github.com/repos/BlueBrain/Livre/tags","blobs_url":"https://api.github.com/repos/BlueBrain/Livre/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/BlueBrain/Livre/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/BlueBrain/Livre/git/refs{/sha}","trees_url":"https://api.github.com/repos/BlueBrain/Livre/git/trees{/sha}","statuses_url":"https://api.github.com/repos/BlueBrain/Livre/statuses/{sha}","languages_url":"https://api.github.com/repos/BlueBrain/Livre/languages","stargazers_url":"https://api.github.com/repos/BlueBrain/Livre/stargazers","contributors_url":"https://api.github.com/repos/BlueBrain/Livre/contributors","subscribers_url":"https://api.github.com/repos/BlueBrain/Livre/subscribers","subscription_url":"https://api.github.com/repos/BlueBrain/Livre/subscription","commits_url":"https://api.github.com/repos/BlueBrain/Livre/commits{/sha}","git_commits_url":"https://api.github.com/repos/BlueBrain/Livre/git/commits{/sha}","comments_url":"https://api.github.com/repos/BlueBrain/Livre/comments{/number}","issue_comment_url":"https://api.github.com/repos/BlueBrain/Livre/issues/comments{/number}","contents_url":"https://api.github.com/repos/BlueBrain/Livre/contents/{+path}","compare_url":"https://api.github.com/repos/BlueBrain/Livre/compare/{base}...{head}","merges_url":"https://api.github.com/repos/BlueBrain/Livre/merges","archive_url":"https://api.github.com/repos/BlueBrain/Livre/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/BlueBrain/Livre/downloads","issues_url":"https://api.github.com/repos/BlueBrain/Livre/issues{/number}","pulls_url":"https://api.github.com/repos/BlueBrain/Livre/pulls{/number}","milestones_url":"https://api.github.com/repos/BlueBrain/Livre/milestones{/number}","notifications_url":"https://api.github.com/repos/BlueBrain/Livre/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/BlueBrain/Livre/labels{/name}","releases_url":"https://api.github.com/repos/BlueBrain/Livre/releases{/id}","created_at":"2013-06-11T16:13:56Z","updated_at":"2015-10-30T15:46:56Z","pushed_at":"2015-11-16T13:58:45Z","git_url":"git://github.com/BlueBrain/Livre.git","ssh_url":"git@github.com:BlueBrain/Livre.git","clone_url":"https://github.com/BlueBrain/Livre.git","svn_url":"https://github.com/BlueBrain/Livre","homepage":"https://bluebrain.github.io","size":7652,"stargazers_count":6,"watchers_count":6,"language":"C++","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":12,"mirror_url":null,"open_issues_count":18,"forks":12,"open_issues":18,"watchers":6,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/BlueBrain/Livre/pulls/188"},"html":{"href":"https://github.com/BlueBrain/Livre/pull/188"},"issue":{"href":"https://api.github.com/repos/BlueBrain/Livre/issues/188"},"comments":{"href":"https://api.github.com/repos/BlueBrain/Livre/issues/188/comments"},"review_comments":{"href":"https://api.github.com/repos/BlueBrain/Livre/pulls/188/comments"},"review_comment":{"href":"https://api.github.com/repos/BlueBrain/Livre/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/BlueBrain/Livre/pulls/188/commits"},"statuses":{"href":"https://api.github.com/repos/BlueBrain/Livre/statuses/1c7411c6084ef95485270fd40d1d149edbeaa0b1"}}}}