[odb-users] How to cache the queried object pointer?

Justin Huang yohuang at nvidia.com
Tue Nov 5 10:15:42 EST 2019


Hi Boris,

You root caused it so quickly. Thanks very much! The Module_ports table is now created when I commented out #pragma db transient. I spent a lot of time to find a workaround, i.e., I added a dummy data member before ports_. Now I can remove it.

Maybe this can be documented in the manual html page.

Thanks,
Justin

-----Original Message-----
From: Boris Kolpackov <boris at codesynthesis.com> 
Sent: Tuesday, November 5, 2019 10:38 PM
To: Justin Huang <yohuang at nvidia.com>
Cc: odb-users at codesynthesis.com
Subject: Re: [odb-users] How to cache the queried object pointer?

Justin Huang <yohuang at nvidia.com> writes:

> public:
>     #pragma db transient
>     static std::map<std::string, Module*> modules_;
>     static size_t count;
>
> private:
>     std::vector<Port*>               ports_;
>     std::vector<Instance*>       instances_;
>     std::vector<Connection*> connections_;

You don't need to mark static data members as transient. And I think what happens here is that db transient pragma applies to the first non-static data member, which is ports_.
-----------------------------------------------------------------------------------
This email message is for the sole use of the intended recipient(s) and may contain
confidential information.  Any unauthorized review, use, disclosure or distribution
is prohibited.  If you are not the intended recipient, please contact the sender by
reply email and destroy all copies of the original message.
-----------------------------------------------------------------------------------



More information about the odb-users mailing list