[odb-users] Building GOF Composite Pattern ODB-1.5.0
Dan Coffey
dcoffey at netharmonix.com
Mon Aug 8 10:57:48 EDT 2011
Hi Boris,
I had both: odb -d mysql --profile *qt *--profile *boost*
--generate-query --generate-schema rdolls.h -I/...
I removed --profile boost and the pointer error was resolved.
Dan
On 8/3/2011 2:02 PM, Dan Coffey wrote:
> Hi Boris,
>
> By changing the attribute name in the RdollsGroup class from
> */contains /*to */group /*that last error went away.
> QMap<QString, QSharedPointer<Rdolls> > *contains*;
> to
> QMap<QString, QSharedPointer<Rdolls> > *group*;
>
> The base class (Rdolls) has an attribute:
> QList<QLazyWeakPointer<Rdolls>>*contains_*;
>
> With that error gone, now I'm getting this compiler error in Qt Creator:
> In rdollsgroup-odb.cxx
> //Ifacompilererrorpointstothelinebelow,then
> //itmostlikelymeansthatapointerusedinamember
> //cannotbeinitializedfromanobjectpointer.
>
> v = ptr_traits::pointer_type (
>
> db.load< ptr_traits::element_type > (id));
>
> So I changed theabove QMap from
> QMap<QString, QSharedPointer<Rdolls> >
> to
> QMap<QString, QLazyWeakPointer<Rdolls> >
>
> and that compiled with no errors.
> Next I'm going to create the database.hxx and driver.cxx and test it out.
>
> Thanks,
>
> Dan
>
>
>
> On 8/3/2011 1:12 PM, Dan Coffey wrote:
>> Hi Boris,
>>
>> I've commented out all of the lines that cause odb processing errors
>> (attached src on last email)
>> I then compiled the files (Rdolls ...) using Qt Creator
>> Then I ran the odb command for each .cpp file without errors and the
>> *-odb.[ch]xx and *.ixx files were created without errors.
>> The Qt .pro file was modified to include all of the created
>> *-odb.[ch]xx files.
>> When I do a rebuild all in Qt I get the following errors from the
>> rdollsgroup-odb.hxx file
>>
>> /D:\Development\C++\TestCode\ODB\rdolls\rdolls-build-desktop\..\rdolls\rdollsgroup-odb.hxx:118:
>> error: redefinition of 'struct
>> odb::access::object_traits<RdollsGroup>::contains_traits'
>>
>> D:\Development\C++\TestCode\ODB\rdolls\rdolls-build-desktop\..\rdolls\rdollsgroup-odb.hxx:107:
>> error: previous definition of 'struct
>> odb::access::object_traits<RdollsGroup>::contains_traits'/
>>
>> Thanks,
>>
>> Dan
>>
>> Env:
>> XP SP3
>> minGW
>> Qt 4.7
>> g++ 4.5.2
>>
>> On 8/3/2011 12:15 PM, Dan Coffey wrote:
>>> Hi Boris,
>>>
>>> QMap<QString, QSharedPointer<Rdolls> >
>>>
>>> works with the odb commands. I also tried
>>> QMap <QString, Rdolls> contains; but this will cause odb to fail.
>>> QMap <QString, QLazyWeakPointer<Rdolls> > contains; which works with
>>> the ODB preprocessor.
>>>
>>> In the odb manual example code (pg 58) you have - std::map<insigned
>>> short, float> age_weight_map_;
>>> Is it possible to have a developer defined class as the value?
>>>
>>> Attached are the .h files, process.out which has the odb processing
>>> commands and results.
>>> All of these compile in Qt Creator without error, I then run the odb
>>> commands and the output is process.out.
>>> I also include the Qt files.
>>>
>>> Thanks,
>>>
>>> Dan
>>>
>>> On 8/3/2011 10:20 AM, Boris Kolpackov wrote:
>>>> Hi Dan,
>>>>
>>>> Dan Coffey<dcoffey at netharmonix.com> writes:
>>>>
>>>>> QMap<QString, Rdolls> contains;
>>>> Maybe that should be:
>>>>
>>>> QMap<QString, Rdolls*>
>>>>
>>>> Or, better yet:
>>>>
>>>> QMap<QString, QSharedPointer<Rdolls> >
>>>>
>>>> If that doesn't help, please send a minimal but complete header
>>>> file that fails to compile so that I can take a look. Without
>>>> seeing the actual C++ declarations I am just guessing.
>>>>
>>>> Boris
More information about the odb-users
mailing list