2002 2003 2004 <2005> 2006 2007 2008 2009 2010 2011 2012 2013 2014 2015 2016 2017 2018 2019 2020 2021 2022 2023 2024 2025 | Index | 2002 2003 2004 <2005> 2006 2007 2008 2009 2010 2011 2012 2013 2014 2015 2016 2017 2018 2019 2020 2021 2022 2023 2024 2025 |
<== Date ==> | <== Thread ==> |
---|
Subject: | Re: data access structures, strings |
From: | Marty Kraimer <[email protected]> |
To: | [email protected] |
Date: | Fri, 30 Sep 2005 06:29:32 -0500 |
Andrew Johnson wrote:
I like the char * pointer for things like record type names, record instance names, etc.(for java a regular String would accomplish the same thing) This would take care of one main use of names It does mean that we can not completely delete anything that has such names because the storage for at least the name will remain. For example we can not completely delete a record instance. I think this is OK.Marty Kraimer wrote:Thus all the IOC database needs is a:1) nonmutable reference counted continguous string. When the reference count goes to 0 the storage can be reclaimedWe might need more than one implementation of the nonmutable string; one where the storage is obtained from the system (new/malloc), and a second where the storage is a char* literal that must not be freed when it's no longer referenced. Compiling DBD files generates literals for record type names, field names and menu choice strings. I think we should just store the char* pointer in these cases without using any kind of string wrapper - if any reference count exists it would have to apply to the descriptor as a whole, not just to the name string.
In my design any const char* buffer or literal can be wrapped with a ConstString at the point of use if it has to be passed to a routine that takes a StringReader. Ownership would never be passed that way though.
Can we accomplish the same thing without exposing the entire String class? Something like: interface DbInstance { ConstString *getName(); ... }