{"action":"closed","issue":{"url":"https://api.github.com/repos/billyquith/ponder/issues/30","repository_url":"https://api.github.com/repos/billyquith/ponder","labels_url":"https://api.github.com/repos/billyquith/ponder/issues/30/labels{/name}","comments_url":"https://api.github.com/repos/billyquith/ponder/issues/30/comments","events_url":"https://api.github.com/repos/billyquith/ponder/issues/30/events","html_url":"https://github.com/billyquith/ponder/issues/30","id":157925329,"number":30,"title":"Can ponder be used to build a generic data repository?","user":{"login":"Weeena","id":19182442,"avatar_url":"https://avatars.githubusercontent.com/u/19182442?v=3","gravatar_id":"","url":"https://api.github.com/users/Weeena","html_url":"https://github.com/Weeena","followers_url":"https://api.github.com/users/Weeena/followers","following_url":"https://api.github.com/users/Weeena/following{/other_user}","gists_url":"https://api.github.com/users/Weeena/gists{/gist_id}","starred_url":"https://api.github.com/users/Weeena/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Weeena/subscriptions","organizations_url":"https://api.github.com/users/Weeena/orgs","repos_url":"https://api.github.com/users/Weeena/repos","events_url":"https://api.github.com/users/Weeena/events{/privacy}","received_events_url":"https://api.github.com/users/Weeena/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/billyquith/ponder/labels/enhancement","name":"enhancement","color":"84b6eb"},{"url":"https://api.github.com/repos/billyquith/ponder/labels/question","name":"question","color":"cc317c"}],"state":"closed","locked":false,"assignee":{"login":"billyquith","id":1754471,"avatar_url":"https://avatars.githubusercontent.com/u/1754471?v=3","gravatar_id":"","url":"https://api.github.com/users/billyquith","html_url":"https://github.com/billyquith","followers_url":"https://api.github.com/users/billyquith/followers","following_url":"https://api.github.com/users/billyquith/following{/other_user}","gists_url":"https://api.github.com/users/billyquith/gists{/gist_id}","starred_url":"https://api.github.com/users/billyquith/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/billyquith/subscriptions","organizations_url":"https://api.github.com/users/billyquith/orgs","repos_url":"https://api.github.com/users/billyquith/repos","events_url":"https://api.github.com/users/billyquith/events{/privacy}","received_events_url":"https://api.github.com/users/billyquith/received_events","type":"User","site_admin":false},"milestone":{"url":"https://api.github.com/repos/billyquith/ponder/milestones/2","html_url":"https://github.com/billyquith/ponder/milestones/1.2","labels_url":"https://api.github.com/repos/billyquith/ponder/milestones/2/labels","id":1749189,"number":2,"title":"1.2","description":"* Error handling policies #13\r\n* needless memory allocations #11","creator":{"login":"billyquith","id":1754471,"avatar_url":"https://avatars.githubusercontent.com/u/1754471?v=3","gravatar_id":"","url":"https://api.github.com/users/billyquith","html_url":"https://github.com/billyquith","followers_url":"https://api.github.com/users/billyquith/followers","following_url":"https://api.github.com/users/billyquith/following{/other_user}","gists_url":"https://api.github.com/users/billyquith/gists{/gist_id}","starred_url":"https://api.github.com/users/billyquith/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/billyquith/subscriptions","organizations_url":"https://api.github.com/users/billyquith/orgs","repos_url":"https://api.github.com/users/billyquith/repos","events_url":"https://api.github.com/users/billyquith/events{/privacy}","received_events_url":"https://api.github.com/users/billyquith/received_events","type":"User","site_admin":false},"open_issues":2,"closed_issues":2,"state":"open","created_at":"2016-05-05T06:54:19Z","updated_at":"2016-06-13T12:09:18Z","due_on":null,"closed_at":null},"comments":7,"created_at":"2016-06-01T14:44:44Z","updated_at":"2016-06-13T12:09:18Z","closed_at":"2016-06-13T12:09:18Z","body":"We consider building a generic data repository (GDR) in which entries are stored in the following manner:\r\n```\r\nstruct Entry {\r\n    const ponder::Class& metaClass;\r\n    void* p;\r\n}\r\n```\r\nIf we have created some object of class `T` (with `T` being a class declared to ponder)\r\n```\r\nT* pObject = ...\r\n```\r\nwe would store it in the GDR like this:\r\n```\r\nsomeEntry.p = pObject;\r\nsomeEntry.metaClass = ponder::classByObject(*pObject);\r\n```\r\nIf that would work we could examine our GDR in a very generic way by initializing a `ponder::UserObject` for each entry and working with that `ponder::UserObject` through the reflection capabilities of ponder.\r\n\r\nAlas, for such a generic data repository to work some obstacles would have to be overcome.\r\n\r\nFirst of all, there currently is no functionality to initialize a `ponder::UserObject` from a `ponder::Class` and a `void*` pointer. (I'd guess this would be doable.)\r\n\r\nSecond, we would also like to store PODs, std::string, std::array, std::vector and the like in the GDR. For those types, there is no direct support in ponder, i.e. it is not possible to simply declare those types to ponder and initialize a `ponder::UserObject` for it. One way would be to wrap those types into custom classes like\r\n```\r\ntemplate <typename T>\r\nstruct PodWrapper\r\n{\r\n    T value;\r\n};\r\nPONDER_TYPE(PodWrapper<uint8_t>)\r\nPONDER_TYPE(PodWrapper<uint16_t>)\r\n...\r\nponder::Class::declare<PodWrapper<uint8_t>>(\"PodWrapper<uint8_t>\")\r\n    .constructor()\r\n    .property(\"Value\", &PodWrapper<uint8_t>::value);\r\nponder::Class::declare<PodWrapper<uint16_t>>(\"PodWrapper<uint16_t>\")\r\n    .constructor()\r\n    .property(\"Value\", &PodWrapper<uint16_t>::value);\r\n...    \r\n```\r\nbut maybe there is some better way.\r\n\r\nI would be glad to hear your opinion on the subject of this issue.\r\n"}}
{"actor":{"display_login":"billyquith"}}