You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@ignite.apache.org by "Igor Sapego (JIRA)" <ji...@apache.org> on 2016/11/25 10:46:58 UTC
[jira] [Comment Edited] (IGNITE-1443) CPP: Implement cache
continuous queries.
[ https://issues.apache.org/jira/browse/IGNITE-1443?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15694014#comment-15694014 ]
Igor Sapego edited comment on IGNITE-1443 at 11/25/16 10:46 AM:
----------------------------------------------------------------
Vladimir,
Here is my approach:
I've added special class {{ignite::Reference}} which can hold any kind of user reference. It can be used like that:
{code}
// Function that takes ignite::Reference as an argument.
void foo(ignite::Reference<SomeType> ref);
...
// User passes reference of their object like that:
SomeType obj1;
// Passing simple reference.
foo(ignite::PassReference(obj1);
// Passing object copy.
foo(ignite::PassCopy(obj1);
SomeType* obj2 = new SomeType;
// Passing ownership to the function. That means, object will be deleted,
// once Ignite does not need it anymore. User should not use pointer after
// they have passed it to Ignite.
foo(ignite::PassOwnership(obj2);
std::shared_ptr<SomeType> obj3 = std::make_shared<SomeType>();
// Passing smart pointer. In this case, Reference class behaves like
// smart pointer of the type, user passes to it.
foo(ignite::PassSmartPointer(obj3);
{code}
You can take a closer look at the code on linked Upsource page. There are also tests with all kind of scenarios in file {{reference_test.cpp}}.
Please, review and let me know what you think. Thanks.
was (Author: isapego):
Vladimir,
Here is my approach:
I've added special class {{ignite::Reference}} which can hold any kind of user reference. It can be used like that:
{code}
// Function that takes ignite::Reference as an argument.
void foo(ignite::Reference<SomeType> ref);
...
// User passes reference of their object like that:
SomeType obj1;
// Passing simple reference.
foo(ignite::PassReference(obj1);
// Passing object copy.
foo(ignite::PassCopy(obj1);
SomeType* obj2 = new SomeType;
// Passing ownership to the function. That means, object will be deleted,
// once Ignite does not need it anymore. User should not use pointer after
// they have passed it to Ignite.
foo(ignite::PassOwnership(obj2);
std::shared_ptr<SomeType> obj3 = std::make_shared<SomeType>();
// Passing smart pointer. In this case, Reference class behaves like
// smart pointer of the type, user passes to it.
foo(ignite::PassSmartPointer(obj3);
{code}
You can take a closer look at the code on linked Upsource page. There are also tests with all kind of scenarios in file {{reference_test.cpp}}.
Please, review and tell me what do you think. Thanks.
> CPP: Implement cache continuous queries.
> ----------------------------------------
>
> Key: IGNITE-1443
> URL: https://issues.apache.org/jira/browse/IGNITE-1443
> Project: Ignite
> Issue Type: Task
> Components: platforms
> Affects Versions: 1.1.4
> Reporter: Vladimir Ozerov
> Assignee: Vladimir Ozerov
> Labels: cpp, important, roadmap
> Fix For: 2.0
>
>
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)